Solaris Tips & Tricks

Introduction

Here you'll find some information about building Solaris 8 guest on VMware, *NOT* a through step-by-step instruction. They are just some tips and tricks and gotcha's to avoid while installing and configuring a Solaris guest.

For more detailed install instructions, visit Jan Exss's very useful page (http://www.jan.exss.de/vmware/solaris/en_index.html). There you'll find step-by-step instruction for installing Solaris on VMware, Custom JumpStart (automatic installation) floppy images and even skeletal virtual machines to build Solaris environment on VMware.

For those who are familiar with Solaris, Jürgen Keil's "Resource for Solaris" (http://www.tools.de/solaris/) is highly recommended. Although there is no VMware specific information, you'll find several interesting stuff -- such as an audio driver for Ensoniq 1371 (sound device emulated by VMware 4.x), PS/2 wheelmouse driver, and the latest XFree86 video driver port.

NOTE: This article was originally written for Solaris 8 guest on VMware Workstation 3.x. I do think some information apply also to Solaris 9 and VMware Workstation 4.x, but I haven't investigated yet.

Choosing VMware Version

VMware Workstation 3.0 or later is recommended. Although it is possible to use Solaris guest on VMware version 2, it is not preferred for the following reasons:
  • To begin with, it is impossible to install Solaris from CD-ROM or ISO image on Windows host. It has something to do with the way Windows handle CD-ROM drives, and VMware version 2 doesn't have a way to avoid it. It is possible to build a Solaris VM on a Linux machine and transfer it to a Windows machine, or to install from a networked install server, but I don't think it's worth the trouble.
  • 2GB limitation of VMware 2 virtual disk is too small for Solaris to fit comfortably within. You'll have to use a plain or raw disk or multiple virtual disks.
  • Enabling DMA in Solaris guest causes VMware to crash (I don't know about VMware for Linux, but it sure does with VMware for Windows). The guest's disk access is extremely slow without DMA and almost unusable.

Creating a Virtual Machine

  • Use IDE virtual disk instead of SCSI. Solaris 8/9 does not provide a driver for Buslogic SCSI adapter.
  • On Windows host, enable raw access for CD-ROM drive if you are going to install Solaris from a physical CD-ROM drive. It is not necessary when you are installing from ISO images.
  • Choose "Other" or "FreeBSD" as the guest operating system. Both options have been working just well for me. Choosing "Linux" has caused some processes in the guest to crash from time to time so I decided that this is no good.
    There are several reports that "FreeBSD" handles the timing issue better than the "Other". Try "FreeBSD" if you have timing problems such as too fast keyboard repeat.

Installing the Operating System

  • Boot from "Software 1" CD-ROM instead of "Installation" CD-ROM. "Installation" CD-ROM launches the GUI installer and it does not work on VGA screen (which you have to use during installation, for VMWare SVGA driver is not included in Solaris CD-ROM). This GUI installer also creates a 512MB partition for its working area, which is later converted into a swap partition. I don't think that large swap area is quite necessary for a virtual machine, though of course that depends on how you are going to use the VM.
  • When prompted to choose a Video Device, choose "16 color Standard VGA 640x480 (256K)" or "16 color Standard VGA with panning @800x600 (256K)". Any other option will not work. Selection of Monitor Type does not seem to make any difference.

Enabling DMA for Hard Disk Drives (Solaris 8)

Without DMA enabled, disk access in the virtual machine is extra-slow. Although enabling DMA does not make it lightning-fast, it certainly makes things tolerable. DMA is disabled by default on Solaris 8 so you have to manually enable it.
  1. Boot the VM.
  2. On "SunOS Secondary Boot" screen, press <ESC> key when prompted.
  3. On "Solaris Device Configuration Assistant" screen, press <F2> to proceed.
  4. On "Identified Devices" screen, press <F2> to proceed.
  5. On "Boot Solaris" screen, press <F4> to start "Boot Tasks".
  6. On "Boot Tasks" screen, choose "View/Edit Property Settings" and press <F2> to proceed.
  7. On "View/Edit Property Settings" screen, search an item named "ata-dma-enabled" and change its value to "1".
  8. Press <F2> then <F3> to go back to "Boot Solaris" screen.
  9. Choose "DISK" then press <F2> to continue booting the operating system.

Getting Better Screen Resolution

Since VMWare SVGA driver is not officially provided, you have to use a third party SVGA driver to get reasonable screen resolution: Solaris with standard VGA screen (screen shots #1, #2) is dull at the best, and almost offending at the worst.

You can download such SVGA driver packages from several places:

My personal recommendation is Jürgen's package. Not only because it's based on the latest XFree86 release, he seems to know quite a lot about Solaris and XFree86 stuff -- he even has a port of XFree86 development snapshot.

If, unfortunately, these driver packages fail to work for you, there are still a few ways to have good screen resolution:

  • Run an X server on the host and connect to the Solaris guest. If you use a Linux host or you happen to have a Windows X server software available, it is the easiest way.
  • Similarly, you can run X server on any other networked machines if the VM is configured to use bridged networking.
  • Run a remote control software such as VNC (http://www.realvnc.com/, http://www.tightvnc.com/, http://www.tridiavnc.com/, etc.) in the guest and connect to it from the host or any other networked machies.

Running VMware-Tools on Solaris (Solaris 8, 9)

With lxrun, you can run certain version of VMware-Tools for Linux (part of it, actually) in Solaris.
With vmware-toolbox running, you can:

  • Copy & Paste text between the host and the guest
  • Automatically grab/release input focus with mouse movement
  • Connect/disconnect virtual devices
With vmware-guestd running, you can:
  • Synchronize system clock
Virtual Disk Shrinking is not available, but there is a workaround.

Only the following combination of lxrun build / linux environment / vmware tools version works for me:

  • lxrun 0.9.6pre1-sun1 from the Solaris 8 companion CD or 0.9.6pre1 compiled from the original source
  • linux environment extracted from RedHat 6.2 distribution CD
  • vmware tools binaries shipped with VMware WS 3.x or WS 4.0.x
FYI, the table below shows the combinations I've tried so far:
Solaris version lxrun build linux environment from result
Solaris 8 02/02 lxrun 0.9.6pre1-sun1,
built on Nov 28 2001 at 02:35:11
(Solaris 8 companion CD 02/02)
redhat 6.2 (zoot-i386.iso) OK
lxrun 0.9.6pre1 compiled from
the original source with gcc 2.95.3 on Solaris 8
redhat 6.2 (zoot-i386.iso) OK
Solaris 9 12/03 lxrun 0.9.6pre1-sun1,
built on Nov 28 2001 at 02:35:11
(Solaris 8 companion CD 02/02)
redhat 6.2 (zoot-i386.iso) OK
redhat 7.3 (valhalla-i386-disk1.iso) NG
lxrun 0.9.6pre1-sun2,
built on Sep 6 2003 at 12:00:52
(Solaris 9 companion CD 12/03)
redhat 6.2 (zoot-i386.iso) NG
redhat 7.3 (valhalla-i386-disk1.iso) NG
lxrun 0.9.6pre1 compiled from
the original source with gcc 2.95.3 on Solaris 9
redhat 6.2 (zoot-i386.iso) OK

To get necessary VMware-Tools binaries:

  1. Get a VMware WS 3.x or 4.0.x for Linux packge (tar.gz file)
    If you already have one, then that's fine. If you don't, then things get a bit complicated since they no longer offer those old versions for download at VMware site. You could still find those files (for example by googling "VMware-workstation-4.0.5-6030.tar.gz") in the web, though it's kind of dubious and I'm not promoting it.
  2. Extract "linux.iso" file from VMware tar.gz file
  3. Extract "vmware-linux-tools.tar.gz" file (or similar name) from linux.iso.
    The iso file should contain only one tar.gz file anyway.
  4. Extract "vmware-guestd" and "vmware-toolbox" files from vmware-linux-tools.tar.gz
PLEASE do not ask me how to extract files from tar.gz or iso files, or to send you a copy of VMware-Tools binaries.

To run VMware-Tools for Linux in Solaris guest:

  1. Install and configure lxrun according to the lxrun document.
    If you don't know how, or you are too lazy to do it yourself, you could download minimal lxrun environment.
  2. Extract vmware-linux-tools.tar.gz from linux.iso. (linux.iso should be found in VMware program directory in the host.)
  3. Extract vmware-toolbox and/or vmware-guestd from vmware-linux-tools.tar.gz.
  4. Place these files in any directory under the lxrun Linux root (eg. /linux/usr/local/bin)
  5. Start vmware-guestd and/or vmware-toolbox with lxrun:
    	lxrun /linux/usr/local/bin/vmware-guestd
    	lxrun /linux/usr/local/bin/vmware-toolbox

To start vmware-guestd automatically at the system startup:

  1. Create a script file /etc/init.d/vmware-guestd
    (Modify paths in the script according to your setup).
    	#!/sbin/sh
    	# vmware-guestd
    	LINUX_ROOT=/lx-env
    	LINUX_PATHMAP=/lx-env/PATHMAP
    	export LINUX_ROOT LINUX_PATHMAP
    
    	case "$1" in
    	'start')
    		cd $LINUX_ROOT
    		$LINUX_ROOT/lxrun $LINUX_ROOT/bin/vmware-guestd --background $LINUX_ROOT/vmware-guestd.pid
    		;;
    	'stop')
    		/usr/bin/kill -TERM `cat $LINUX_ROOT/vmware-guestd.pid`
    		;;
    	*)
    		echo "Usage: $0 { start | stop }"
    		;;
    	esac
    	exit 0
  2. Create a link /etc/rc2.d/S100vmware-guestd to this script.
    The link can be either a symbolic link or a hard link.

