This article documents how to setup a diskless SunOS 4.1 machine. It also documents several issues that will come up due to various reasons. These are noticed as the procedure encounters them.
The boot server uses NetBSD 9.2, which is current as of this writing (October 2021). It uses LVM to contain each client in its own logical volume. This allows you to keep a client within the limits of SunOS 4's filesystem reporting limits. This is 2 GB by default and can be extended a bigfs fix.
The bigfs fix is available at tcp4me.com/code/bigfs.tar.gz
The server must have the following services available.
TFTP
bootparamd. If the boot server is multi-homed (multiple IP addresses), add the -r option to the bootparams options (e.g bootparamd -s ) so that the traffic is routed properly. This causes unusual errors in Solaris and may come up in SunOS.
NFS v2/v3
You can enable the following services so that the diskless client can interact more with the server. SunOS 4 predates SSH. These plain text protocols can be used on a trusted network.
FTP
telnet
rlogin
rsh
rexec
time
The rdate command is executed by default when SunOS 4.1 is booted. Rdate uses the time protocol, which will overflow on Februrary 7. 2036. If you plan on using rdate after that date, set the boot server's date to somewhere before this. Due to Y2K and other date issues, use dates in the 1980s through 1990s.
SunOS 4 predates the use of classless routing (CIDR), which means that care has to be taken when setting up clients on a modern network. Even with a CIDR fix, SunOS 4 will have issues booting if the network configuration is not what it is expecting. A disk install of SunOS with the CIDR fix will work on modern networks, but will fail on diskless clients. This is because the bootparam client would have be updated to accept a custom netmask.
Wikipedia's entry on Classful Networking provides a table of which networks had which subnet masks. RFC1918 networks (10/8, 172.16/12, and 192.168/16) should use the following network masks.
10/8 - 255.0.0.0 (/8)
172.16/12 - 255.255.0.0 (/16)
192.168/16 - 255.255.255.0 (/24)
In my case, I have a preexisting network of 192.168.1.1/16, which made the bootparam client have issues because it hard coded itself to a /24 network. The fix was to use the 172.16 network for my diskless clients and setup the NFS/TFTP/bootparamd server and other devices with a 172.16/16 address alias.
A full installation of SunOS 4.1.4 is about 200MB. The Sun recommended setup with shared read-only fileystems maximized available space through symbolic linking and common mount points.
The full client used here uses more disk space, but these sizes are negligible on modern hard drives.
The boot server puts the filesystem for each client under its own directory.
/home/client1
/home/client2
/etc/exports
echo '/home/client -alldirs -maproot=root' >> /etc/exports
/etc/bootparams
echo 'client root=server:/home/client swap=server:/home/client/swap gateway=server:0xffff0000' >> /etc/bootparams
/etc/ethers
echo '*mac_address* *client*' >> /etc/ethers
/etc/inetd
uncomment out tftpd (optionally telnet,ftp, rsh,rlogin, exec, time, etc)
Mount the SunOS 4.1 ISO. You can also use the tape files, but will need change the commands below.
mount /dev/vnd0a /cdrom
Setup the client's root filesystem and swap file.
cd /home/client
dd if=/dev/zero of=swap bs=32m count=1
mkdir -p usr/kvm
tar -xvpf /cdrom/export/exec/proto_root_sunos_4_1_4
cd /home/client/usr
Install the common OS packages.
for x in /cdrom/export/exec/sun4_sunos_4_1_4/*
do
tar -xpf $x
done
tar -xpf /cdrom/export/share/sunos_4_1_4/manual
Install the architecture specific packages. sun4c is used here. The other options are sun4 (original SPARC 4/XXX devices) or sun4m. Consult the Sun Hardware Reference for your device if you are unsure. If the wrong architecture is installed, certain commands will cause a kernel panic.
cd kvm
tar -xpf /cdrom/export/exec/kvm/sun4c_sunos_4_1_4/kvm
tar -xpf /cdrom/export/exec/kvm/sun4c_sunos_4_1_4/sys
Edit the etc/hosts file.
cd ../../
cat << EOF >> ./etc/hosts
172.16.1.1 server
172.16.1.22 client
EOF
Create the /dev entries. The pty0 line is needed in order to login remotely to the machine.
cd dev
sed -i 's|^PATH=|PATH=/sbin:|g' MAKEDEV
./MAKEDEV std
./MAKEDEV pty0
./MAKEDEV win
cd ..
Setup /etc/fstab. The /tmp filesystem is need because socket files created on NFS file systems will not work correctly. This causes errors when starting OpenWindows, X11, or applications that put socket files in /tmp. Make sure to remove the # before mount /tmp in etc/rc.local so that /tmp will be mounted correctly.
echo 'server:/home/client/ / nfs rw 0 0' > etc/fstab
echo 'server:/home/client/usr /usr nfs rw 0 0' >> etc/fstab
echo 'swap /tmp tmp rw 0 0' >> etc/fstab
Copy critical files to sbin and the kernel to the root directory
cp usr/kvm/boot/* sbin
cp usr/kvm/stand/sh sbin
cp usr/bin/hostname sbin
cp usr/kvm/stand/vmunix .
Copy the bootloader to /tftpboot. As before, this file is architecture-specific.
cp usr/kvm/stand/boot.sun4c /tftpboot
Calculate the hex number for the client's IP address using the bc command. The decimal is given in bold and the hex is in italics.
obase=16
172
AC
16
10
1
1
22
16
Press Control-D to quit out of bc.
Using the hexnumbers, make a symlink or copy the boot.sun4
cd /tftpboot
ln -s boot.sun4c AC100116.SUN4C OR cp boot.sun4c AC100116.SUN4C
Copy in any relevant patches or fixes into the /home/client directory and unpack them so that they be worked in the next section.
Boot to Single User Mode so that you can apply pathes and recompile the kernel.
boot net -s
Apply the NFS Jumbo Patch 102394. The number after the - is a revision, so any version can be used. The instructions are provided in the README.
Apply any other patches as needed.
Compile a new kernel. For diskless clients, the DS (Diskless) config is useful. Make sure that the tmpfs device is configured in the kernel as well.
cd /sys/`arch -k`/conf
config DS
cd ../DS
make
cp /vmunix /vmunix.save
cp vmunix /vmunix
reboot