Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Tried sudo grub-install on sda1 but it complained about being a BAD IDEA.

I had to install windows for a work related issue so I used a separate disk (I had used it for ubuntu on this computer, but bought a bigger disk so installed ubuntu on that and left the old one in in case I needed an old file). Windows installed fine but overwrote Grub. So if I choose the Ubuntu disk to boot first in BIOS I get a blank screen.

I googled and followed this advice: https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows

However, when I get down to this section:

sudo grub-install --root-directory=/media/0d104aff-ec8c-44c8-b811-92b993823444 /dev/sda1

I get this:

Attempting to install GRUB to a partition instead of the MBR. This is a BAD idea…

--recheck does nothing. Any ideas?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

The bad idea warning is caused by trying to install grub onto a partition rather than a hard disk. Having booted up your Live CD,

  • when you run grub-install as per the Guide in the Ubuntu Wiki, make sure the hard drive you pass as an argument is /dev/sda, not /dev/sda1.

    That is:

    sudo grub-install --root-directory=/media/[GUID] /dev/sda
    

    Where [GUID] is the identifier of the disk you have found out using mount | tail -1

Here's why:

  • The master boot record, MBR, is the first 512 byte 'sector' of any partitioned hard disk.

    • The BIOS searches this sector when trying to find a device it can boot from.

    In the GNU/Linux system, your hard disks are all named /dev/sd[x], where x are consecutive letters. E.g.: /dev/sda and /dev/sdb. The first partition on the first disk is called /dev/sda1. The fourth partition on the seventh hard disk is called /dev/sdg4, and so on. At the very least, you'll have one partition.

  • These partitions are not searched for bootable data by the bios. As a result, grub-install [...] /dev/sda7 will issue a warning. You can install it there, but in almost any case, you shouldn't.

share|improve this answer
    
Worked perfectly; can't believe I didn't see that. Thanks! –  Shazzner Jan 2 '11 at 8:46
2  
Maybe not smart of me to ask this on a very old question, but why exactly is it bad to install grub on a partition? I read some tutorials where they prefer doing it that way, and then use the windows boat loader, and let it point to that boot partition. –  gl3nn Mar 2 '13 at 14:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.