James Legg
So you want to dual boot Linux with OpenSolaris 2008.11?
I reinstalled my X40 ThinkPad the other day, just to satisfy myself that nothing had changed since last time I did an install from scratch. I normally just do a pkg image-update to get the latest builds. Turns out nothing much has changed since I last did it.
I have Ubuntu 8.10 on this laptop for the occasional Linux application, and just because I like to play with things. What I did forget to to do before I installed it was to copy my Ubuntu grub menu.lst to a USB stick or the network. So once I installed OpenSolaris it stomped all over my Ubuntu grub menu. No problems though, the Linux partitions are still there, I just need to tell grub where they are.
So to mount my Linux partition I use the FSWpart and FSWfsmisc packages from the Belinix OpenSolaris Distribution.
james@ickle:~/Download$ wget http://www.genunix.org/distributions/belenix_site/binfiles/FSWpart.tar.gz
james@ickle:~/Download$ gzcat FSWpart.tar.gz | tar xf -
james@ickle:~/Download$ pfexec pkgadd -d . FSWpart
Processing package instance <FSWpart> from </export/home/james/Download>
x86 Partition Table Dumper(i386) 0.1
#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Author Moinak Ghosh
#
Using </> as the package base directory.
## Processing package information.
## Processing system information.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.
Installing x86 Partition Table Dumper as <FSWpart>
## Installing part 1 of 1.
/usr/bin/prtpart
/usr/bin/prtpart.bin
/usr/share/src/prtpart.c
[ verifying class <none> ]
Installation of <FSWpart> was successful.
james@ickle:~/Download$ wget http://www.belenix.org/binfiles/FSWfsmisc.tar.gz
james@ickle:~/Download$ gzcat FSWfsmisc.tar.gz | tar xvf
james@ickle:~/Download$ pfexec pkgadd -d . FSWfsmisc
So thats the packages added, now we need to figure out which disk we want to mount.
Fdisk information for device /dev/rdsk/c4d0p0
Block Size : 512 bytes
Controller : ide
Disk : cmdk
Capacity : 37 GB
# start block # nblocks startCylSecHd endCylSecHd OSType
1: 0056500605 0002104515 ff/ff/fe ff/ff/fe Linux swap
2: 0058605120 0019535040 ff/ff/fe ff/ff/fe Linux native
3: 0000016065 0056259630 1/ 1/ 0 ff/ff/fe Solaris x86
This just shows us the disks in the system (highlighted in red above), my laptop like most only has the one. If we re-run the command specify that disk and the -ldevs switch it will print us out the names of each fdisk partion device.
james@ickle:~$ pfexec prtpart /dev/rdsk/c4d0p0 -ldevs
Fdisk information for device /dev/rdsk/c4d0p0
** NOTE **
/dev/dsk/c4d0p0 - Physical device referring to entire physical disk
/dev/dsk/c4d0p1 - p4 - Physical devices referring to the 4 primary partitions
/dev/dsk/c4d0p5 ... - Virtual devices referring to logical partitions
Virtual device names can be used to access EXT2 and NTFS on logical partitions
/dev/dsk/c4d0p1 Linux swap
/dev/dsk/c4d0p2 Linux native
/dev/dsk/c4d0p3 Solaris x86
As we can see our above our Linux Native partion is /dev/dsk/c4d0p2 - mine is formatted with ext3 but you seem to be able to get away with mounting as ext2 read only and avoiding the journalling features of ext3. (obviously you have everything important backed up right?)
so lets mount it:
james@ickle:~$ pfexec mount -F ext2fs /dev/dsk/c4d0p2 /mnt
Copy the menu.lst file that controls the grub menu from the Ubuntu partition and then unmount it.
james@ickle:~$ cp /mnt/boot/grub/menu.lst ubuntu-menu.lst
james@ickle:~$ pfexec umount /mnt
OK great so know we have to pull the important bits out of the ubuntu menu.lst file, fire up your favorite editor and move down to the section that looks like:
james@ickle:~$ vim ubuntu-menu.lst
## ## End Default Options ##
title Ubuntu 8.10, kernel 2.6.27-11-generic
root (hd0,1)
kernel /boot/vmlinuz-2.6.27-11-generic root=UUID=909c5a3d-f514-45f1-9aaa-60f6d77d4d14 ro quiet splash
initrd /boot/initrd.img-2.6.27-11-generic
quiet
title Ubuntu 8.10, kernel 2.6.27-11-generic (recovery mode)
root (hd0,1)
kernel /boot/vmlinuz-2.6.27-11-generic root=UUID=909c5a3d-f514-45f1-9aaa-60f6d77d4d14 ro single
initrd /boot/initrd.img-2.6.27-11-generic
title Ubuntu 8.10, memtest86+
root (hd0,1)
kernel /boot/memtest86+.bin
quiet
### END DEBIAN AUTOMAGIC KERNELS LIST
Copy the text and fire up another editor:
james@ickle:~$ pfexec vim /rpool/boot/grub/menu.lst
Add the paste buffer after the last line in the file
Remember the the Linux menu.lst is updated automatically on the Linux partition by Ubuntu when you install new kernels so you will need to repeat this process when you update Ubuntu.
The alternative to this is to chain load your Linux Grub from your Solaris Grub and avoid the tedious job of manually updating the menu.lst that lives on the ZFS partition with your Linux kernel entries. If I find some time I'll write about that as well.
I'm pretty sure that grub/OpenSolaris find windows partitions and boot them by default. I don't use Windows out of VirtualBox much these days so I am not sure about that one.
Posted at 11:00PM Mar 18, 2009 by James Legg in Personal | Comments[3]
Installing Ubuntu's GRUB into Ubuntu's / partition rather than to the MBR is definitely the way to go (the option is under 'advanced' at the last stage of the installer, IIRC). Then you can just use the OpenSolaris GRUB to chainload the Ubuntu GRUB, and they can both happily update themselves without issue. Added bonus: The OpenSolaris GRUB is prettier :-p
Oh, and GRUB does indeed find Windows partitions and sets up chainloader entries for them by default. It's sometimes a bit overenthusiastic if you have multiple NTFS partitions, though...
Posted by Lamsey on March 19, 2009 at 12:02 PM GMT #
That works nicely if you put Ubuntu onto the system after OpenSolaris, but the other way round then you don't have any option apart from letting OpenSolaris put it's grub into the MBR. This solution gets you out of that situation. There is a bug logged but I think it is complicated by the lack of read support for Linux File systems.
http://defect.opensolaris.org/bz/show_bug.cgi?id=535
Posted by James Legg on March 19, 2009 at 12:23 PM GMT #
If you've already installed Ubuntu's GRUB to the MBR and then install OpenSolaris on top of it, you can use an Ubuntu Live CD to install a fresh Ubuntu GRUB into the Ubuntu partition.
http://ubuntuforums.org/showthread.php?t=224351 has instructions - make sure you read the note about installing to a partition rather than the MBR.
Posted by Lamsey on March 19, 2009 at 12:32 PM GMT #