Archive for the ‘Solaris’ Category

Create a VNIC on Solaris Nevada (Solaris Express) Builds, and Use It for an Exclusive IP Stack in Zones

Thursday, July 17th, 2008

Given that I discovered quite a while ago that you can create vnic’s WITHOUT crossbow, in the early 80’s builds (b83+ appears to work), I decided today to try using the vnic’s for exclusive ip stacks in zones. The good news is, it works! The bad news is, besides already being unsupported (as this is Solaris Express), doing things like this is probably super, super unsupported.

So, lets do it.

Create a VNIC:

/usr/lib/vna <physicalAdapter> <fakeMacAddress>

You will get the vnic name returned as “vnic0″, then vnic1, and so on the more times you do this. Always use a different mac address of course, else, fail.

Create a new zone, and when configuring it, set the physical NIC to vnic0, and DO NOT set an address on it.

So, either type the commands below into zonecfg when creating a new zone:

# zonecfg -z <zoneName>
zonecfg:<zoneName>> set ip-type=exclusive
zonecfg:<zoneName>> add net
zonecfg:<zoneName>:net> set physical=vnic0
zonecfg:<zoneName>:net> end
zonecfg:<zoneName>> commit

OR remove the NIC config from an existing zone, and configure the new nic

zonecfg -z <zoneName> "remove net; set ip-type=exclusive; add net; set physical=vnic0; end"

Good to go - now boot the zone, and get on the zone console:

zlogin -C -e \# <zoneName>

Login as root, and then plumb the interface to verify it works:

ifconfig vnic0 plumb

And now, configure the zone like a regular Solaris 10 host, creating the /etc/hostname.vnic0 file, with a hostname in it, editing /etc/hosts, setting up /etc/resolv.conf, /etc/netmasks, /etc/defaultrouter and so on, and you should be good to go!

You may also wish to write a startup script that runs before the zones come up at boot, to avoid the zone boot failing. It will simply need to contain the /usr/lib/vna lines you used above to configure the vnic’s in the first place.

Quick and Easy Way to Build Solaris 10 / Solaris Express Zones

Tuesday, June 24th, 2008

So, maybe you don’t want to spend any time installing JET (JumpStart Enterprise Toolkit) but you do want to build zones in a jumpstart-ish way, that is - quickly and consistently on say, your laptop for example… oh yeah and you want to do it right now!

Well, there’s probably a boat load of other people who have done something similar to this before, but, whatever. I’ve written a quick script to add and remove zones from a solaris 10 (or in this case, a Solaris Express) machine, with very little thought and virtually no questions asked.

The newZone.ksh script will:

  • Perform basic verification that your input is sane, such as checking the NIC is plumbed, IP is valid-ish, Zone doesn’t exist
  • Default to autoboot the zone
  • Use your existing /etc/sysidcfg, changing only the hostname (easily modifiable for more complex setups)
  • Allow for post-install scripts to be run, but you must add them yourself (or ask and I’ll give you my basic one).

The rmZone.ksh has basically no error checking, and the script will simply:

  • Halt the running zone immediately
  • Uninstall the zone
  • Delete the zone’s config

The scripts should be relatively easy to follow, and modifable as you see fit. Please don’t redistribute a modified version without my permission.

UPDATE 14 July 2008: Zone Creation Scripts updated to:

  • Improve handling of invalid input
  • Resolve bug with sparse zone creation

Additional notes added to this post you must read if you have not installed the zone host from jumpstart (you will need to create a sysidcfg similar to the example)

You can grab the scripts in the tar file at:


newZone.ksh <zoneName> <physicalNIC> <zoneIP> [whole | sparse]
rmZone.ksh <zoneName>

Sample run:

bash-3.2# ./ ldapm1 rtls0 whole
INFO: Zone does not exist, OK to create
INFO: Physical NIC exists, OK to use
INFO: IP Address is probably OK
INFO: ZoneType is OK
INFO: Configuring Zone...
INFO: Creating a whole zone in /export/zones/ldapm1
Preparing to install zone <ldapm1>.
Creating list of files to copy from the global zone.
Copying <206279> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <1358> packages on the zone.
Initialized <1358> packages on zone.
Zone <ldapm1> is initialized.
[NOTICE: Zone rebooting]

SunOS Release 5.11 Version snv_92 64-bit
Copyright 1983-2008 Sun Microsystems, Inc.  All rights reserved.
Use is subject to license terms.
Hostname: ldapm1
Reading ZFS config: done.
ldapm1 console login:

And we’re good to go!

NOTE for Non-Jumpstarted Machines: The scripts assume the host of your zones was jumpstarted, and as such, has an /etc/sysidcfg file. If it does not, you will want to have one somewhere, by default it looks at /etc/sysidcfg.

