Dual-booting Nevada and OpenSolaris

Recently I had an idea to try and install Nevada and OpenSolaris on the same disk. I'm using both systems for testing intensively and the installation times are considerable. I had a Nevada 98 installation on my testing machine so I thought I'd put OpenSolaris on the second partition. I booted the LiveCD, ran the installer and selected second partition as Solaris, modifying the first to "Unused" with blind hope the installer wouldn't touch it. Oops... after the reboot I found out that the Nevada installation is gone, replaced :(

So I started looking around for hints. Following guide might help you to set up a dual-boot environment for Nevada and OpenSolaris. The starting point is an OpenSolaris (2008/05, build 86) installation in the first partition, image-updated to build 98 according to this update guide on opensolaris.org (or this blog).

1.  Working around partition type

Solaris installer, both in Nevada and OpenSolaris is not tolerant to multiple Solaris partitions on one disk. Solution is to temporary change the partition type of the existing OpenSolaris installation. You can use your favourite live-cd with any flavour of fdisk for this, but grub can be really helpful too. Here's how to make your OpenSolaris partition UNbootable (!) :)

  1. start the machine
  2. press Esc to cancel the timeout in grub
  3. press 'e' on any entry
  4. press 'd' multiple times to remove all lines
  5. press 'o' to create an empty line
  6. press 'e' and enter:
    parttype (hd0,0) 0x83
  7. press 'b' to boot this setting

Grub will rewrite the type of the first partition to 0x83 (Linux). As a results we'll be able to install Nevada to second partition without rewriting the first.

2. Nevada installation

Now that your OpenSolaris is not bootable, use a Nevada dvd to boot its installer (mine was build 98) and proceed as usual. You'll probably want to select "Custom installation" somewhere in the process. Almost the last step of the installation is disk layout selection, where the installer with popup an alert that it found Linux in the first partition and that's not supported. Do NOT accept its offer to use the standard layout. That will leave the first partition unharmed. Select second partition, customize the layout and finish the installation.

3. Tweaking Nevada grub

Now we have Nevada grub in MBR and OpenSolaris still unbootable. Boot to Nevada and add following entry to /boot/grub/menu.lst:

title Switch to OpenSolaris grub (hd0,0)
        parttype (hd0,0) 0xbf
        parttype (hd0,1) 0x83
        root (hd0,0)
        makeactive
        chainloader +1

This will change the partition types so that the first partition with OpenSolaris is of type Solaris (0xbf) and our current Nevada installation in second partition is of type Linux (0x83). If you reboot and select this entry in grub, OpenSolaris grub should come up.

However, the entries may still not be bootable. At least, they weren't for me. I suspected a change in grub between OpenSolaris and Nevada, and decided to replace the Nevada grub with OpenSolaris grub. For this reason, it may be much easier to have Nevada installed first and then install OpenSolaris to second partition. But, too late for me...

4. Fixing OpenSolaris grub

To put the OpenSolaris grub back in place, you'll need to boot OpenSolaris LiveCD. We will also create a new entry to be able switch to Nevada grub. When the LiveCD boots, try the following:

  # pfexec zpo⁞ol import -f rpool
  # pfexec mount -F zfs <dataset_of_your_root> /a
  # pfexec /sbin/installgrub /a/boot/grub/stage1 /a/boot/grub/stage2 \\
    </dev/rdsk/cXtXdXsX>

where </dev/rdsk/cXtXdXsX> is the raw-device of the slice used for rpool ("zpool status" will show you that).
In my environment, dataset was "rpool/ROOT/opensolaris" and device "/dev/c4d0s0". The above didn't work straight for opensolaris-1 boot environment, probably due to the grub changes mentioned in the image-update guide.

Then I modified /rpool/grub/menu.lst, adding as first entry:

title Switch to Nevada grub
        parttype (hd0,0) 0x83
        parttype (hd0,1) 0xbf
        root (hd0,1)
        makeactive
        chainloader +1

This entry  will allow to switch to the Nevada grub menu to boot Nevada. After the reboot, OpenSolaris grub was in place in MBR and I was able to switch & boot to Nevada, and to OpenSolaris build 86 (the original "opensolaris" boot environment). OpenSolaris 98 (my "opensolaris-1" BE) was not bootable. If this is the case for you, there's one more thing to fix - the grub change between 86 and 98. Boot to OpenSolaris build 86 and try:

  # pfexec mount -F zfs <dataset_of_your_root> /a
  # pfexec /mnt/boot/solaris/bin/update_grub -R /a

where the dataset was "rpool/ROOT/opensolaris-1" in my environment.

And, that's it. Working dual-boot :)

It's not exactly a simple way to set this up, so I hope the installer in OpenSolaris will improve in the future and will respect existing partitions.

Credits: Thanks to Bob Netherton for this blog entry

Note: The steps described in this guide may render your system unbootable. I don't take any responsibility for any damage to your system :)

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Solaris l10n & i18n, locales, keyboards, fonts and related topics.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today