Friday, August 26, 2011

Using AI to do an unaided install on OpenIndiana b148

If you have any questions, comments, concerns, corrections, etc, feel free to email me. I'd love to know what I did horribly wrong. :)

So, I was looking into how to automatically install OpenIndiana on systems in a manner similar to the Kickstart mechanism for RHEL-alikes or Jumpstart for Solaris proper.

I received instructions that I should not go down this road unless I enjoyed pain and suffering.

I got it working anyway, so here's how so you can too (without having OpenIndiana or any Solaris system already running).

I started out with the instructions found here. His instructions were very helpful, but ultimately, they were incomplete - whether this is because of differences in version or something else, I do not know.

Start out as his instructions do - make an /export/install (or your favorite path; i'll refer to it as $INSTALL_BASE from here on), and run
git clone git://github.com/rincebrain/illumos-misc.git $INSTALL_BASE
(I forked his repository. At present, my changes are mostly cosmetic, though I changed the root p/w in the generated ai_instance to be "jack" as well. Feel free to pull his repo instead; things may just require more tweaking.)

You're going to need

  • an Apache-like webserver (you need CGI support for the scripts in the above, and you'll ideally be using it to serve a local mirror of the OpenIndiana repo as well.)
  • A working DHCP setup with PXE capability, which includes
  • The ability to serve a couple of files over TFTP (I'm going to refer to the base of your TFTP path as $TFTP_BASE - for me, that's /tftproot; YMMV)
  • About 4 GB for an OI local package repo, according to my current copy
  • An OpenIndiana Automated Installer CD (in Joshua's guide above, he explains how to make one; since then, OI has started providing prebuilt ones, so I used the b148 CD available here)
  • The CGI scripts in this example use /bin/ksh - you can probably use another shell with them with not too much work, but I didn't need to.
Got everything mentioned above? Great.

First, loopback mount the OI CD you grabbed above somewhere - I'll use $INSTALL_ BASE/ai_image, like the guide I'm basing this on did, and copy the required boot files off into a convenient place to serve them (I used $TFTP_BASE/oi):
cp -r $INSTALL_BASE/ai_image/boot $TFTP_BASE/oi
As I said, you'd also probably like a local OI package repo - it'll save you a fair amount of time on install.

I'm making one at $INSTALL_BASE/repo - again, feel free to change it and change instructions appropriately. :)
rsync -a pkg-origin.openindiana.org::pkgdepot-dev $INSTALL_BASE/repo/
Configure Apache with vhost directives appropriately to serve this up - the example would be here, and that'll work if you've used all of the paths mentioned in this example. Feel find/replace /export/install with whatever you used for $INSTALL_BASE instead, but be sure to do it consistently here and in PXEgrub (later).

Now the most customization you'll probably want to do - the Automated Installer manifest file.

Joshua has nicely provided a CGI script which serves up the manifest to our target machine. My modifications do a few things - they add git to the default installed package list (NBD), make it diff more cleanly against the stock example (which was helpful to me for debugging), and most importantly, in my opinion, makes it partition and install to the root disk:

    <target>
         <target_device>
          <disk>
<disk_keyword key="boot_disk" />
          <partition name="1" action="delete" />
          <partition name="2" action="delete" />
          <partition name="3" action="delete" />
          <partition name="4" action="delete" />
<partition name="0" action="create" part_type="191" />
<slice name="0" action="create" is_root="true" force="true" />
        </disk>
  </target_device>

</target> 
As a warning, it forcibly nukes the partitions on the existing disk that it detects as the "boot disk" (caveat: some BIOSes lie, and you'll need to provide more explicit criteria - warning, the syntax on things that aren't just disk specification have changed, so their fuller examples won't work for you), and creates a single full-disk slice as root, which AI then defaults to using as the root for rpool.

Configure your DHCP daemon like so (this is for dhcpd; if you use something else and have the correct syntax, by all means)

# before any shared-network or similar statements; e.g. the first few lines
option grubmenu code 150 = text;
# Inside of whatever group or shared-network or similar "set" that you want this to apply to:
if exists dhcp-parameter-request-list {
       option dhcp-parameter-request-list = concat(option dhcp-parameter-request-list,96);
}
# And now an example host:
host nosuch1 {
   hardware ethernet 00:11:22:33:44:55;
   fixed-address nosuch1;
   next-server whatever_dhcp_server_does_tftp;
   filename "oi/grub/pxegrub";
   option grubmenu "oi/menu.lst"; 
}

And now all you need to do is boot it, and wait!

Errata and oddities:
- On the system I did this on (a Dell R815), the BMC would drop and entirely stop responding on the network once the OI kernel started. Someone suggested this was fastreboot's fault, but this happens on a cold boot of the network install too, not just fastreboot.
- I did not figure out how to make it such that it would automagically reconfigure to not network install on reboot, so either manually force a PXEboot on the machine and have your root disk higher in boot order (ugh) or edit the file it gets on PXE to produce a "boot to first hard drive" response (either PXEgrub with boot first hard drive chainloader, or just remove its PXE response entirely).
- If your webserver is not running correctly or your manifest is incorrect, and you have the console redirected using console=, NO OTHER DISPLAYS WILL RECEIVE NOTIFICATION THAT IT FAILED - they will just print "...................." and never progress to the "OpenIndiana oi_148 ..." banner.
- My example configuration has livessh=enable on the boot line, allowing you to remotely SSH in using jack - you probably want to disable this once you're sure the installation is working, or at least change the password. :)


Finally
Thanks to everyone in #openindiana who put up with my uninformed questions and occasional ranting, and to Joshua Clulow for doing most of the hard work required. :)

No comments:

Post a Comment