5

I have two SSDs.The first one has Ubuntu 14.04 LTS and Windows 8.1 Pro.The second one has Kali Linux installed.Since I installed Kali Linux after Ubuntu and Windows 8.1 Pro it's bootloader now is in use.The problem is when I remove the second SSD I am not able to boot on the operating systems of the first SSD,because grub can't find the second SSD and grub-rescue launches instead.Is it possible somehow to make this triple boot system able to work even when the second SSD is missing?

I tried grub-install /dev/sda1 (sda1 is the partition in which Ubuntu is installed) but I get an error which says:

attempting to install grub to a partitionless disk or to a partition. this is a BAD IDEA.

I tried also grub-install /dev/sda which didn't gave any errors or warnings but when I tested it by removing the second SSD grub-rescue launched again for the same aforementioned reason.

I tried grub-install --force /dev/sda , grub-install --force /dev/sda1 , grub-setup /dev/sda , grub-setup /dev/sda1 , grub-setup --force /dev/sda1 , grub-setup --force /dev/sda but with no luck.

  • Is Windows 8 pre-installed? If so it is UEFI with gpt partitioning. You should be able to install the UEFI boot loader to the efi partition, but if you installed in BIOS mode you have to have a bios_grub partition of 1 or 2MB unformatted with bios_grub flag for it to install correctly. Better to have Ubuntu & all other systems in UEFI boot mode. – oldfred May 26 '14 at 23:58
  • No it wasn't pre-installed.The operating systems are all installed in Legacy mode. – und3rd06012 May 27 '14 at 12:11
  • 1
    Then you just install grub to sda or sdb depending on which drive you boot from. Any install to a partition will not be bootable directly, but if you have another install with grub2 then it should add it to your menu and let you boot both systems. You can also try Boot-Repair, but do not run auto repair as it just installs one grub to all drives. help.ubuntu.com/community/Boot-Repair Use advanced mode and choose one system and one drive to install boot loader into. – oldfred May 27 '14 at 15:37
  • So I ran boot-repair and I chose Advanced options.On the "GRUB location" tab I chose the setting which says: "Place GRUB in all disks (except USB disks without OS).On the tab which says "Other options" I chose "Place the boot flag on:sda1 (Ubuntu 14.04 LTS) although this is more like in anyones free choice.The rest of the options that the program has were remained as they were. @oldfred Please type the above as an answer so I can accept it as one and let other people know who have the same problem which is the answer. – und3rd06012 May 27 '14 at 21:01
  • I think you should have left the Windows boot loader on the Windows drive. You still can use Boot-Repair but choose Windows and just install to the Windows drive. – oldfred May 27 '14 at 21:26
5

Boot-Repair is one of the easier ways to install or repair install of grub2's boot loader (or Windows) to MBR. For BIOS based systems, but Boot-Repair can also work on UEFI based systems also.

https://help.ubuntu.com/community/Boot-Repair

But if you have more than one drive and different operating systems in each drive best not to use Auto-Repair. Auto-Repair will install one grub to every MBR. Better to keep each operating system and its boot loader on separate drives, so each drive could be booted without the other.

Use Advanced options, choose operating system, and choose which drive to install boot loader into.

  • I used Boot-repair recently after moving to a new SSD, and it worked well, although I only had the single OS to think about. I didn't actually investigate the options enough to know how it would handle this situation, though. Sounds like it was a good idea. – Marty Fried May 27 '14 at 23:35
4

Don't get confused by the fact that GRUB has two parts, one in the master boot record (MBR) for the entire disk, and the other part(s) in the partition of the system that has the menu for GRUB. The MBR code connects to the partition with the menu. So, you don't just do grub-install to a partition, but also to a disk.

Now, I'm not up on the EFI part, as I don't run Windows at all, and it has not been an issue for me. Plus, I'm relying on how I did things a while back, but I hope I'm remembering correctly. Hopefully, this will help explain things enough to at least let you ask more specific questions.

I think what you may need to do is to install the GRUB bootloader into the MBR of both drives, and choose which drive to boot from your BIOS. One will bring up the menu to choose between Ubuntu and Windows, and the other will boot into Kali. If you remove one drive, the other will still boot.

The way I used to set it up is to boot from a liveCD, like the install CD for Ubuntu. The disks you want to modify will need to be mounted, either automatically or by you. If you use the automatic mounting, it will probably mount in /media/UUID of disk. Then, you issue a command such as this (assumes the target disk is sda, but you'll have to determine which it is.

sudo grub-install --root-directory=/media/(UUID or directory name) /dev/sda

You are specifying the root directory where the grub menu is, (/boot/grub). It should have the menu already from previous installation. Once you can boot, you could run update-grub to regenerate the menu and allow all available operating systems to be accessed, if both disks are present.

I didn't go into a lot of detail for two reasons: 1, I don't know if you need it, and 2, I'm not positive my memory is 100% correct, so if this is what you want to do, either I or someone else can confirm that it will work.

  • 1
    Ok I ran sudo grub-install --root-directory=/media/(UUID or directory name) /dev/sda from Ubuntu LiveCD and I did the same thing for the SSD which has installed Kali Linux,but for reasons I can't think when I rebooted GRUB wasn't able to see the Kali partition.I think though your idea was right I just don't know why it didn't work.Anyway I fixed it with Boot-Repair just like oldfred suggested.Sortly,I will leave a comment under oldfred's comment in which I will explain what settings I used to fix it and make it work the way I asked. – und3rd06012 May 27 '14 at 20:22
  • Thanks for the update; glad it got straightened out. Are you now able to boot from either disk? We could probably figure out why it didn't work for the Kali disk, but if it's all OK now, it's probably not important. – Marty Fried May 27 '14 at 23:32
  • 1
    Yes.I can boot from all disks now even when one is missing.Thanks for your valuable help.:) – und3rd06012 May 28 '14 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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