To start vmware-toolbox at the X session startup:

  1. Copy /usr/dt/config/Xconfig and /usr/dt/config/Xsetup to /etc/dt/config directory if you have not done so already. (You can edit files in /usr/dt/config directory, but the recommended way is to edit copied files in /etc/dt/config directory and keep original files unmodified.)
  2. Uncomment the following line in Xconfig file:
    	Dtlogin*grabServer:        False
    Otherwise, the login manager gets exclusive hold of the screen and vmware-toolbox cannot run.
  3. Tell the login manager to reread the modified Xconfig file:
    	/usr/dt/bin/dtconfig -reset
  4. Add the following lines at the end of Xsetup file (change paths according to your setup)
    	# launch vmware-toolbox
    	$XDIR/xhost localhost
    	LINUX_ROOT=/lx-env
    	LINUX_PATHMAP=/lx-env/PATHMAP
    	export LINUX_ROOT LINUX_PATHMAP
    	$LINUX_ROOT/lxrun $LINUX_ROOT/bin/vmware-toolbox -geometry -10-76 --minimize &
    -geometry option and --minimize option is not necessary, but I prefer it this way.
    Note: the Solaris' login manager may cover the entire screen with its background. In that case vmware-toolbox will be hidden behind and won't be visible until you login to the system.
