SunOS 4.0.3c Diskless Installation Guide

Overview

This article documents how to setup a diskless SunOS 4.0.3c 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.

The server must have the following services available.

  1. TFTP

  2. 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.

  3. 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.

  1. FTP

  2. telnet

  3. rlogin

  4. rsh

  5. rexec

  6. time

The rdate command is executed by default when SunOS 4.0.3c 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.

Network Setup

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.

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.

Server Setup

A full installation of SunOS 4.0.3c is about 85MB. 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)

Client Setup

Currently. the only available version of SunOS 4.0.3c is a set of floppy disks images. For reference, the set of images from Tenox's Archive. The images have a specific format that is detailed on the halfmanhalftaco.com website. The following scripts and data files can be used to extract the compressed tar files that make up each SunOS 4.0.3c install bundle like games, demo, or debugging.

SunOS 4.0.3c was only released for the sun4c architecture, so sun4c is hardcoded below.

  1. Dump all the sunos disk images into a single large image file.

./dump.sh

dump.sh contents

list=$(seq 1 19)

for x in $list

do

dd if=../sunosdisk${x}.img bs=512 count=2844 >> all.img

done

  1. Create a file called map.txt with the following contents. The first column is the name, the second is the number of 512-byte blocks, and the 3rd is the starting position of the bundle file in the all.img file.

map.txt

root.tar.Z      100     0

usr.tar.Z       16941   100

Kvm.tar.Z       2351    17041

Install.tar.Z   1134    19392

Sys.tar.Z       3052    20526

Networking.tar.Z        841     23578

Debugging.tar.Z 2274    24419

SunView_Users.tar.Z     1291    26693

SunView_Programmers.tar.Z       1445    27984

SunView_Demo.tar.Z      438     29429

Text.tar.Z      707     29867

User_Diag.tar.Z 1352    30574

SunCore.tar.Z   1561    31926

uucp.tar.Z      178     33487

System_V.tar.Z  3834    33665

Manual.tar.Z    4356    37499

Demo.tar.Z      1664    41855

Games.tar.Z     3135    43519

Versatec.tar.Z  4674    46654

Security.tar.Z  191     51328
  1. Extract out all of the .tar.Z bundles

./create_tar_z.sh

  1. 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 root.tar.Z

    cd /home/client/usr

  2. Install the common OS packages.

    list=$(ls *.tar.Z | egrep -v '(Kvm)')

    for x in $list

    do

    tar -xpf $x

    done

    tar -xpf /cdrom/export/share/sunos_4_1_4/manual

  3. Install the kvm package.

    cd kvm

    tar -xpf Kvm

  4. Edit the etc/hosts file.

    cd ../../

    cat << EOF >> ./etc/hosts

    172.16.1.1 server

    172.16.1.22 client

    EOF

  5. 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 ..

  6. Setup /etc/fstab.

    echo 'server:/home/client/ / nfs rw 0 0' > etc/fstab

  7. Copy critical files to sbin.

    cp usr/kvm/boot/* sbin

    cp usr/bin/hostname sbin

  8. Copy in a SunOS 4.1 kernel. The default kernel in SunOS 4.0.3c is hard coded to only boot from a local hard disk. The SunOS 4.1 Diskless Installation Guide can be used to pull out this kernel file. The SunOS 4.1 kernel is used to compile a diskless SunOS 4.0.3c kernel.

    mkdir sunos41

    cd sunos41

    tar xvpf sunos41_kvm.tar.Z

    cp usr/kvm/stand/vmunix ../vmunix

  9. Copy the bootloader to /tftpboot.

    cp usr/kvm/stand/boot.sun4c /tftpboot

  10. 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.

  11. Using the hexnumbers, make a symlink or copy the boot.sun4 file to it.

    cd /tftpboot

    ln -s boot.sun4c AC100116.SUN4C OR cp boot.sun4c AC100116.SUN4C

  12. Copy in any relevant patches or fixes into the /home/client directory and unpack them so that they be worked in the next section.

  13. Boot to Single User Mode so that you can recompile the kernel.

    boot net -s

  14. Compile a new kernel. For diskless clients, the DL (Diskless) config is useful. Due to the differences in the 4.1 kernel, newvers.sh will not run correctly, so the output of the file will need to created by hand or run under the boot server.

    cd /sys/`arch -k`/conf

    config DL

    cd ../DL

    Run these next two commands on the boot server itself

    /home/client/usr/share/sys/sun4c/DL60

    ../../conf.common/newvers.sh

    Run the rest on the SunOS 4.0.3c machine

    make

    cp /vmunix /vmunix.414

    cp vmunix /vmunix

    reboot

  15. After this, you can apply patches in single user mode as you normally would.