HOWTO: Network install OpenBSD/Sparc 3.9 from a Linux server

Matt Housh (jaeger at morpheus dot net)

Last edited: 09.28.2006 13:18

Overview:

I have a Sparc LX workstation (50MHz RISC, 96M RAM, 1M VSIMM, 9G HD) sitting around that I wanted to make use of and picked OpenBSD for no particular reason. The current sparc release is 3.9 and what follows is a description of the steps necessary to boot the installer over the net using rarpd, tftp-hpa, and netkit-bootparamd. If you've got an external SCSI CD-ROM available it's less work to install via that, but for those of us who want to know, here's the hard way.

My linux "server" for this howto is a desktop running CRUX 2.2. The distribution doesn't matter, the software used should be installable and usable on just about any other distribution as well. If you're using crux, you can get the ports I use for rarpd, tftp-hpa, and netkit-bootparamd here. The rarpd package depends on libpcap from contrib and libnet-deprecated from the aforementioned link. If you're using another distro, install the packages from its package repositories or from source, either way should be fine.

Steps summary:

These are the basic steps required to netboot the openbsd installer:
(Click the anchor number to the left to be taken directly to the corresponding step.)

[1] Install and configure the reverse ARP daemon (rarpd)
[2] Install and configure the trivial FTP daemon (tftp-hpa)
[3] Install and configure the boot parameter daemon (bootparamd)
[4] Install and configure the NFS server and openbsd kernel
[5] Configure hosts file (/etc/hosts)
[6] Configure tcp_wrappers (distribution-centric)
[7] Configure and boot the sparc

Detailed Steps:

[1] Install and configure the reverse ARP daemon (rarpd)

Install rarpd (in this case, using prt-get depinst rarpd) - once done, configure it by creating and populating the /etc/ethers file. This file contains lines with MAC addresses and hostnames on them, like so:

# /etc/ethers file

08:00:20:04:90:F2 windowlicker

The above simply indicates that the machine with MAC address 08:00:20:04:90:F2 should be associated with the hostname "windowlicker". The rarpd program will use this file to assign a hostname to the sparc when it issues a request using its MAC address. If you need to netboot multiple machines, simply add corresponding lines to /etc/ethers for each of them.

Once /etc/ethers is set up, start the RARP daemon like so:

root# rarpd -v -d

The -v option tells rarpd to be verbose and the -d option enables debug mode. This can be useful if you're trying to troubleshoot a net boot and you think the problem lies with rarpd. The RARP daemon will background itself and its messages will go to syslog by default.

[2] Install and configure the trivial FTP daemon (tftp-hpa)

Install tftp-hpa (for crux, prt-get install tftp-hpa) - when that's done, configuration consists of creating a tftpboot location and placing the appropriate boot image there:

root# mkdir /tftpboot
root# cd /tftpboot/
root# ln -s . tftpboot
root# wget ftp://ftp.openbsd.org/pub/OpenBSD/3.9/sparc/boot.net
root# ln -s boot.net <IP ADDRESS IN HEX>.<ARCH>

This requires a bit of explanation. First off, the default location for tftp boot image serving is /tftpboot/. If you want to use a different one you can, this is simply a common location. After creating it, we make a symlink inside it to itself with the same name. The reason for this is that some clients will request /tftpboot/<whatever-file> when booting via the network. When we run tftp-hpa we run it with the -s /tftpboot/ option which switches its root directory to /tftpboot/ (similar to chroot) when it starts up, for security reasons. We create the symlink inside /tftpboot/ so that clients can still request files like /tftpboot/<whatever-file>. If you use a different location for tftp to serve its files, you should still name the symlink "tftpboot". This isn't really required for booting the sparc but it won't hurt to have it there if you're booting other systems.

As for the symlink to boot.net, the sparc doesn't request boot.net when it tries to get its boot image via tftp. It will request a filename tailored to its network status and architecture. This makes it easy to use the same boot image for multiple boots or a different one via symlinks to the real images. The filename it requests consists of the client IP address converted to hexadecimal with the architecture appended to it with a ".". In this case, we'll use the following:

