<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<article>
  <articleinfo>
    <title>Linux+Solaris HOWTO</title>

    <author>
      <firstname>Max</firstname>

      <surname>Berger</surname>

      <email>max@berger.name</email>
    </author>

    <date>v1.1-$Revision: 25d076041cd6 $, $Date: 2010/01/27 13:49:08 $</date>

    <abstract>
      <para>Describes how to use Linux (x86) and Solaris (x86) together on one
      machine</para>
    </abstract>
  </articleinfo>

  <section>
    <title>Introduction</title>

    <section>
      <title>Reasons to use Solaris</title>

      <para>This is actually a good question. Why use Solaris, when you can
      have Linux? Solaris is a commercial system and the hardware support is
      scarce. Nevertheless, if you are reading this you have probably already
      decided on using Solaris. If not, here are some reasons: <itemizedlist>
          <listitem>
            <para>I had 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 cannot use them on my
            Solaris-Box.</para>
          </listitem>

          <listitem>
            <para>Sun was giving away Solaris for what they call "Shipping and
            handling cost only" for some time. They might do that again.
            Moreover, almost-free-of-charge is always a good deal.</para>
          </listitem>

          <listitem>
            <para>Another reason might be that you like CDE.</para>
          </listitem>
        </itemizedlist></para>
    </section>

    <section>
      <title>Things covered in this HOWTO</title>

      <para>This HOWTO tries to help you install Solaris 7, 8, 9 or 10 on an
      x86 computer already running Linux. The main points are <itemizedlist>
          <listitem>
            <para>not to destroy any data, see <xref
            linkend="harddrive" /></para>
          </listitem>

          <listitem>
            <para>to make Linux and Solaris coexist (boot manager), see <xref
            linkend="boot" /></para>
          </listitem>

          <listitem>
            <para>to share data between Linux and Solaris, as described in
            <xref linkend="sharing" /></para>
          </listitem>
        </itemizedlist></para>
    </section>

    <section>
      <title>Referenced versions</title>

      <para>The reference versions used while creating this document where:
      <itemizedlist>
          <listitem>
            <para>Solaris 7 x86 (= Solaris 2.7 / SunOS 5.7)</para>
          </listitem>

          <listitem>
            <para>Solaris 8 x86 (= Solaris 2.8 / SunOS 5.8)</para>
          </listitem>

          <listitem>
            <para>Linux 2.2.14, 2.3.99-pre3</para>
          </listitem>

          <listitem>
            <para>fdisk v2.10f</para>
          </listitem>
        </itemizedlist></para>

      <para>I have updated the information for Solaris 10 based on received
      feedback.</para>

      <para>The information may apply to other versions of the software, or it
      may be different.</para>
    </section>

    <section>
      <title>Warning</title>

      <para><emphasis>Please back up any data before messing with your system!
      Many of the procedures described in this document may result in
      excessive data loss! I am not responsible for any data loss! See also
      <xref linkend="legal" /></emphasis></para>
    </section>
  </section>

  <section id="harddrive">
    <title>Preparing your hard drive</title>

    <para>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.</para>

    <section>
      <title>Traditional PC partitions</title>

      <para>The standard partition-table has only four entries. The entries
      important for us are the following: <variablelist>
          <varlistentry>
            <term>A Primary Partition</term>

            <listitem>
              <para>Takes up one entry, and contains exactly one partition. A
              waste of resources, but you can only boot from this type of
              partition!</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term>An extended Partition</term>

            <listitem>
              <para>Takes up one entry, but can contain multiple DOS, Linux,
              and other partitions</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term>A Solaris Partition</term>

            <listitem>
              <para>Takes up one entry, but can contain multiple Solaris
              Partitions</para>
            </listitem>
          </varlistentry>
        </variablelist> To find out what partitions are present on your
      system, use the <filename>fdisk</filename> program. Partitions numbers 1
      to 4
      (<computeroutput>hda1</computeroutput>...<computeroutput>4</computeroutput>,
      <computeroutput>sda1</computeroutput>...<computeroutput>4</computeroutput>
      ...) are the ones in your partition table.</para>
    </section>

    <section>
      <title>Solaris partition labels</title>

      <para>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.</para>

      <para>This virtual disk is divided in up to 8 slices. The third slice,
      s2, covers the complete virtual disk, so you actually have up to 7
      slices for Solaris.</para>

      <para>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 does not care about this, but
      who knows what Solaris does?</para>

      <para>The partition identifier has been changed in Solaris 10 to provide
      better compatibility with Linux. It is now 0xbf. Solaris still supports
      the old identifier for compatibility reasons. When installing a new
      system you should use the new identifier.</para>

      <para>Although the Linux fdisk program has some "Sun disklabel" support,
      this does not seem to help any.</para>
    </section>

    <section>
      <title>Hard disk space</title>

      <para>Of course, Solaris needs disk space. The minimum installation of
      Solaris 8 is about 300 MB. For the normal tools, it is about 700 MB, and
      for a "developer-system" about 1 GB.</para>

      <para>However, this is only the space required for the base
      installation. You might want to add a lot of GNU-Tools, and other file.
      In addition, if you want to share data between Solaris and Linux, this
      has to happen on the Solaris partitions.</para>

      <para>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 <emphasis>very</emphasis> happy
      about my backup. See also <xref linkend="sharing" /></para>
    </section>

    <section>
      <title>Quick check list</title>

      <para>Here is the quick checklist. Make sure you: <itemizedlist>
          <listitem>
            <para>have used no more than 3 entries in your partition
            table</para>
          </listitem>

          <listitem>
            <para>have no Linux swap partitions as primary partitions</para>
          </listitem>

          <listitem>
            <para>Have at least 1 Linux ext2 partition as primary</para>
          </listitem>

          <listitem>
            <para>Have at least 1 GB unpartitioned space</para>
          </listitem>
        </itemizedlist></para>
    </section>
  </section>

  <section>
    <title>Preparing Linux</title>

    <section id="kernel">
      <title>Building a new kernel</title>

      <para>Some people do not like building a custom kernel. For those of
      you: you <emphasis>must</emphasis> 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.</para>

      <para>Please note that these instructions where for Linux 2.2 and 2.4
      kernels. UFS support has probably improved in newer Linux
      versions.</para>

      <para>Here are your kernel options for "Solaris compatibility":
      <itemizedlist>
          <listitem>
            <para>Under <computeroutput>code maturity</computeroutput>:
            <variablelist>
                <varlistentry>
                  <term><computeroutput>Prompt for development
                  drivers</computeroutput></term>

                  <listitem>
                    <para>Unfortunately, UFS writing is still
                    experimental.</para>
                  </listitem>
                </varlistentry>
              </variablelist></para>
          </listitem>

          <listitem>
            <para>In <computeroutput>file systems</computeroutput>:
            <variablelist>
                <varlistentry>
                  <term><computeroutput>UFS file system
                  support</computeroutput></term>

                  <listitem>
                    <para>UFS is the Solaris file system.</para>
                  </listitem>
                </varlistentry>

                <varlistentry>
                  <term><computeroutput>UFS file system write
                  support</computeroutput></term>

                  <listitem>
                    <para>The only way to pass data to Solaris.</para>
                  </listitem>
                </varlistentry>

                <varlistentry>
                  <term><computeroutput>partition types / Solaris (x86)
                  partition table support</computeroutput></term>

                  <listitem>
                    <para>This is needed for the slices within your Solaris
                    partition to be found.</para>
                  </listitem>
                </varlistentry>
              </variablelist></para>
          </listitem>
        </itemizedlist>Additional info about kernel building can be found in
      the Kernel-HOWTO.</para>
    </section>

    <section>
      <title>Preparing your boot loader</title>

      <para><emphasis>Before messing with your boot loader, please make sure
      that you have an emergency disk ready that enables you to boot your old
      system.</emphasis></para>

      <para>Unfortunately, the Solaris install overwrites the master boot
      record (MBR) and overwrites your old boot manager.</para>

      <para>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.</para>

      <para>For lilo, this means: look at your
      <filename>/etc/lilo.conf</filename>. Look for the
      <computeroutput>boot=</computeroutput> line. If it is something like
      <computeroutput>boot=/dev/hda1</computeroutput> everything is fine.
      However, if it is something like
      <computeroutput>boot=/dev/hda</computeroutput> it points to the MBR.
      Please change it to point to a primary Linux partition (e.g.
      <computeroutput>boot=/dev/hda1</computeroutput>)</para>

      <para>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 <filename>lilo.conf.mbr</filename> for
      this: <programlisting>#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</programlisting>You can then run <computeroutput>lilo -C
      lilo.conf.mbr</computeroutput> to install lilo into your MBR. In
      addition, do not forget to run <computeroutput>lilo</computeroutput> to
      have lilo in the boot sector of your hard-drive.</para>

      <para>If you reboot now, you should have a lilo-prompt. When you select
      <computeroutput>other</computeroutput> this chain loads the old lilo,
      which in turn loads Linux.</para>
    </section>
  </section>

  <section>
    <title>Installing Solaris</title>

    <section>
      <title>Solaris interactive</title>

      <para><variablelist>
          <varlistentry>
            <term>Solaris 7</term>

            <listitem>
              <para>Solaris Interactive is on the first CD. Boot from the CD
              and select Solaris interactive.</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term>Solaris 8</term>

            <listitem>
              <para>On the Solaris 8 CDs the interactive installer is on the
              first software CD. You do not need the install CD at all.</para>
            </listitem>
          </varlistentry>
        </variablelist>The Solaris installation itself is quite
      straightforward. One thing that might be confusing is the partitioning.
      Solaris will automatically use all the free space on your hard disk, and
      create its own virtual disk in it. Moreover, when it comes to slicing up
      your virtual disk, do not forget to add space for Solaris/Linux
      exchange. A good place for this is an extra
      <filename>/export/share</filename> partition.</para>

      <para>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.</para>
    </section>

    <section>
      <title>Web-Start</title>

      <para>I could not get Web-Start to work at all. Please mail me if you
      have any experience using it.</para>

      <para>However, once Solaris was installed, I had no problems adding
      web-start-packages</para>
    </section>

    <section>
      <title>Getting GNU-tools</title>

      <para>Solaris standard installation does not even have a
      <computeroutput>less</computeroutput> 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 packages at <ulink
      url="http://www.sunfreeware.com"></ulink> The standard packages can be
      installed with <computeroutput>pkgadd &lt;package&gt;</computeroutput>,
      and the web-start packages with <computeroutput>java
      &lt;packagewithoutclassextension&gt;</computeroutput></para>
    </section>
  </section>

  <section id="boot">
    <title>Boot managing</title>

    <section>
      <title>Using the Solaris boot manager</title>

      <para>The Solaris boot manager gives you a choice to select any of the
      four primary partitions for booting. If you had your boot loader
      installed on the boot sector of a primary partition, everything should
      be fine. Boot from this partition, and Linux should come up.</para>
    </section>

    <section>
      <title>Using lilo</title>

      <para>Now you have lilo as a secondary boot loader, but you want it to
      be your primary boot loader again? This is no Problem. Lilo can easily
      chain boot Solaris. Just add the appropriate
      <computeroutput>other=</computeroutput> lines to your lilo.conf</para>

      <para>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.</para>

      <para>However, Solaris might have messed up your partition table. This
      has happened on my system after installation of Solaris8. Lilo does not
      like the new partition, nor does fdisk. I had no problems with
      Solaris7</para>
    </section>

    <section>
      <title>Using grub</title>

      <para>According to feedback I have received about grub, booting Solaris
      with grub works fine.</para>

      <programlisting>title Solaris 9 - sdb
        rootnoverify (hd1,0)
        makeactive
        chainloader +1
