The easiest way to boot multiple operating systems is to use one operating system's bootloader to boot this operating system directly and have it load the other operating systems' bootloaders. Often this is the only option. Here, Grub 1 (the Solaris bootloader) and Grub 2 (the Ubuntu bootloader) can load each other's kernels, so it's also an option.
To have Solaris's Grub load Ubuntu's bootloader (which is what I recommend):
- Tell Ubuntu to install its bootloader on its own partition,
/dev/sda5. (The installation program will probably warn you that this is a bad idea because it doesn't make your system bootable; tell it to go ahead since you're using a different operating system's bootloader to boot your system, which is unusual.)
In Solaris, add a menu entry for Ubuntu in the menu.lst file (typically located in /boot/grub/menu.lst, but use the command bootadm list-menu to see where it is on your system):
title Ubuntu
root (hd0,4)
chainloader +1
If you want Ubuntu's bootloader to load Solaris's bootloader (also recommended, but this goes against making Solaris the “primary OS”), install Ubuntu's Grub 2 on the boot sector, and Solaris's Grub 1 on the boot sector of the Solaris partition. Run sudo update-grub on Ubuntu once if you modify Solaris's boot sector after installing Ubuntu, and it'll pick up the Solaris entry (perhaps by a generic name rather than “Solaris”). If update-grub doesn't pick up the Solaris entry, then declare it manually by creating a file called /etc/grub.d/31_local_solaris with the following contents then running sudo update-grub:
#!/bin/sh
set -e
prefix=/usr
libdir=${prefix}/lib
. ${libdir}/grub/grub-mkconfig_lib
cat <<'EOF'
menuentry 'Solaris' {
EOF
save_default_entry
prepare_grub_to_access_device /dev/sda1
cat <<'EOF'
chainloader +1
}
EOF
If you want Solaris's Grub to load the Ubuntu kernel directly, install it on the boot sector and add entries to menu.lst on Solaris (see above for where this file is located). Note that this is documented to work, but there are reports that it doesn't (it may be a depend on the Solaris version).
title Ubuntu
root (hd0,4)
kernel /vmlinuz root=/dev/sda5 ro
initrd /initrd.img
title Ubuntu (single-user mode)
root (hd0,4)
kernel /vmlinuz root=/dev/sda5 ro single
initrd /initrd.img
I don't think Grub 2 currently supports loading a Solaris kernel directly.
menu.lstfile by hand to add entries for Ubuntu. What is the current content of the file? How are your disks partitioned (fdisk -l /dev/sda /dev/sdbunder Linux or whatever the corresponding invocation offdiskis under Solaris)? – Gilles Jul 26 '11 at 20:28