Install GRUB on a different partition on triple boot system

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.


Solution 1:

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.

Solution 2:

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.