For simplicity, you could create one that looks something like this (with the correct paramaters, of course)

  name_service=DNS {domain_name=<your domain>
                        name_server=<your name server>
                        search=<your search domain>}
  root_password=<a crypt version of your password>
  network_interface=primary {hostname=<your host name>
                        netmask=<your netmask>
                        default_route=<your default route>}
  nfs4_domain=<your domain name>

replacing all the bits in the < >, and the <hostname> bit with your systems hostname - this is important as the script uses sed to replace this value with your zone’s hostname, if you do not do this, you will get asked all the questions from the installer, and all of a sudden, the automated build isn’t so automated!

Random bits about Solaris Express on the ASUS eeePC

Wednesday, April 2nd, 2008

Out of the box, the eeePC’s got a lot of stuff packed onto that 4GB disk, a custom Xandros (Linux) install, with a bunch of applications - and it works well for the most part. But I’m really not that into Linux (personal bias) and I wanted to try and get a working, useable Solaris install on the device.

Given how far ahead Solaris Express is on the Desktop over Solaris 10u4, I was definitely going to be using an OpenSolaris derived build. I tried a couple of options, including SXCE b82, the indiana preview 2 and nexenta 1.0 (I also tried eeeXubuntu, but it wasn’t for me, I wanted Solaris on this puppy not linux).

Note: You will need to upgrade the memory in your eeePC to reliably install and run a newer release of Solaris Express (b72 was fine, but when I tried 79 and above, the installer was unreliable. I have upgraded to 2GB of memory and a 8GB SD card, and this makes the eee significantly more useable, and give you some head room with the disk).

Also, please note you will require a USB keyboard to install the thing, but there is a dodgy fix below that gets around this problem once Solaris is installed.

Installing Solaris Express

My first goal was to get a working GUI, then to get the thing on the internet (ideally using 3G).

First attempted using Jumpstart - no good, Solaris doesn’t support the atheros 10/100Mb on board adapter in the jumpstart environment

Second attempt - boot from USB DVD - works (make sure you attach a USB keyboard for the install and first boot!)

Install questions:

1. Use Console Session Jumpstart Interactive

2. When it gets to disk layout, do it manually and create your own partition layout, making / the entire disk (the only way you’ll fit all this on the 4GB drive) on s0 - unless you use additional storage, in which case you don’t have to be so harsh with the “all root” or nothing approach.

3. Use the “End User” Cluster (Claims to require over 4GB, it doesn’t), and preferably remove some packages (there’s only so much room on this thing!) I will post a stripped down profile to assist with this once I have one created, so maybe we can get some swap space even on the base 4GB drive.

Once you get through this, it will take its time and to the install.

Once its up, the first thing you’ll want to do is fix the keyboard, as it does not work reliably out of the box.

Fixing the in built keyboard not working on the eeePC

Write a quick script to fix the keyboard issue at boot (Found a hint that guided me in the right direction after doing some mucking around myself and finding the issue and that a keyboard driver was happily attached [grrr], turns out a modunload and a modload fixes the problem - thanks for the hint from timf

modunload -i `modinfo|awk '/kb8042/ {print$1}'
devfsadm -i kb8042
modload /kernel/drv/kb8042

I saved this quick script as /etc/init.d/fixKB and linked it in /etc/rc2.d/S99fixKB, this fixes it on each boot.

Now onto making the nokia 6120 modem work via USB with Virgin Mobile…

Using a USB cable to a Nokia 6120 Classic (and many other nokia phones) for Internet Access (3G)

-Attach the DVD drive again, with Solaris install CD inside

-Install the SUNWpppd* packages:

pkgadd -d /media/SOL11_X86_1/Solaris_11/packages SUNWpppd SUNWpppdr SUNWpppdu

-Plug in the nokia and link the device in the dev tree:

ln -s /dev/term/0 /dev/nokia

-Edit /etc/ppp/peers/nokia:

connect '/usr/bin/chat -V -t15 -f /etc/ppp/nokia-chat'

-Edit /etc/ppp/nokia-chat:

'' 'ATZ'
'OK' 'ATE0V1'
'OK' 'AT+CGDCONT=,,"virgininternet"'
'OK' 'ATD*99#'

-Reboot (SUNWpppd needs the ppp driver loaded in the kernel, you could probably load this manually)

-Edit /etc/resolv.conf:


-Edit /etc/nsswitch.conf, adding “dns” to the lines “hosts”:

hosts: files dns

Now, to start using the internet:

pppd call nokia

Compiz Fusion on the eeePC

You can install Compiz quite easily thanks to Erwann Chénedé at Sun

However, though it basically works, it is a bit buggy in my experience on both my laptop and on the eeePC. Never the less, I have posted a quick you tube video so you can see compiz in action on the eeePC.