Chaining bootloaders for unusual setup

Solution 1:

I see what you're trying to do (one-level boot menu, instead of two separate menus) and would like to propose an alternate solution to the same effect:

Keep bootmgr the main menu, don't set timeout to zero. Use EasyBCD to add two separate entries: an Ubuntu entry and a GRUB4Dos entry (EasyBCD has its own copy of Grub4Dos called NeoGrub).

Make sure to erase everything but Ubuntu from Ubuntu GRUB's menu. Configure EasyBCD's NeoGrub menu to mimic your existing Grub4Dos menu.

You'll have a single-level menu where you can boot into Windows, Ubuntu, or GRUB4Dos.

You will never have to update Grub4Dos/NeoGrub and your boot will work through Ubuntu upgrades and kernel upgrades without needing to modify a thing.

Solution 2:

The problem is I have no idea how to install another, independent GRUB2

Installing an independent GRUB2 is straight forward (for always having it point to the current Linux/Ubuntu Kernel, see my question).

Make enough backups (dd is your friend) before you start!

[I want this post to be plain and easy, so everybody who is not familiar with the GRUB configuration can use it to install an independent GRUB. If anyone has suggestions on how to improve this post, please let me know.]

Create a separate boot partition where you will install GRUB2 and nothing else. It will not be mounted on any operating system that you have installed, it's only used for selecting the first system. You might eventually have to do some some rearrangements (moving partitions around to make space or maybe even destroy and recreate them in different order). I like to have my GRUB partition to be the first partition on the disk (or the second, after the BIOS partition if using GPT), 50 MB in size (could be 5, but hdds are large). Install all the operating systems first, because they'll overwrite the MBR. Do NOT use /dev/sda1 in any operating system.

Boot some live system that comes with GRUB2 tools. I recommend Parted Magic (which you can also use for all your partitioning).

  • Be careful not to type sda2 instead of sda1 or something. You can easily wipe your hdd clean with one typo (of course you have a full backup, so nothing would be lost).
  • Format /dev/sda1 with ext2.

mkfs.ext2 /dev/sda1

  • Mount GRUB partition and install GRUB2:

cd /mnt

mkdir sda1

mount /dev/sda1 sda1

grub-install --boot-directory=/mnt/sda1 /dev/sda

  • "Installation finished, no error reported."

cd sda2

ls

  • "grub/ lost+found/"
  • Create a new menu config manually (it's also possible to have GRUB generate one).

vi grub/grub.cfg

menuentry "Windows 7 (loader)" --class windows --class os {

insmod    part_msdos

insmod    ntfs

set       root='(hd0,msdos2)'

chainloader +1

}

menuentry 'Debian (or Ubuntu)' {

insmod    part_msdos

insmod    ext2

set       root='(hd0,msdos3)'

echo      'Loading Linux...'

linux     /boot/vmlinuz root=/dev/sda6 ro quiet <- current vmlinuz file name

echo      'Loading initial ramdisk...'

initrd    /boot/initrd.img <- current initrd.img file name

}

menuentry 'Fedora (just another example)' {

insmod    part_gpt

insmod    ext2

set       root='(hd0,msdos3)'

echo      'Loading Linux...'

linux     /boot/vmlinuz-3.7.3-101.fc17.x86_64 root=UUID=[UUID of /dev/sda3] ro rd.md=0 rd.lvm=0 rd.dm=0 SYSFONT=True  KEYTABLE=us rd.luks=0 LANG=en_US.UTF-8

echo      'Loading initial ramdisk...'

initrd    /boot/initramfs-3.7.3-101.fc17.x86_64.img

}

  • I've tried this with Parted Magic 11.11.11 (lucky version number), the GRUB tools on there created only the "grub" directory on /dev/sda1. A different version might create a "grub2" directory. Either way, you put your GRUB2 configuration file in there (GRUB2 looks like a Shell script, in GRUB1, it was a simple menu.lst, but that's way back).
  • Replace "[UUID of /dev/sda3]" with what ls -l /dev/disk/by-uuid | grep sda3 tells you.
  • Replace "/boot/vmlinuz" with the real file name (in /dev/sda3, your Linux partition).
  • Replace "/boot/initrd.img" in the same way.
  • Unmount and reboot. Your computer will boot a simple GRUB2, listing the entries you have specified ("Windows 7 (loader)", "Debian (or Ubuntu)"). If you've done it right, you'll be able to boot both Windows and Linux directly from that independent GRUB.
  • Again, the Linux entry points to a specific Kernel version. It would have to be manually updated (mount /dev/sda1 and modify grub/grub.cfg), which is a major drawback. Again, see my other question about setting up GRUB for that.

(lol, superuser removed every instance of the word "have")