0

I want to have dual-boot two different Ubuntu distributions on the same hard drive. I've installed the first, with external /boot partition (e.g. /dev/sda2).

Then I've installed the second distribution, with separate /boot partition (e.g. /dev/sda5).

I thought, that after installation of the second Ubuntu, the update-grub would automatically add entries for the first Ubuntu by chainloading /dev/sda2 from /dev/sda5. It did not happen.

Now, I wonder, what is the recommended way of chainloading the /dev/sda2 from /dev/sda5. I believe the recommended method would involve using the existing scripts on /etc/grub.d because the /boot/grub/grub.cfg will get replaced if I change it manually.

2

First of all, the effect I need (joining grub menu from one distribution with other) does not need chainloading; it is enough to merely re-load grub configuration with the configfile Grub 2 command in file /etc/grub.d/40_custom, like this:

menuentry "Ubuntu Precise 64 bit" {
   configfile (hd0,gpt2)/grub/grub.cfg   
}

where (hd0,gpt2) is the address of the /boot partition of the other Linux (it is 2nd partition on GPT sda disk in this example).

After the edit it is important to run sudo update-grub, so the changes are propagated into /boot/grub/grub.cfg

This way one can keep elegant and error-free way of maintaining two separate Linux instalations (which might for instance share the same btrfs root partition, but on different subvolumes)

0

On bios system, I prefer to chainload with the multiboot option :

menuentry "Ubuntu, Trusty (on lvm/nantes-trusty)" --class gnu-linux --class gnu --class os {
insmod part_gpt
insmod lvm
insmod ext2
set root='lvm/nantes-trusty'
multiboot /boot/grub/i386-pc/core.img
}

The advantage with that is you can recreate a partition dedicated to grub, that will never change unless you want to remove or add another OS, and you are not making os dependent on themselves, wich is very usefull when there are changes in grub versions.

Because it happened to me to have a grub version that would load an old grub.cfg file. This is not happening here, because when you load core.img, you load the grub that goes along it's own grub.cfg file.

In fact it's similar to what uefi does when it loads grub, because you give him something like core.efi instead of core.img

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.