Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How can I repair grub? (How to get Ubuntu back after installing Windows?)

I upgraded my laptop with an SSD, moving my old HDD to where the DVD-drive was, so that I could have speed and storage.

Now, I have reinstalled Ubuntu on the SSD, deleting all the partitions on the old HDD to make space for a data partition. But now the laptop doesn't even get to GRUB 2 if the HDD is plugged in! If I take it out, everything works, but as soon as I plug it in and retry to boot, I won't find GRUB.

At first, I thought it was because of the boot order, but the order was OK: first the notebook hard drive (SSD) and then the CD/DVD drive (which in reality is the HDD).

How can I fix it?

Doing a simple grub-install /dev/sda doesn't work.. The SSD is sda, and the HDD is sdb.

share|improve this question

marked as duplicate by RolandiXor, hexafraction, Mitch, Anwar Shah, RobotHumans Sep 21 '12 at 20:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

You missed a step, which was to update the grub configuration file. This is really a duplication question of this one:… . Have a look at that and try the grub update after chrooting into the file system on the SSD – fabricator4 Sep 21 '12 at 3:01
The cited possible duplicate is only a duplicate if this questioner has a sufficiently similar problem. I don't think that's probably the case. – John S Gruber Sep 21 '12 at 5:19
Wow, how is this got closed? The problem OP's having is totally different, in fact, Ubuntu is the only OS on his machine and GRUB is properly installed on the SSD. – Sergey Sep 22 '12 at 20:54

The fact that the machine boots without the HDD plugged in suggests that GRUB is indeed installed correctly on your SSD and the problem is in the boot order, i.e. your HDD is probed first, BIOS finds (non-functional) GRUB there and passes control to it.

Please note that even if you installed the HDD into the bay where DVD drive used to be, it will still be seen as hard drive by BIOS. Some BIOSes have two separate menus for setting boot order - one where you choose between Hard Drive, CD/DVD and USB boot, and another separate menu where you can specify order of hard drives.

I strongly suspect that you have Hard Drive on the top in the first menu, but in the second menu your HDD takes precedence over the SSD.

enter image description here

In the picture above, apart from making [Hard Drive] the Fist Boot Device, you also need to go into Hard Drive Boot Priority sub-menu and make sure your SSD takes priority over the HDD.

share|improve this answer
I agree with Sergey that your BIOS is passing control over to the MBR on the HDD if it is plugged in, rather than to the SSD. If you can't change a BIOS setting as Sergey suggests I think you will have to install Grub to a tiny partition on the HDD (one with just a /boot and a /boot/grub directory can suffice. Note that the disk order as seen by the operating system once it boots doesn't necessarily match the disk order as seen by grub. – John S Gruber Sep 21 '12 at 4:16
My BIOS doesn't let me change this setting,so i had to install grub to the it works,but it feels so much like a workaround. – uahug Sep 22 '12 at 13:45
Still,thank you very much! :) – uahug Sep 22 '12 at 13:46
I'd like to point out that I never saw a BIOS without an option to change hard drive priority. It doesn't mean no such BIOS exist but it must be pretty rare. Sometimes the option is tucked away somewhere in another screen, maybe you have another look. Another thing to try would be to swap the drives - connect the SSD to the cable where HDD is and vice versa. – Sergey Sep 22 '12 at 20:59

I suggest you do a complete format to the HDD and then try again. It is possible that the partitions on the HDD still contain information that confuses the grub loader.

If that doesn't help you will HAVE to have the grub installed on the HDD, when both HDD and SSD are present (while the rest of the OS on the SSD). So, sudo grub-install /dev/sdb etc. It is possible that although the SSD is sda and the HDD is sdb both are on the same SATA/IDE channel and the BIOS give priority by default to the HDD based on the device type.

Another option you can try is Grub Customizer first. It is a graphical tool for customizing grub. But since the grub itself is not the problem but getting to it is, it may be irrelevant. Here is the info anyway:

Installation of the graphical 'grub-customizer' tool:

sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer
share|improve this answer
The first two paragraphs are just totally utterly wrong :) – Sergey Sep 21 '12 at 3:39

Does the computer pass the boot-time hardware check when the HDD is plugged in? Do you see a command prompt (like grub>)? Try the HDD on another device if possible. Maybe HDD is damaged. And try update-grub instead of grub-install.

If you want to use grub-install, though, you should have the partition that contains the /boot directory mounted. e. g. if the /boot directory is in the /dev/sda1, then:
sudo mount /dev/sda1 /mnt
sudo grub-install --root-directory=/mnt/ /dev/sda

share|improve this answer

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