Linux and Solaris Dual Boot on the Same Hard Drive

CONTENTS
  1. Introduction
    1. This document
    2. Who I am
    3. What I'm running
    4. History
    5. Boot Loaders
  2. The Process
    1. Prep for LILO
    2. Install Solaris
    3. Installing Linux
    4. Finalizing your settings
    5. How it works
  3. The Last Bits
    1. Thanks


THE ACTUAL DOCUMENT
  1. Introduction
    1. This document
      This document is something I wrote based on the lack of documentation on this subject. You may post it in newsgroups, mailing lists, etc., as long as you put it IN ITS ENTIRETY! If I ever update it, a master copy lies on http://www.phildev.net/solaris/dualboot.html
    2. Who I am
      My name is Phil Dibowitz (phil@ipom.com). I'm a student at the University of Southern California. I've been using Linux/Unix for about 4 years now, and other parts of my knowledge base include Perl/CGI, HTML, C++, and SQL. I have a CNA, and I used to work as the Assistant Admin at my high school, which runs a fiber-optic LAN with Novell NetWare 5 servers and Win 9x workstations. I am currently a consultant for the Information Services Division at USC
    3. What I'm running
      I'm running RedHat 6.0 and Solaris 2.6. This should work with any Linux distro since LILO shouldn't be modified between distros, and it should work with any version of Solaris 2.6 up, and quite possibly many versions prior to that.
    4. History
      My first experience with the Unix/Linux realm was fooling around on a friend's machine via telnet. I was already reading a book on Linux, so I had some knowledge but nothing to practice on. I went out and bought a 2nd HD to install Linux on, but my friend said that Solaris was being given away for free and I should grab that. So I did... and Solaris was MY first jump in.
      So there I was with this machine learning REALLY slowly (anything I did know was from a Linux book and only half that stuff worked in Solaris). In the first 2 months I had to reinstall Solaris like 2342340283409234 times. But I learned. Shortly after I figured out how to get online, and had the basics came quickly (after the first 2 months). I spent about a year on that and my parents bought a new machine and gave me the old one. I immediately scrapped Windows, and ordered RedHat Linux for 2 bucks from cheapbytes.com. Installed it after the Solaris partition... only to find out that wouldn't work. So I set it up with /boot, then Solaris, then the rest of Linux, as advised by people in the Linux room (hella cool people ;). But spent the next year and a half trying to find out how to get LILO to boot Solaris. I found several tutorials, but they all told how to do it if Solaris was on the 2nd HD (which I didn't want to do because a. the original hard drive on that machine I removed cause it was failing, which leaves only 1 hard drive, and b. because I wanted to figure out how to do this on 1 hard drive!! I guess it's the hacker-mentality/curiosity in me). At length I decided the information was not available in the "fine manual", as they say... nor anywhere on the Internet. Nor was it in the mind of anyone in any Linux room on earth. After close to about a year and a half of searching I did solve the puzzle, but not alone...
    5. Boot Loaders
      There are two possible boot loaders in this setup... LILO and Solaris' boot loader. I'd been trying to use LILO. So let me give you the finale of my story. I saw the subject come up on the Solaris newsgroup and emailed a guy who had a similar setup to me. He said he no longer had that setup, and found out that LILO cannot boot Solaris (just as I had). He never completed his dual boot but said he was pretty sure that I could set up Solaris' boot loader to boot Linux. All it took was changing some "active" flags in the partition table. Haha... 2 years of looking and it took all of 5 minutes... ::::sigh:::: I've outlined the whole procedure for getting the setup as I have it... if you already have both OS's installed you should be able to skim everything but the last 2 steps... if you're setup is similar... Sometimes you just may have to redo your setup to do what you wanna do.
  2. The Process
    1. Prepare for LILO
      Setup a small partition (which will eventually become Linux's /boot partition), but don't put anything in it. 15MB should do it. I like to use Linux's fdisk utility on the setup disk (run the install, it will allow you to run fdisk long before it starts any installing) to set that partition to some arbitrary type, 8, or b7, or whatever - anything that's not Solaris or Linux). Make sure it's not set as active - install will ask you to reset...
    2. Install Solaris
      Pop the Solaris install CD and DCA floppy in the computer and restart. That will write the new partition table and start the Solaris install. Install Solaris directly after that small partition you just made.
    3. Install Linux
      Run Linux install - change the Solaris partition type to something weird 8 or b7 is fine again (because Solaris is the same as Linux swap, don't wanna screw up your 2 hour Sol install!!!). Change the first partition to Linux (83), and setup whatever partitions you want for Linux after the Solaris partition. Set the first partition to be active, make sure nothing else is active. Exit fdisk, install will restart, then set the mount point for your first little partition to be /boot - the rest are up to you. When install gets to LILO, it will ask you where to install LILO - select /dev/hda1 (/boot).
    4. Finalize Your Settings
      When Linux boots, login as root, run fdisk, change Solaris back to its original type (same as Linux swap: 82), then make Solaris the active partition and make /boot INactive (i.e. Solaris should be the ONLY active partition). Reboot.
    5. How It Works
      The Solaris boot loader should take over. Selecting the first partition should drop you into LILO, which will get you into Linux, and the 2nd will get you into Solaris.
  3. The Last Bits
    1. Thanks
      Special thanks to Jim Grover for helping me to find this solution.


This page is © Phil Dibowitz 2001 - 2004