Skip to content

Dual booting Linux and Solaris with ZFS aware GRUB 0.97

dajhorn edited this page Jan 31, 2012 · 8 revisions

Current Solaris, OpenSolaris, and OpenIndiana releases install the GRUB 0.97 boot loader (aka "GRUB Legacy") with special downstream ZFS support.

GRUB 0.97 can be used to start a Linux system from a ZFS root pool or other filesystem, but the GRUB 2.0 package that is usually distributed with Linux cannot start Solaris from a ZFS root pool.

Example menu.lst Configuration

The GRUB 0.97 configuration file is usually rpool/boot/grub/menu.lst. This example has stanzas for Ubuntu 11.10 (Oneiric Ocelot), OpenIndiana, and OpenSolaris:

splashimage /boot/grub/splash.xpm.gz
foreground 343434
background F7FbFF
timeout 30
default 0
##
title ubuntu-1
findroot (pool_rpool,0,a)
bootfs rpool/ROOT/ubuntu-1
kernel /boot/vmlinuz-3.0.0-11-generic boot=zfs bootfs=rpool/ROOT/ubuntu-1
initrd /boot/initrd.img-3.0.0-11-generic
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title OpenIndiana Development oi_151a X86
findroot (pool_rpool,0,a)
bootfs rpool/ROOT/openindiana

splashimage /boot/solaris.xpm
foreground FF0000
background A8A8A8
kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS,console=graphics
module$ /platform/i86pc/$ISADIR/boot_archive
#--------------------END BOOTADM---------------------
title Solaris 11 s10x_90 X86
findroot (pool_rpool,0,a)
kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS
module$ /platform/i86pc/$ISADIR/boot_archive
#============ End of LIBBE entry =============

This file is safe to edit manually, just add a stanza for the Linux installation, but do not change any existing comments or whitespace.

Stanza lines for Linux

All lines given in the example are required to start Linux from a native ZFS root filesystem.

  • title: An arbitrary name for the stanza that appears in the boot menu.
  • findroot: Use the same value as the Solaris lines, which is almost always "(pool_rpool,0,a)".
  • bootfs: The root filesystem name. (This never begins with a '/' character.)
  • kernel: The absolute path name of the kernel image with kernel parameters.
  • initrd: The absolute path name of the initramfs archive.

NOTE: The boot=zfs bootfs=rpool/ROOT/ubuntu-1 kernel parameters are correct if the Linux system is using the zfs-initramfs package, which is the default on most DEB and RPM systems. Substitute boot=zfs root=zfs:rpool/ROOT/other-1 or root=ZFS=rpool/ROOT/other-1 if the Linux system is using the zfs-dracut package, or a variant of it, like on Gentoo.

Always use the kernel and initrd directives for starting Linux. The kernel$ and module$ directives, which do variable substitution, are incompatible with Linux.

All path names in this configuration file must be absolute. Using kernel /vmlinuz or initrd /initrd.img is incompatible because GRUB 0.97 cannot dereference symlinks in a ZFS filesystem.

Tab completion at a GRUB 0.97 recovery prompt is currently broken or unimplemented for ZFS.

Maintenance

The menu.lst file must be manually updated each time a Linux kernel package is installed, or any time the Linux root filesystem is cloned.

The beadm and bootadm utilities in Solaris do not recognize Linux installations, and the update-grub helper in Linux does not recognize Solaris installations.

Integration Notes

Linux systems conventionally use different UID and GID ranges than Solaris systems, which will cause file ownership in the Linux environment to mismatch the Solaris environment. This is an annoyance, but also a security hole.

It is safe to change the numeric IDs in /etc/passwd and /etc/group on the Linux system to match the Solaris system. Remember to update the shadow files too.