IP of the client: 192.168.1.100
Architecture: SUN4M (this is correct for the LX, check google or sun's documentation for info about others)

In hex: 192 = C0, 168 = A8, 1 = 01, 100 = 64

So the filename will end up being C0A80164.SUN4M. Create the link to boot.net with that name:

root# ln -s boot.net C0A80164.SUN4M

With the tftp location set up, start the daemon like so:

root# in.tftpd -l -v -s /tftpboot/

The -l option tells in.tftpd to run in standalone mode instead of being controlled by inetd. You can run it from inetd if you like but I won't detail that. The -v option tells it to log verbosely, similar to the rarpd -v option above. The -s /tftpboot/ option tells the daemon to switch its root directory to /tftpboot/ on startup for security reasons. Change this if you used a different location. in.tftpd will fork into the background like rarpd did.

[3] Install and configure the boot parameter daemon (bootparamd)

Install netkit-bootparamd (for crux, prt-get install netkit-bootparamd) - when it's installed, configuration entails creation of the /etc/bootparams file with simple lines containing a record for the client to be configured via the boot parameter daemon containing the settings to be used to load the installer kernel/image via the network. The configuration looks like this:

# /etc/bootparams

<client hostname> root=<nfs server ip>:/path/to/kernel/via/nfs gateway=<router/gateway ip>:<netmask in hex>

This should be pretty self-explanatory. For this example, with an NFS server at 192.168.1.50, the client windowlicker, a gateway/router at 192.168.1.1, and a netmask of 255.255.255.0 (class C), the line should look like this:

windowlicker root=192.168.1.50:/exports/openbsd/3.9/sparc gateway=192.168.1.1:0xffffff00

Once the bootparams file is ready, start rpc.bootparamd with the following command. rpc.bootparamd doesn't fork into the background like rarpd or in.tftpd, so you'll need to leave the terminal open, run it in screen, or background if yourself.

root# rpc.bootparamd -d

The -d option to rpc.bootparamd will send debug information to syslog, again useful for troubleshooting when you think bootparamd is the problem.

[4] Install and configure the NFS server and openbsd kernel

Once the sparc has loaded its boot loader image (boot.net) from the tftp server, it requests configuration info from the boot parameter daemon. Using the information it receives from bootparamd, it attemps to load a kernel. This is where the NFS server comes in. In the bootparams file above, we told the sparc to look in /exports/openbsd/3.9/sparc for its kernel. We didn't specify a filename, just the path. The filename comes in later. So, we need to set up the NFS root and export it:

Install the nfs-utils (for crux, prt-get install portmap nfs-utils) package and start the portmap and nfs services (for crux, add portmap and nfsserver to SERVICES in /etc/rc.conf and reboot or start them manually.) Once installed, we create the NFS root, place the openbsd kernel there, and configure the /etc/exports file to allow the client to mount it via NFS:

root# mkdir -p /exports/openbsd/3.9/sparc
root# cd /exports/openbsd/3.9/sparc/
root# wget ftp://ftp.openbsd.org/pub/OpenBSD/3.9/sparc/bsd.rd

The above commands simply create the NFS root (the same as we set above in /etc/bootparams, they need to match) and download the openbsd bsd.rd ramdisk kernel to the created NFS root. The normal bsd kernel assumes you're booting a live system from NFS instead of the installer, so the ramdisk kernel is needed. The /etc/exports file is then configured like so:

# /etc/exports

/exports/openbsd/3.9/sparc windowlicker(ro,sync)

There are many options that can be used in the exports file, I won't detail them here. Check the exports man page if you want more info. The above should be sufficient to export the aforementioned NFS root to the client named "windowlicker" in read-only mode.

Use the exportfs command to make the nfs daemon reread the exports file like so:

root# exportfs -vr

[5] Configure hosts file (/etc/hosts)

In order to avoid complications with hostname lookups I recommend adding the client to the server's /etc/hosts file. This may not be required if the client exists in DNS and both client and server can make use of it. However, to be safe, we add it:

# /etc/hosts

192.168.1.100 windowlicker

[6] Configure tcp_wrappers (distribution-centric)

If your distribution uses tcp_wrappers you can assure that the various requests the client makes to the server will be allowed by adding exceptions to the /etc/hosts.allow file. Many distributions support tcp_wrappers but DO NOT deny everything by default. If your distribution behaves this way the following is likely unnecessary. However, for the sake of completeness and because crux does deny by default, we add the following lines to /etc/hosts.allow:

# /etc/hosts.allow

portmap: 192.168.1.100
mountd: 192.168.1.100
in.tftpd: 192.168.1.100

This should be fairly obvious in that it allows access to the listed services to the IP of the client machine. The portmap and mountd lines are for NFS, the in.tftpd line for tftp-hpa. The boot parameter daemon doesn't use tcp_wrappers and thus has no corresponding line.

[7] Configure and boot the sparc

At this point the majority of the work is done! Boot the sparc into the PROM, hit STOP-A if it's set to automagically boot somewhere else, and type boot net bsd.rd to make the little bugger starting talking to the server. If all goes well, the bsd.rd kernel will load up and you'll be prompted with the openbsd choice of Install, Upgrade, or Shell. Happy installing! If your sparc is too old to understand the boot net command, try boot le(). If they both fail, you may have to set up an nvram alias to the device of your choice or do some googling to see if there's an alternate command used to boot via the network interface. As an example, here's what I did to make my sparc install from the add-in SBUS 100Mbit ethernet/scsi card (hme) instead of the onboard 10Mbit interface (le):

nvalias net-hme /iommu/sbus/SUNW,hme
boot net-hme bsd.rd

Valid XHTML 1.1! Valid CSS!