NOTE: Running an old version of vmware-tools on recent VMware platforms causes "Your VMware Tools is out of date" message in VMware status area. You could eliminate it by sending an "tools.set.version" backdoor RPC command from inside the guest after you have started the vmware-guestd, for example by using my "vmw" backdoor access program:
	# vmw rpc "tools.set.version 6433"
The number 6433 used here is the version number used by VMware-Tools shipped with VMware WS 5.5.2 build 29772. There seems to be no harm in specifying a greater number (say, 10000).

Shrinking Virtual Disks

  1. Make sure that the virtual disk is used in persistent mode.
    In VMware WS 3.x, configure the virtual disk as "Persistent".
    In VMware WS 4.x and later, remove snapshot or configure the virtual disk as "Independent Persistent".
  2. Find the amount of unused space in the virtual disk.
    	# df -b /
  3. Create a file filled with 0x00 as large as the unused space.
    	# dd if=/dev/zero of=/bigfile bs=1024 count=<n>
    <n> is the value returned by the df command in step #1.
    You don't have to worry if you encounter a disk full error.
  4. Delete the file created in step #2, for the file itself is not really necessary.
    The point is to fill all unused sectors with 0x00.
    	# rm /bigfile
  5. Shutdown and power off the VM, then perform "Defragment" operation from the Configuration Editor. You will get a "disk size mismatch" warning the next time you start the VM, but it seems to be harmless.
NOTE: My "vmshrink" program does all these for you ;-)

Idling the CPU Properly (Solaris 8)

Older releases of Solaris 8 (earlier than 2001/07 or 2001/10; I'm not sure exactly which release) does not idle the CPU when the operating system is idle. Instead it enters into a tight loop and consumes the host's precious CPU time. Apply the Kernel Update Patch 108529-09 (or later. 108529-18 is the latest as of Feb. 14, 2003).
Actually, I think applying the whole Recommended Patch Cluster (something like Windows' Service Packs) is a very good idea, although it takes more than a few hours. The patches are available from the SunSolve site.

Miscellaneous Tips

  • When you connect a CD-ROM drive to the Solaris VM the first time after starting the system, you'll get the following error:
    Your virtual machine has sent a CD-ROM command that we have not
    implemented. The command packet was:
    0x44 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x8 0x0 0x0 0x0
    This is not a fatal error, but may cause a failure in the application trying
    to access the CD-ROM
    The Solaris Volume Management daemon, which automatically mounts removable disks, is causing this error. It has no effect when actually accessing the CD-ROM. You don't have to worry much about this.
  • When you try to disconnect CD-ROM drive you'll get the following warning:
    The guest operating system has locked the CD-ROM door and is probably
    using the CD-ROM. Disconnect anyway (and override the lock)?
    The same Volume Management daemon is locking the drive and it is safe to force disconnect the drive if you are sure that no program is using the drive.
    However if you are nervous about doing so, you can stop the daemon before disconnecting the drive:
    	# kill -TERM `pgrep vold`
    and restart it after that:
    	# vold &
    (You have to be a root user to do so.)
  • When you apply patches, errors 2 and 8 may be reported by Solaris 8. They mean that "the same or later version of the patch has already been applied" and that "one or more patch packages included in the patch are not installed on the system".
    Likewise, errors 2, 8 and 35 which may be reported by Solaris 9 mean "the same has already been applied", "one or more patch packages included in the patch are not installed on the system" and "a later version of the patch has already been installed" respectively.
    Each of them means that you don't need the particular patch so you don't have to worry about this.