« Hungarian Wine | Main | "Take this REPL, brother, and may it serve you well." »

January 18, 2009

Dual Booting OpenSolaris and Ubuntu 8.10

Recently, I bought a new laptop. There are a number of tools and technologies that I am interested in that are included with either Ubuntu Linux or OpenSolaris. I decided that I would set up my new laptop to dual boot OpenSolaris and Ubuntu Linux 8.10. Both operating systems use the GRUB bootloader so in theory it should be easy to get them to work together. In practice it was not so easy. I am writing this post just in case other people have the same issues I had.

The problem with setting up the two operating systems to dual boot is that although they both use GRUB as their bootloader, their versions of GRUB have both been modified to handle special circumstances for the OS in question. The GRUB versions are like feuding cousins: they have the same name, the same origin, and they look pretty similar, but they are different enough that the just don't get along.

It turns out that the version of GRUB for each operating system doesn't understand the default filesystem that the other installs on. Linux doesn't support ZFS, so, plainly, its GRUB wouldn't either. The problem with OpenSolaris' GRUB was a little more obscure as, in theory it should have supported ext3. I found a blog posting, by Peter Buckingham, entitled GRUB, GRUB, why do you haunt me so?, which explained the problem. In Peter's words:

At this point I did some digging Google is your friend. So it turns out that the problem is a little while back the size of the inode for ext3 was increased to 256 bytes to make it more forward compatible with ext4. My old Ubuntu and OpenSolaris setup never hit this because the filesystems were set up with the older sized inodes.

Peter fixed his problem by patching the OpenSolaris GRUB, so eventually Peter's fix will be committed into OpenSolaris and the issue will go away. However that was a little too involved for me. My solution to the impasse was to create an ext2 boot partition for Ubuntu and have the OpenSolaris version of GRUB chainload that. The steps I used to do that are as follows:

  1. Partition the disk into 4 partions. For me the partition fdisk -lu gives back the following:

    
    Device Boot      Start         End      Blocks   Id  System
    /dev/sda1              63      208844      104391   83  Linux
    /dev/sda2          208845   461001239   230396197+  83  Linux
    /dev/sda3   *   461001240   923512589   231255675   bf  Solaris
    /dev/sda4       923512590   976768064    26627737+  82  Linux swap
                
    

    The first is for an ext2 partion to hold Linux's /boot. The second partition is for the rest of Ubuntu Linux, on ext3, the third for OpenSolaris, and the last one is for Linux swap.

  2. Install Ubuntu Linux 8.10, with the first partition mounted as /boot and the second partition mounted as /.

  3. Install GRUB into the start of the /boot partition. This can be done from the GRUB command line. For my setup, I typed the following at the GRUB command line:

    root (hd0,0)
    setup (hdo,0)
    

    Alternatively, you can get the Ubuntu installer to do this for you in the Advanced Setup dialog box, accessed from the partitions page in the setup wizard.

  4. Install OpenSolaris.

  5. Add an entry to the OpenSolaris menu.lst file, located in /rpool/boot/grub, to chainload the Ubuntu GRUB. For me the entry looked like this:

    title Ubuntu Linux 8.10
    root (hd0,0)
    chainloader (hd0,0)+1
    

That should leave you with a system that dual boots OpenSolaris and Ubuntu Linux 8.10.

The following links were useful to me when I was trying to figure out GRUB:

Technorati Tags:

Posted by JohnC at January 18, 2009 09:38 PM