Dual boot OpenSolaris and Linux

So I started working on OSol a little more than a month ago and realized that dual boot might be more desirable than virtualization for initial stages of my project. There is nothing that can replace a native install. So here’s an easy way that I followed for setting it up…

First install OSol on a partition of size say 20 GB. Solaris does not allow installing on anything other than the first partition, so it has to be done first. The remaining space on the disk could either be formatted with freeDOS or left unpartitioned, depending upon how much space you need for Linux.

Next, install any linux distro on the second primary partition. The thing to note here is that, since we are installing on a primary partition, the grub of Linux will not replace the one for OSol, and hence both can exist simultaneously. The bootloader will simply point to one of them (at this time it will point to the Linux one). So here’s what the partition table looks like:

Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               2        1960    15735667+  bf  Solaris
/dev/sda2            1961        2222     2104515   82  Linux swap / Solaris
/dev/sda3   *        2223        4833    20972857+  83  Linux
/dev/sda4            4834       14593    78397200    c  W95 FAT32 (LBA)

Command (m for help):

So when you reboot, the Linux grub will take control. But how do we boot into the OSol installation? Simple, just make the Solaris partition as bootable instead of the linux one, i.e. in this case, make /dev/sda1 active, instead of the /dev/sda3. Then reboot into Solaris and add a simple command to the /boot/grub/menu.lst, which will help you select linux from the OSol grub. (Remember by this method, after you select Linux from the OSol grub, the Linux grub will be shown, so it is possible for you to install multiple Linux or a Windows XP, in the other primary partitions – A maximum of 4 are permitted on a single hard disk).

Here’s what the menu.lst in the OpenSolaris should look like:

#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Solaris Nevada snv_56 X86
kernel /platform/i86pc/multiboot
module /platform/i86pc/boot_archive
#---------------------END BOOTADM--------------------
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
title Solaris failsafe
kernel /boot/multiboot kernel/unix -s
module /boot/x86.miniroot-safe
#---------------------END BOOTADM--------------------
#-----------ADDED BY RAHUL MURMURIA------------------
title Linux
rootnoverify (hd0,2)
chainloader +1

Thats all. So now we have a Dual boot ready.

Next up, setting up a good environment for working on a project like mine where gcc is a must. Also, it is long due that I report my progress on my porting project for GSoC. All this coming up shortly…


4 responses to “Dual boot OpenSolaris and Linux

  1. i have a problem with multiboot installation using OSol, Windows XP, and Linux. both my OSol and XP were installed in primary partition, but the linux was installed in logical partition. do you have any suggestion for me?

  2. Shouldn’t be so hard. Just add another menu option in the above grub configuration with the correct reference to the root of Windows and Linux, hd(0,x).

  3. Hello! Your site is very interesting and informative. Please some advice: I have a laptop w/2 hard disks. I wish to install a linux distro I’m familiar with (either gentoo or opensuse) on the 1st (largest disk – 320gb), and install opensolaris for study unix on the 2nd disk (110gb). What method do you recommend?? Thanks for your time and assistance.
    Have A Healthy, Prosperous Day!!

  4. Marnix A. van Ammers

    Didn’t work for me. I had OpenSolaris installed on sda1 and a diagnostic partition as sda2 and then installed ubuntu on sda4 with a swap partition on sda3. “fdisk -l” still shows the boot flag active on sda1, but the system reboots to ubuntu. So I think the ubuntu install overwrote the MBR and told it to go straight to the ubuntu on sda3. I wonder if I can’t just update the grub in ubuntu to add a section for OpenSolaris. I’ll probably try that. Only thing is that the grub is grub-pc, a newer grub that uses a grub.cnf file, something I’m not familiar with. Oh well, I’ll get there eventually …

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s