Wednesday 12 August 2009

Provisioning Solaris using JET and Jumpstart

Background


Jumpstart and JET (Jumpstart Enterprise Toolkit) are used to provision Solaris systems locally and across a network.


Here’s how to use JET and Jumpstart to build either SPARC or x86 hardware. You can use either architecture to build any other architecture. In this example my jumpstart server is actually a Solaris 10 x86 VM on an ESX cluster.
What I used:

  • A Solaris 10 VM running on ESX as the Jumpstart Server.
  • JET package (http://www.sun.com/downloads)
  • Copy of the Solaris OE ISO (http://www.sun.com/downloads)
  • An ESX VM image to jumpstart as an x86 client.
  • A Sun T6320 sun4v server to Jumpstart as a SPARC client.
  • Copies of any packages you want to install.
  • Latest recommended patch bundle.

Ok so there are 10 basic steps:

  • Download and Install the JET packages
  • Configure DHCP
  • Create some missing directories & extra NFS shares
  • Copy the Solaris Media
  • Copy the recommended patch bundle
  • Copy any extra packages
  • Add the Client MAC address to /etc/ethers
  • Make a template for your host
  • Make the client configuration
  • Boot the client off of the network

Download and Install the JET packages

You can download the JET package from the Sun downloads website. The package is a single file that contains multiple packages. pkgadd the package and type “all” to install everything.
# bunzip2 JET.pkg.bz2
# pkgadd -d JET.pkg

The following packages are available:
1 JETEXPLO JET explo product
(sparc) 3.1.18

2 JETFLASH JET flash product
(sparc) 3.1.9

3 JETISO JET ISO product
(sparc) 1.0.0

4 JETJASS JASS product
(sparc) 3.0.15

.....output truncated......
Now add the following to your roots PATH variable.
# PATH=$PATH:/opt/SUNWjet/bin
# MANPATH=$MANPATH:/opt/SUNWjet/man
# export PATH MANPATH

Configure DHCP

If you are going to be jumpstarting x86 you will need to configure a DHCP server to provide an IP address to the PXE boot process. This step isn't required for a SPARC based install. JET comes with a script to create a DHCP environment, but it's shipped without the executable permission set. So fix this, then edit it and update the NETWORK, SUBNET and ROUTER variables with your site specific details.

# cd /opt/SUNWjet/Products/base_config/solaris/
# vi make_dhcp

NETWORK=172.18.100.0
NETMASK=255.255.255.0
ROUTER=172.18.100.1
Then make it executable and run it:

# chmod 755 make_dhcp
# ./make_dhcp
Created DHCP configuration file.
Created dhcptab.
Added "Locale" macro to dhcptab.
Added server macro to dhcptab - vm-03.
DHCP server started.
Added network macro to dhcptab - 172.18.100.0.
Created network table.

Create some missing directories & extra NFS shares

There are a couple of directories you will need later on that are not created for you. Make sure that your /export/install path has these three directories present.
# ls -l /export/install
total 9
drwxr-xr-x 2 root root 2 Feb 24 10:27 media
drwxr-xr-x 2 root root 2 Feb 24 17:47 patches
drwxr-xr-x 3 root root 3 Feb 24 17:36 pkgs
And make sure that you have the following NFS shares:
share -F nfs -o ro,anon=0 -d "JET Framework" /opt/SUNWjet
share -F nfs -o ro,anon=0 -d "JET Framework" /export/install
Note: Make sure you never share /export/install read write, the first jumpstart client will probably work but will change the Solaris OE layout meaning any proceeding build will fail, the easiest way to recover will be to remove the Solaris OE image and copy it again.

Copy the Solaris Media

JET needs to have a copy of the Solaris OE ingested into it. Multiple different versions of the OS can be added (you can list what is copied into JET with the list_solaris_locations command), and you need to give them a "JET name" - a shortened tag. In the example below I show you what I have in my JET infrastructure, then add a copy of the latest mainstream release of Solaris for SPARC.

greenpark:solaris# list_solaris_locations

Version Location
------- --------
SOL10_U6_X86 /export/Software/Sun/SunOS_JET/x86/5.10/U6/
SOL11_B106_SPARC /export/Software/Sun/SunOS_JET/sparc/5.11/b106
SOL11_B110_SPARC /export/Software/Sun/SunOS_JET/sparc/5.11/b110
#
# copy_solaris_media \
> -d /export/Software/Sun/SunOS_JET/sparc/5.10/U6 \
> -n SOL10_U6_SPARC \
> -i /share/Software/Sun/SunOS/sparc/5.10 \
> sol-10-u6-ga1-sparc-dvd.iso
Created loopback device /dev/lofi/1 for /share/Software/Sun/SunOS/sparc/5.10/sol-10-u6-ga1-sparc-dvd.iso
mounted /share/Software/Sun/SunOS/sparc/5.10/sol-10-u6-ga1-sparc-dvd.iso at /export/install/media/2291/slices/s0 (of type hsfs)
Copying Solaris image....
Verifying target directory...
Calculating the required disk space for the Solaris_10 product
Calculating space required for the installation boot image
Copying the CD image to disk...
Copying Install Boot Image hierarchy...
Copying /boot netboot hierarchy...
Install Server setup complete

Added Solaris image SOL10_U6_SPARC at the following location:
Media: /export/Software/Sun/SunOS_JET/sparc/5.10/U6

Unmounting /export/install/media/2291/slices/s0
removing device /dev/lofi/1
removing directory /export/install/media/2291

Now list the Solaris installs we have loaded into JET:

Version Location
------- --------
SOL10_U6_X86 /export/Software/Sun/SunOS_JET/x86/5.10/U6/
SOL10_U6_SPARC /export/Software/Sun/SunOS_JET/sparc/5.10/U6
SOL11_B106_SPARC /export/Software/Sun/SunOS_JET/sparc/5.11/b106
SOL11_B110_SPARC /export/Software/Sun/SunOS_JET/sparc/5.11/b110

Copy the Latest Recommended Patch Bundle

If you decided to download the latest recommended patch bundle to have JET automatically install as part of the system installation then copy and unzip to /export/install/patches now.

Copy Additional Packages

As the standard release of solaris doesn't include software such as vim, we have a set of packages that we choose to install on top of the OS image. You decide which package you will apply to which jumpstarted host latter when you create the template, but in order for the template to be able to use the additional software it needs to be loaded into JET in a similar manner to the Solaris media.
# pwd
/share/Software/Sun/SunFreeware/Sunfreeware_10_U6/sparc
# copy_custom_packages `pwd` sparc SFWvim
I prefer to load all the Sun freeware packages into my JET service up front. This prevents problems later so I don’t need to keep running this for every package I forget to add. A quick loop......
# for i in `ls`
> do
> echo $i
> copy_custom_packages `pwd` sparc $i
> done
SFWaalib
Transferring package instance
Packages copied
SFWaconf
Transferring package instance
Packages copied
SFWafio
Transferring package instance
Packages copied
SFWamake
.....output truncated.....
This loads these SPARC specific packages into your JET infrastructure, we need to do the same for our i386 packages as well substituting the "sparc" keyword for "i386". Obviously you need to download the x86 packages first. BE CAREFUL ADDING PACKAGES there's no mechanism to stop you from adding the SPARC packages in as i386 by mistake. It will only manifest itself when you have an installed your system after the jumpstart, and you’re packages are the wrong executables and don’t work.
We also have here an internal package that I like to install on all the servers I look after, it contains only scripts so is not architecture dependent. The package was created with a slightly different format to the Sun packages so errored as below:
# copy_custom_packages `pwd` sparc IOKOtools-0.195
pkgtrans: ERROR: unable to complete package transfer
- no packages were selected from
Error copying package IOKOtools-0.195... exiting
This is the method to copy these packages:
# pkgtrans IOKOtools-0.195 /tmp all
# cd /tmp
# copy_custom_packages `pwd` sparc IOKOtools
# copy_custom_packages `pwd` i386 IOKOtools
Add the Clients MAC address to /etc/ethers
Every client that boots broadcasts it’s MAC address to request a boot server to supply an IP address. You don’t have to do this, but I find it useful to have all of your systems mac addresses in a single file, this is what /etc/ethers is for. If you choose not to use /etc/ethers then you will need to add the MAC address to each host template which we go into in the next step.
# cat /etc/ethers
00:03:ba:42:50:33 v240-01
0:14:4f:cd:f3:8c t6320-01
.....output truncated......

Make a Template for your host

Within JET each host that you wish to Jumpstart will need a template describing things like partition sizes, disk mirroring, UFS/ZFS, IPMP, network config, etc. You can create this easily enough using the make_template command and passing it the architecture of the host the OS version you want to install on it and the hostname. Finally you can pass it what JET modules you want to use on that specific host, for instance you may want to use ZFS or flash archives to provision that host. The example below shows a regular solaris Niagara host that will be installed with Solaris 10 update 6 with ZFS additions.
# make_template -A sun4v -O SOL10_U6_SPARC t6320-01 zfs
Adding product configuration information for
+ base_config
+ zfs
Updating base_config template specifics
Client template created in /opt/SUNWjet/Templates
Now for an x86 client.

# make_template -A i86pc -O SOL10_U6_X86 vm-23 zfs
Now edit these templates in /opt/SUNWjet/Templates and configure them as needed.
Note!

One thing that isn’t greatly documented is to add grub to any x86 boxes to ensure that it correctly builds the PXE environment when you run the make_client below.
base_config_client_allocation="grub"

Make the client configuration

We must now let JET read in all the detail from the template and configure the BOOTP/DHCP/NFS and all other components that make up the Jumpstart environment. This is the final step to make the server functional. Note the slight difference in output from the two clients created. Ones SPARC and requires a bootparams boot setup and the other is x86 and requires a PXE environment. Ensure that any x86 client has the relative lines highlighted below.

First the SPARC with bootparams details highlighted:
# make_client -f t6320-01
Gathering network information..
Client: 172.18.100.18 (172.18.100.0/255.255.255.0)
Server: 172.18.100.19 (172.18.100.0/255.255.255.0, SunOS)
Adding t6320-01 to local /etc/hosts
Merge hosts file /tmp/addhost.13080 with /etc/inet/hosts
Solaris: client_prevalidate
Clean up /etc/ethers
Solaris: client_build
Creating sysidcfg
WARNING: no base_config_sysidcfg_timeserver specified using JumpStart server
Creating profile
Adding base_config specifics to client configuration
Solaris: Configuring JumpStart boot for t6320-01
Solaris: Configure bootparams build
Starting SMF services for JumpStart
cleaning up preexisting install client "t6320-01"
removing t6320-01 from bootparams
removing /tftpboot/inetboot.SUN4V.Solaris_11-3
updating /etc/bootparams
copying boot file to /tftpboot/inetboot.SUN4V.Solaris_11-3
Force bootparams terminal type
-Restart bootparamd
Running '/opt/SUNWjet/bin/check_client t6320-01'
Client: 172.18.100.18 (172.18.100.0/255.255.255.0)
Server: 172.18.100.19 (172.18.100.0/255.255.255.0, SunOS)
Checking product base_config/solaris
Checking product custom
--------------------------------------------------------------
Check of client t6320-01
-> Passed....
Then the x86 with highlighted PXE details:
# make_client -f vm-09
Gathering network information..
Client: 172.18.100.109 (172.18.100.0/255.255.255.0)
Server: 172.18.100.19 (172.18.100.0/255.255.255.0, SunOS)
Adding vm-09 to local /etc/hosts
Merge hosts file /tmp/addhost.16207 with /etc/inet/hosts
Solaris: client_prevalidate
Clean up /etc/ethers
Solaris: client_build
Creating sysidcfg
WARNING: no base_config_sysidcfg_timeserver specified using JumpStart server
Creating profile
Adding base_config specifics to client configuration
Solaris: Configuring JumpStart boot for vm-09
Solaris: Configure PXE/grub build
Starting SMF services for JumpStart
Adding install client
Doing a TEXT based install
Leaving the graphical device as the primary console
Configuring vm-09 macro
Using local dhcp server
PXE/grub configuration complete
Running '/opt/SUNWjet/bin/check_client vm-09'
Client: 172.18.100.109 (172.18.100.0/255.255.255.0)
Server: 172.18.100.19 (172.18.100.0/255.255.255.0, SunOS)
Checking product base_config/solaris

WARNING: Patch 119375-03 may need to be applied to the boot image.
Please determine if the miniroot is patched and apply if required.
You can suppress this warning by typing:
# touch /export/install/media/SunOS/x86/5.10/u6/Solaris_10/Tools/Boot/.JET-p1

Checking product custom
--------------------------------------------------------------
Check of client vm-09
-> Passed....

Boot the client off of the network

Booting the clients of the network is performed in different ways depending on which architecture your using.

On SPARC, if it’s already running an OS then you can use:

# reboot -- “ net - install”
or from the OBP prompt:
ok> boot net - install

On an x86 system you will need to reboot the host and then interrupt the boot sequence and initiate a PXE boot on the interface that you took the MAC address from to populate the Jumpstart servers /etc/ethers file.