</programlisting>

      <para>This will boot Solaris, in this case from hd1,0. You will have to
      adjust this for your system.</para>
    </section>
  </section>

  <section id="sharing">
    <title>Sharing data</title>

    <section>
      <title>Using a shared partition</title>

      <para>If you have build your kernel with Sun disk label support and UFS
      support as mentioned in <xref linkend="kernel" />, you are now able to
      mount your Solaris partitions. During boot up, you should get something
      similar to: <screen>  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;</screen>Meaning
      (in this case): the third partition
      (<computeroutput>hda3</computeroutput>) is a Solaris partition with six
      slices (s0, s1, s2, s3, s6, s7). They are mapped to Linux devices
      <computeroutput>hda9</computeroutput> to
      <computeroutput>hda14</computeroutput>.</para>

      <para>Try mounting your Solaris partitions. When mounting UFS
      partitions, you always have to add an
      <computeroutput>-oufstype=</computeroutput> argument, in this case
      <computeroutput>-oufstype=sunx86</computeroutput>. Therefore, the
      command to mount a partition is something like: <programlisting>  mount -oufstype=sunx86 /dev/hda14 /mnt</programlisting>Now,
      test your partition. <emphasis>Please note: The write support on UFS
      partitions is very experimental. Please do not trust any data you write
      on your UFS partitions!</emphasis></para>

      <para>If you want your Solaris partitions automatically mounted at boot
      time, you can add a line like <programlisting>  /dev/hda14 /solaris ufs ufstype=sunx86 0 0</programlisting>
      to your <filename>/etc/fstab</filename></para>
    </section>

    <section>
      <title>Alternative ways</title>

      <para>In addition, of course there are always other ways of sharing
      data:<variablelist>
          <varlistentry>
            <term>Floppy disk</term>

            <listitem>
              <para>Solaris supports UFS on floppies. That is, you can format
              a floppy and make an ufs file system on it with mkfs, as for any
              disk. Then, you can directly mount the floppy on the virtual
              file system. Such an ufs floppy might be mountable also on
              Linux, with a properly configured kernel.</para>

              <para>A standard DOS floppy cannot be directly mounted: Solaris
              kernels up to SunOS 5.7 do not support FAT, and Solaris 8 might
              neither. Nevertheless, it can be accessed using the standard
              mtools, like under Linux. mtools do not come in bundle with
              Solaris, but they can be downloaded from sunfreeware.</para>
            </listitem>
          </varlistentry>

          <varlistentry>
            <term>Network</term>

            <listitem>
              <para>Solaris knows NFS. Linux knows NFS. This might actually be
              the best way of sharing data</para>
            </listitem>
          </varlistentry>
        </variablelist></para>
    </section>
  </section>

  <section>
    <title>Running foreign binaries</title>

    <section>
      <title>Linux binaries on Solaris</title>

      <para>Is supposed to work using a program called "lxrun". I have not got
      around to testing it yet. See the Solaris web site for more
      information.</para>
    </section>

    <section>
      <title>Solaris binaries on Linux</title>

      <para>Are as far as I know unsupported.</para>
    </section>
  </section>

  <appendix>
    <title>Finding additional info</title>

    <para>Here are some URI that might help you: <itemizedlist>
        <listitem>
          <para><ulink url="http://www.sunfreeware.com">Sun Freeware</ulink>
          My first stop for Solaris resources. It has many GNU-tools in binary
          format ready to install.</para>
        </listitem>

        <listitem>
          <para><ulink url="http://www.blastwave.org/">"Community Software for
          Solaris" ( CSW )</ulink> has many softwarepackages as well.</para>
        </listitem>

        <listitem>
          <para><ulink url="http://www.sun.com">Sun Microsystems</ulink> Suns
          official web page.</para>
        </listitem>

        <listitem>
          <para><ulink url="http://www.sun.com/software/solaris/">Solaris
          Homepage</ulink></para>
        </listitem>

        <listitem>
          <para><ulink
          url="http://soldc.sun.com/support/drivers/hcl/index.html">Solaris
          Hardware Compatibility List (HCL)</ulink></para>
        </listitem>

        <listitem>
          <para><ulink url="http://docs.sun.com">Solaris Online
          Documentation</ulink></para>
        </listitem>

        <listitem>
          <para><ulink url="http://max.berger.name/">My Website</ulink> You
          will always find the newest version of this document somewhere on
          this page.</para>
        </listitem>
      </itemizedlist></para>
  </appendix>

  <appendix>
    <title>Credits and legal information</title>

    <section>
      <title>Credits</title>

      <para>Thanks to Marcel Meyer for beta testing this HOWTO while
      installing Solaris on his machine.</para>

      <para>Thanks to Marino Miculan for the floppy disks section.</para>

      <para>Thanks to Mike Khosraviani, John Misino, Ted Remillard, Ryoji
      Kawagishi, and Markus Wagner for information about grub.</para>

      <para>Thanks to Ferenc Veres for the link to CSW.</para>

      <para>An addition, many thanks to Baptiste Mélès for translating this
      HOWTO into french, KIMURA Tomoaki for the tranlastion into japanese, and
      to all other translators that I do not know about!</para>
    </section>

    <section>
      <title>Questions, comments, suggestions</title>

      <para>Questions, comments, and suggestions are always welcome. You can
      reach me via e-mail at <ulink
      url="mailto:max@berger.name"></ulink></para>
    </section>

    <section id="legal">
      <title>License</title>

      <para>This document is copyrighted © by Max Berger. You may use and/or
      modify it according to the Linux Documentation Project License (LDPL)
      found at <ulink url="http://en.tldp.org/COPYRIGHT.html"></ulink>.</para>

      <para>According to the license you do not have to tell me, but I would
      very much like to know when you modify and/or republish this
      document.</para>

      <para>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 hints and examples given herein at your own
      risk.</para>
    </section>
  </appendix>
</article>