<!doctype linuxdoc system>
<linuxdoc>
<article>
<titlepag>
      <title>Linux+Solaris HOWTO</title>
            <author>
	    <name><url url="mailto:max.berger@xslt.de" name="Max Berger">
	</name>
      </author>
      <date>v0.8-$Revision$, $Date$</date>      
      <abstract> Describes how
	to use Linux (x86) and Solaris (x86) together on one machine
      </abstract>
    </titlepag>
    <toc>
    <sect>
      <heading>Introduction</heading>
      <sect1>
	<heading>Why Solaris?</heading> <p>This is actually a good
	  question. Why use Solaris, when you can have Linux?  Solaris is a
	  commercial system, the hardware support is scarce. But if you are
	  reading this you have probably already decided on using Solaris. If
	  not, here are some reasons:
	  <itemize>
	    <item> I have a part-time job administrating Solaris
	      machines. It is of no use that I learning all the neat
	      command parameters and nifty Linux tricks at home, when
	      I can't use them on my Solaris-Box.
	    </item>
	    <item> Sun was giving away Solaris for what they call
	      ``Shipping and handling cost only'' for some time. They
	      might do that again. And almost-free-of-charge is always
	      a good deal.
	    </item>
	    <item> Another reason might be that you like CDE.</item>
	  </itemize>
	</p>
      </sect1>
      <sect1>
	<heading>Things covered in this HOWTO</heading> 
	<p>This HOWTO tries to help you install Solaris 7 or 8 on an x86
	  computer already running Linux. The main targets are
	  <itemize>
	    <item>
	      not to destroy any data, see section
	      <ref id="harddrive" name="Preparing your Harddrive">
	    </item>
	    <item> To make Linux and Solaris coexist (boot manager),
	      see section
	      <ref id="boot" name="Boot-Managing">
	    </item>
	    <item> To share data between Linux and Solaris, as described in
	      section <ref id="sharing" name="Sharing Data">
	    </item>
	  </itemize>
	</p>
      </sect1>
      <sect1>
	<heading>Referenced versions</heading>
	<p>The reference versions used while creating this
	  document where:
	  <itemize>
	    <item>Solaris 7 x86 (= Solaris 2.7 / SunOS 5.7)
	    </item>
	    <item>Solaris 8 x86 (= Solaris 2.8 / SunOS 5.8)
	    </item>
	    <item>Linux 2.2.14, 2.3.99-pre3
	    </item>
	    <item>fdisk v2.10f
	    </item>
	  </itemize>
      The information might apply to other versions of the software, or it
      might all be different.
      </p>
      </sect1>
      <sect1>
	<heading>Warning</heading> 
	<p><em>Please back up any data
	    before messing with your system!  A lot of the things
	    described in this document may result in excessive data
	    loss!  I am not responsible for any data loss! See also
	    section <ref id="legal" name="Legal stuff"></em>
	</p>
      </sect1>
    </sect>
    <sect>
      <heading>Preparing your Hard Drive<label id="harddrive"></heading>
      <p>To Prepare your hard-drive for Solaris, you need
	to know about standard PC partition tables and
	about Solaris disk slices. In this HOWTO I talk
	about single-disk systems only, but all the
	information should also apply to a multi-disk
	environment. </p>
      <sect1>
	<heading>Traditional PC partitions</heading>
	<p>The standard partition-table has only 4 entries. The
	  entries important for us are the following:
	  <descrip>
	    <tag>
	      A Primary Partition
	    </tag> 
	    <p>
	      Takes up one entry, and contains exactly one
	      partition. A waste of resources, but the only partition
	      you can boot from!
	    </p>
	    <tag>An extended Partition</tag>
	    <p>Takes up one entry, but can
	      contain multiple DOS, Linux, and other partitions</p>
	    <tag>A Solaris Partition</tag>
	    <p>Takes up one entry,
	      but can contain multiple Solaris Partitions</p>
	  </descrip>
	  To find out what partitions are present on your system, use
	  the <tt>fdisk</tt> program. Partitions numbers 1 to 4
	  (<tt>hda1</tt>..<tt>4</tt>, <tt>sda1</tt>..<tt>4</tt>, ...) are the ones 
      in your partition table.</p>
      </sect1>
      <sect1>
	<heading>Solaris partition labels</heading>
	<p>Solaris has its own partitioning scheme. It
	  uses one entry in the partition table, and
	  this entry is and acts as this partition would
	  be the entire disk. 
	</p>
	<p>This virtual disk is then divided in up to 8 slices. The
	  third slice, s2, covers the whole virtual disk, so you
	  actually have up to 7 slices for Solaris.
	</p>
	<p>Unfortunately, the Solaris partition entry has the same
	  type as a Linux Swap partition (82). Therefore, you should
	  not have any Linux swap partitions as primary
	  partitions. Linux doesn't care about this, but who knows
	  what Solaris does?
	</p>
	<p>Although the Linux fdisk program has some ``Sun
	  disklabel'' support, this doesn't seem to help any.
	</p>
      </sect1>
      <sect1>
	<heading>Hard disk space</heading>
	<p> Of course, Solaris needs disk space. The minimum
	  installation of Solaris 8 is about 300 MB. For the normal
	  tools its about 700 MB, and for a ``developer-system'' about
	  1 GB.
	</p>
	<p>
	  But this is only the space required for the base
	  installation. You might want to add a lot of GNU-Tools, and
	  other stuff. And if you want to share data between Solaris
	  and Linux, this has to happen on the Solaris partitions.
	</p>
	<p>
	  You might even think of sharing your home directories
	  between Solaris and Linux. As the time of this writing:
	  Forget it! I messed up my home directory doing so and I was
	  <em>very</em> happy about my backup. See also section
	  <ref id="sharing" name="sharing data">
	</p>
      </sect1>
      <sect1>
	<heading>Quick check list</heading>
	<p>
	  Here's the quick check list. Make sure you:
	  <itemize>
	    <item>
	      have used no more than 3 entries in your partition table
	    </item>
	    <item>
	      have no Linux swap partitions as primary partitions
	    </item>
	    <item>
	      Have at least 1 Linux ext2 partition as primary
	    </item>
	    <item>
	      Have at least 1 GB unpartitioned space
	    </item>
	  </itemize></p>
      </sect1>
    </sect>
    <sect>
      <heading>Preparing Linux</heading>
      <sect1>
	<heading>Building a new kernel<label id="kernel"></heading>
	<p>Some people donīt like building a custom kernel. For those of you:
	  you <em>must</em> build your own kernel if you want to share data 
	  between Solaris and Linux on one hard disk. If, however, you do not 
      want to share data, you are safe with your old kernel.
	</p>
	<p>
	  Here are your kernel options for ``Solaris compatibility'':
	  <itemize>
	    <item>Under <tt>code maturity</tt>:
	      <descrip><tag><tt>Prompt for development drivers</tt></tag>
		<p>Unfortunately UFS writing is still experimental.</p> 
	      </descrip>
	    </item>
	    <item>In <tt>file systems</tt>:
	      <descrip>
		<tag><tt>UFS file system support</tt></tag> <p>UFS is
		  the Solaris file system</p> <tag><tt>UFS file system
		    write support</tt></tag> <p>The only way to pass data
		  to Solaris</p> <tag><tt>partition types / Solaris
		    (x86) partition table support</tt></tag> <p>Is needed
		  for the slices within your Solaris partition to be
		  found.</p>
	      </descrip>
	    </item>
	  </itemize>
	  Additional info about kernel building can be found in the
	  Kernel-HOWTO
	</p>
      </sect1>
      <sect1>
	<heading>Preparing your boot loader</heading> <p><em>Before
	    messing with your boot loader, please make sure that you have
	    an emergency disk ready which enables you to boot your old
	    system.</em></p> <p>Unfortunately the Solaris install
	  overwrites the master boot record (MBR) and overwrites your
	  old boot manager.</p> <p>Fortunately, the Solaris boot manager
	  is able to chain-boot. For this to work you have to put your
	  old boot loader (e.g. lilo) into the boot sector of one primary
	  Linux partition.
	</p>
	<p>For lilo this means: look at your
	  <file>/etc/lilo.conf</file>. Look for the <tt>boot=</tt>
	  line. If it is something like <tt>boot=/dev/hda1</tt>
	  everything is fine. But if itīs something like
	  <tt>boot=/dev/hda</tt> it points to the MBR. Please change
	  it to point to a primary Linux partition
	  (e.g. <tt>boot=/dev/hda1</tt>)</p> <p>A way to check if your
	  boot-loader is chain-loadable is installing lilo in to the
	  MBR and trying to chain load your other boot-manager. I used
	  the following file called <file>lilo.conf.mbr</file> for
	  this: 
	  <code>#lilo.conf.mbr 
