Friday, January 23, 2009

Build a DVD Jumpstart image for SXCE/Nevada (OpenSolaris)

I have had a lot of trouble recently getting Jumpstart to work with no PXE server with SXCE/Nevada. The last time I got it to work was with Solaris Express B90 (when Sun releases it)

I need to update my lab of Desktops to a newer version so I decided to build my own DVD with Jumpstart built in. I think at the moment the OpenSolaris/Indiana release does not make this procedure possible, so sticking with SXCE.

This solution is not perfect but it works!

The procedure is:
  1. Obtain the latest iso version
  2. Copy iso to a disk for editing
  3. Extract the mini boot for editing
  4. Replace original sysidcfg with your version
  5. Rebuild miniboot
  6. Edit grub menu
  7. Add your jumpstart features (Packages, Scripts, etc)
  8. Rebuild iso image
  9. Write iso image to DVD

Step by step guide

1. Obtain the latest Nevada/SXCE iso version (or even Solaris)

2. Copy iso to a disk for editing
  • Need to mount the ISO (i.e. sol-nv-b105-x86-dvd.iso)
  • Then copy contents to some where on your hard disk
# lofiadm -a /export/iso/sol-nv-b105-x86-dvd.iso
# mount -o ro -F hsfs -o ro /dev/lofi/1 /mnt
# mkdir /export/dvd
# cd /mnt
# find . -depth -print | cpio -pdm /export/dvd

3. Extract the mini boot for editing
# gzcat /export/dvd/boot/x86.miniroot > /var/tmp/bootfile
# lofiadm -a /var/tmp/bootfile
# mkdir /tmp/bootfile
# mount /dev/lofi/2 /tmp/bootfile
# ls /tmp/bootfile
a cdrom etc mnt proc sbin ....

4. Replace original sysidcfg with your version
  • My sysidcfg setups ldap, root password, etc...
# cd /tmp/bootfile/etc
# rm sysidcfg
# cat > sysidcfg
network_interface=e1000g0 {primary dhcp protocol_ipv6=no}
name_service=LDAP { profile=default profile_server=193.xx.yy.zz proxy_dn="cn=proxyagent,ou=profile,dc=dcs,dc=bbk,dc=ac,dc=uk" proxy_password="PLAIN TEXT PASSWORD"}
root_password="Encrypted Password"
# cd /var/tmp

5. Rebuild miniboot
# umount /tmp/bootfile
# lofiadm -d /dev/lofi/2
# gzip /var/tmp/bootfile
# mv /var/tmp/bootfile.gz /export/dvd/boot/x86.miniroot

6. Edit grub menu
  • Need to add the install option so that performs a hands-off Jumpstart install
  • I have also added another item so that the default is to boot off the disk. i.e. it will not do a install unless you pick Jumpstart items
  • I have also altered it so that it gets the jumpstart scripts from a tar file on the web server
  • edit /export/dvd/boot/grub/menu.lst so it looks like
min_mem64 1024
title Boot From Disk
    rootnoverify (hd0)
    chainloader +1
title Custom Jumpstart
    kernel /boot/platform/i86pc/kernel/unix - install -B install_media=cdrom
    module /boot/x86.miniroot

7. Add your Jumpstart features (Packages, Scripts, etc)
  • With any luck you have this already otherwise please see the Sun docs
  • Basically I have some extra packages (/opt/sfw and some scripts which alter system files)
  • Tar the whole directory and place it on web server
  • Copy any packages to the DVD if required
# cd /export/jumpstart
# tar cf /opt/htdocs/solaris/config.tar .
# cp -rp /export/ExtraPackages /export/dvd

8. Rebuild ISO image
  • Now we have our new grub menu
  • New miniroot
  • Extra Packages on the DVD
  • Now we need to create the ISO
  • You may get some warnings out filename conversions, which I have not solved yet, but I do not use these packages so it is OK.
/usr/bin/mkisofs -d -D -J -l -r -U -relaxed-filenames -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -c .catalog -V "OpenSolaris" -o /var/tmp/output.iso /export/dvd

Using TopicSelectors$Subscri000.class for /var/tmp/dvd/Solaris_11/Produc/SUNWiqdoc/reloc/usr/demo/imq/jm/TopicSelectors$Subscriber$MultipleListener.class (TopicSelectors$Subscriber.class)

1.85% done, estimate finish Thu Jan 15 16:43:42 2009
Size of boot image is 4 sectors -> No emulation
1.43% done, estimate finish Thu Jan 15 11:08:14 2009
99.78% done, estimate finish Thu Jan 15 11:15:08 2009
Total translation table size: 2048
Total rockridge attributes bytes: 4369317
Total directory bytes: 23724032
Path table size(bytes): 185830
Max brk space used 23da000
1753844 extents written (3425 MB)

9. Write iso image to DVD
# cdrw -i /var/tmp/output.iso

That is it folks.

Creating OpenSolaris USB Sticks Is Easy
reating a Customized Boot CD/DVD for the Solaris Operating System for x86 Platforms