#Lilo in Master Boot Record doing nothing but chain-loading another lilo 
boot=/dev/hda
root=/dev/hda5 
install=/boot/boot.b 
map=/boot/map 
vga=ask
delay=50 
other=/dev/hda1 
label=lilochain</code> 
	  You can then
	  run <tt>lilo -C lilo.conf.mbr</tt> to install lilo into your
	  MBR. And donīt forget to run <tt>lilo</tt> to have lilo in
	  the boot sector of your hard-drive.</p> 
	<p>If you reboot
	  now, you should have a lilo-prompt. When you select <tt>other</tt> this 
      chain loads the old lilo, which in turn loads Linux.
	</p> 
      </sect1>
    </sect>
    <sect>
      <heading>Installing Solaris</heading>
      <sect1>
	<heading>Solaris interactive</heading>
	<p><descrip>
	    <tag>Solaris 7</tag>
	    <p>Solaris Interactive is on the first CD. Boot it, select
	      Solaris interactive</p>
	    <tag>Solaris 8</tag>
	    <p>On the Solaris 8 CDs the interactive installer is on
	      the first software CD. You don't need the install CD at
	      all.
	    </p>
	  </descrip>
	  The Solaris installation itself is quite straight
	  forward. One thing that might be confusing is the
	  partitioning. Solaris will automatically use all the free
	  space on your hard disk, and create it's own virtual disk in
	  it. And when it comes to slicing up your virtual disk, donīt
	  forget to add space for Solaris/Linux exchange. A good place
	  for this is an extra <file>/export/share</file> partition.
	</p>
	<p>Please Note: If you abort during the Solaris installation,
	  the MBR of your hard disk may already be overwritten and you
	  may not be able to boot from the hard disk at all.</p>
      </sect1>
      <sect1>
	<heading>Web-Start</heading>
	<p>I couldn't get Web-Start to work at all. Please mail me if
	  you have any experience using it.</p>
	<p>However, once Solaris was installed, I had no problems
	  adding web-start-packages</p>
      </sect1>
      <sect1>
	<heading>Getting GNU-tools</heading>
	<p>Solaris standard installation doesn't even have a
	  <tt>less</tt> command. Some people recommend getting the
	  Redhat Package Manager (RPM) for Solaris, but the standard
	  packaging tool will usually do it. You can find many nice
	  packages at <htmlurl url="http://www.sunfreeware.com"
			       name="http://www.sunfreeware.com">
	  The standard packages can be used with
	  <tt>pkgadd&nbsp;&lt;package&gt;</tt>, and the web-start
	    packages with
	    <tt>java&nbsp;&lt;packagewithoutclassextension&gt;</tt>
	</p>
      </sect1>
    </sect>
    <sect>
      <heading>Boot managing<label id="boot"></heading>
      <sect1>
	<heading>Using the Solaris boot manager</heading>
	<p>When booting, the Solaris boot manager gives you all 4
	  primary partitions for choosing which to boot from. If you had
	  your boot loader installed on the boot sector of a primary
	  partition, everything should be fine. Just boot from this
	  partition, and Linux should come up.</p>
      </sect1>
      <sect1>
	<heading>Using lilo</heading>
	<p>Now you have lilo as a secondary boot loader, but you want
	  it to be your primary boot loader again? No Problem. Lilo
	  can easily chain boot Solaris. Just add the appropriate
	  <tt>other=</tt> lines to your lilo.conf</p>
	<p>For testing, you should add the Solaris chain loading to
	  the lilo in your boot sector first. Then try chain loading
	  lilo, Solaris, lilo, Solaris, ... until you have enough of
	  it. If this works, you should be able to put lilo back into
	  the MBR again.</p>
	<p>However, Solaris might have messed up your partition
	  table. This has happened on my system after installation of
	  Solaris&nbsp;8. Lilo doesn't like the new partition, nor does
	  fdisk. I had no problems with Solaris&nbsp;7</p>
      </sect1>
      <sect1>
	<heading>Using grub</heading>
	<p>Unfortunately, I have no experience with grub booting
	Solaris. If you do, please mail me!</p>
      </sect1>
    </sect>
    <sect>
      <heading>Sharing data<label id="sharing"></heading>
      <sect1>
	<heading>Using a shared partition</heading>

	<p>If you have build your kernel with Sun disk label support
	  and UFS support as mentioned in section <ref id="kernel"
	  name="building your new kernel">, you are now able to
	  mount your Solaris partitions. During boot up, you should get
	  something similar to: 
	  <verb>  hda: [PTBL] [523/255/63] hda1 hda2 &lt; hda5 hda6 hda7 hda8 &gt; hda3 &lt;Polaris: [s0]
  hda9 [s1] hda10 [s2] hda11 [s3] hda12 [s6] hda13 [s7] hda14 &gt;</verb>
	  Meaning (in this case): partition 3 (<tt>hda3</tt>) is a
	  Solaris partition with 6 slices (s0,s1,s2,s3,s6,s7). They
	  are mapped to Linux devices <tt>hda9</tt> to <tt>hda14</tt>.
	</p>
	<p>Try mounting your Solaris
	  partitions. When mounting UFS partitions, you always have to
	  add an <tt>-oufstype=</tt> argument, in this case
	  <tt>-oufstype=sunx86</tt>. So the command to mount a
	  partition is something like:
	  <verb>  mount -oufstype=sunx86 /dev/hda14 /mnt</verb>
	  Now, test your partition. <em>Please note: The write support
	  on UFS partitions is very experimental. Please don't trust
	  any data you write on your UFS partitions!</em>
	</p>
	<p>If you want your Solaris partitions automatically mounted
	  at boot time, you can add a line like
	  <verb>  /dev/hda14 /solaris ufs ufstype=sunx86 0 0</verb>
	  to your <file>/etc/fstab</file>
	</p>
      </sect1>
      <sect1>
	<heading>Alternative ways</heading>
	<p>And, of course there are always other ways of sharing
	  data:<descrip>
	    <tag>Floppy disk</tag>
	    <p>I don't know which floppy disk file systems are supported by
	      Solaris. Do you? Mail me.</p>
	    <tag>Network</tag>
	    <p>Solaris knows NFS. Linux knows NFS. This might actually
	      be the best way of sharing data</p>
	  </descrip>
	</p>
      </sect1>
    </sect>
    <sect>
      <heading>Running foreign binaries</heading>
      <sect1><heading>Linux binaries on Solaris</heading> 
	<p>Is supposed to work using a program called ``lxrun''. I
	  haven't got around to testing it yet. See the Solaris
	  web site for more information.</P>
      </sect1>
      <sect1><heading>Solaris binaries on Linux</heading>
	<p>Are as far as I know unsupported</p></sect1>
    </sect>
    <appendix>
    <sect>
      <heading>Finding additional info</heading>
      <p>Here are some URI that might help you:
	<itemize>
	  <item><url url="http://www.sunfreeware.com" name="Sun Freeware">
	    <newline> My first stop for Solaris
	    resources. Has many GNU-tools in binary format ready to
	    install.
	  </item>
	  <item><url url="http://www.sun.com" name="Sun Microsystems">
	    <newline> 
	    Suns official web page
	  </item>
	  <item><url url="http://www.sun.com/Solaris"  
			    name="Solaris Homepage">
	  </item>
	  <item> <url url="http://soldc.sun.com/support/drivers/hcl/index.html" 
			    name="Solaris Hardware Compatibility List (HCL)">
	  </item>
      <item>
        <url url="http://docs.sun.com" name="Solaris Online Documentation">
      </item>
	  <item>
	    <url url="http://www.xslt.de" name="My Website"><newline>
	    You will always find the newest version of this document
	    somewhere on this page
	  </item>
	</itemize></p>
    </sect>
    <sect>
      <heading>Credits and legal stuff</heading>
      <sect1>
	<heading>Credits</heading>
	<p>Thanks to Marcel Meyer for beta testing this HOWTO while
	  installing Solaris on his machine</p>
      </sect1>
      <sect1>
	<heading>Questions, comments, suggestions</heading> <p>Are
	  always welcome. You can reach me via e-mail at
	  <htmlurl url="mailto:max.berger@xslt.de"
		   name="max.berger@xslt.de"></p>
      </sect1>
      <sect1>
	<heading>License<label id="legal"></heading>
	<p>This document is copyrighted &copy; by Max Berger. You may
	  use and/or modify it according to the Linux Documentation
	  Project License (LDPL) found at <htmlurl
	url="http://www.linuxdoc.org/COPYRIGHT.html"
	name="http://www.linuxdoc.org/COPYRIGHT.html">. 
	<p>
	  According to the license you don't have to tell me, but I'd
	  very much like to know when you modify and/or republish this
	  document.
	</p>
	<p>Although the information given in this document is believed
	  to be correct, the author will accept no liability for the
	  content of this document. Use the tips and examples given
	  herein at your own risk.</p>
      </sect1>
    </sect>
    <!--    <biblio> -->
  </article>
</linuxdoc>
