SunOS 4 network boot howto
SunOS network boot How-To
originally published: 10-JUN-2004
This howto should explain how to set up a diskless client running SunOS 4.
What you need:
- SunOS 4 media. I assume that you have a CD-ROM, but you could probably extract the files from tapes or tape images too. I haven't tried that yet...
- a working Sun. Any box should be okay. SPARC or Sun3, maybe even Sun2, although I've never seen such a beast.
- a boot and NFS server. I guess most Unix systems will be okay. In this example the bootserver is a Sun 3/80 running SunOS 4.1.1, so the exact syntax of the configuration files might be a bit different if you use another system. You should consult your system's man pages for the exact configuration if something doesn't work.
The Sun won't have any local disk. You could add a local swap disk easily or copy the whole operating system to a local disk later, but I won't describe that here. The basic procedure would be copying the filesystems to disk with tar and installing boot blocks with installboot. The Sun and the bootserver should be connected via Ethernet. Your Sun will boot from the Server and load all it's data from the network. There are some scripts that should setup anything for you if you have a SunOS bootserver, but these scripts didn't work for me and they have certain limitations, so I did everything the old fashioned way. The server must have the following services installed:
Netbooting a Sun works like this: The client requests an IP. This request is answered by an rpc.rarpd. The rpc.bootparamd will tell the client where to mount its swap and root filesystem from. The client then loads a small boot file via tftp and then loads the kernel via NFS. After that it mounts the swap, root, /usr and /usr/kvm filesystems from the server using NFS.
unpacking the distribution:
On the SunOS CD there are all the files you need. The file "avail_arches" tells you what architectures are supported. For the rest of this text I assume that you have a simple Sun 3/60. You must probably change certain things if you have a machine of another kernel or CPU architecture. The SunOS version in this example is 4.1.1, but any other version should be okay too, as long as it supports your hardware. For a 3/60 you need to have sun3.sun3.sunos.4.1.1 in "avail_arches". For a 4/110 that would be sun4.sun4.sunos.4.1.1, for a SPARCstation 1 sun4.sun4c.sunos.4.1.1. You get the picture. In export/exec you will find all binaries. proto_root_sunos_4_1_1 is a bare root file system without any executables. Then, there are two parts of executables. The first is the /usr filesystem which only depends on the CPU type, e.g. SPARC or M68k. These things can be found in export/exec/SUN3_SUNOS_4_1_1. The other part are all files specific to the kernel architecture of a machine, e.g. sun3, sun3x, sun4, sun4c, sun4m... That's in export/exec/kvm/. There you have to choose the correct kernel architecture. In this case it's SUN3_SUNOS_4_1_1. In that directory you will find the packages.
So, now unpack the files to directories on the boot server. The usual directory structure under SunOS goes like this:
/export/exec holds the /usr filesystem in a subdir for each CPU /export/exec/kvm holds the /usr/kvm filesystem in a subdir for each kernel architecture. /export/root holds the clients root filesystem in a subdir for each client. /export/swap holds a swap file for each client
In this example I will keep to the SunOS structure, so create the directories on the server as follows:
mkdir -p /export/exec/sun3.sunos.4.1.1 mkdir -p /export/exec/kvm/sun3.sunos.4.1.1 cd /export/exec/ ln -s sun3.sunos.4.1.1 sun3 cd /export/exec/kvm/ ln -s sun3.sunos.4.1.1 sun3
Now, to unpack:
cd /export/exec/sun3.sunos.4.1.1 tar xfp /path/to/cdrom/export/exec/sun3_sunos_4_1_1/anything_there cd /export/exec/kvm/sun3.sunos.4.1.1 tar xfp /path/to/cdrom/export/exec/kvm/sun3_sunos_4_1_1/kvm tar xfp /path/to/cdrom/export/exec/kvm/sun3_sunos_4_1_1/sys
Then you need to setup the clients root filesystem:
mkdir -p /export/root/yourclient cd /export/root/yourclient tar xfp /path/to/cdrom/export/exec/proto_root_sunos_4_1_1
Then, create two mount points for /usr and /usr/kvm:
mkdir /export/root/yourclient/usr mkdir /export/exec/sun3.sunos.4.1.1/kvm
Now create the swap file. Under SunOS there is a "mkfile" program: "mkfile 64m /export/swap/yourclient". If you don't use SunOS on the bootserver you could do something like
dd if=/dev/random of=swapfile bs=lotsofblocks
A 64MB swapfile should be enough. If you have a SunOS bootserver and just want to netboot a client of the same kernel architecture you could just export /usr on the server.
So, the basic part is done now.
configuring the server
Put the client in the servers /etc/hosts.
Add the Ethernet address of your boot client to this file. If you experience problems you can set the Ethernet address on the bootserver like this:
arp -s client.test.net CC:CC:CC:CC:CC:CC temp
/etc/bootparams: yourclient root=yourserver:/export/root/yourclient\ swap=yourserver:/export/swap/yourclient
Then configure NFS:
/etc/exports: /home /var/spool/mail /export/exec /export/share /export/root/yourclient -access=yourclient,root=yourclient /export/swap/yourclient -access=yourclient,root=yourclient
Linux has a no_root_squash option that should do the same. The client needs root access to certain filesystems.
Exporting /home and /var/spool/mail is normal for a SunOS boot server with a SunOS client. That might not be right for your setup. It shouldn't hurt though.
Next thing is tftp:
Check /etc/inetd.conf that tftpd is really enabled and that /tftpboot is the directory where is loads its files from. Create /tftpboot if necessary. /tftpboot contains all files that are loadable. Mine looks like this:
server# cd /tftpboot server# ls -al total 273 drwxr-sr-x 2 root 512 May 25 09:17 . drwxr-xr-x 15 root 1024 May 25 09:29 .. lrwxrwxrwx 1 root 21 May 25 09:17 C0A8023F -> boot.sun4.sunos.4.1.4 lrwxrwxrwx 1 root 21 May 25 09:17 C0A8023F.SUN4 -> boot.sun4.sunos.4. lrwxrwxrwx 1 root 22 Mar 23 17:53 C0A8026A -> boot.sun3x.sunos.4.1.1 lrwxrwxrwx 1 root 22 Mar 23 17:53 C0A8026A.SUN3X -> boot.sun3x.sunos. lrwxrwxrwx 1 root 22 May 25 08:32 C0A8027B -> boot.sun3x.sunos.4.1.1 lrwxrwxrwx 1 root 22 May 25 08:32 C0A8027B.SUN3X -> boot.sun3x.sunos. -rwxr-xr-x 1 root 104048 Mar 23 17:46 boot.sun3x.sunos.4.1.1 -rwxr-xr-x 1 root 140904 May 25 09:11 boot.sun4.sunos.4.1.4 lrwxrwxrwx 1 root 1 Mar 23 17:27 tftpboot -> .
You can find the boot.sun3.sunos.4.1.1 in the /usr/kvm directory you unpacked before. It's /export/exec/kvm/sun3.sunos.4.1.1/stand/boot.sun3. copy that to /tftpboot and rename it to boot.sun3.sunos.4.1.1. You need to link that file to those hexadecimal names. These names are computed like that: The four parts of an IP address are translated into hex:
192.168.2.63 192 -> C0 168 -> A8 2 -> 02 63 -> 3F
You can use bc to compute this:
bc enter "obase=16" enter "192" and bc will print C0
cd /tftpboot ln -s boot.sun3.sunos.4.1.1 C0A8023F ln -s boot.sun3.sunos.4.1.1 C0A8023F.SUN3
Some Suns need the suffix with the kernel architecture, some don't.
After that you should be done with the server. Now go on to the client.
Configuring the client:
You need to configure the client's root filesystem. Create all /dev files:
cd /export/root/yourclient/dev ./MAKEDEV std
Depending on the machine this will take some time. You are running a SunOS shellscript, so it might be that it won't work. Right now, I have no workaround at hand if it doesn't work. Good luck!
Then, customize the client's /etc/fstab:
/export/root/yourclient/etc/fstab: server:/export/root/yourclient / nfs rw 0 0 server:/export/exec/sun3.sunos.4.1.1 /usr nfs ro 0 0 server:/export/exec/kvm/sun3.sunos.4.1.1 /usr/kvm nfs ro 0 0 server:/home /home nfs rw 0 0 server:/var/spool/mail /var/spool/mail nfs rw 0 0
Put the server and the client in the client's /etc/hosts.
Now, copy some essential binaries in the client's root filesystem.
cp /export/exec/kvm/sun3.sunos.4.1.1/boot/* /export/root/yourclient/sbin/ cp /export/exec/sun3.sunos.4.1.1/bin/sh /export/root/yourclient/sbin/ cp /export/exec/sun3.sunos.4.1.1/bin/hostname /export/root/yourclient/sbin/
It should finally look like this:
server# pwd /export/root/youclient/sbin server# ls -al total 743 drwxr-sr-x 2 root 512 May 25 10:20 . drwxr-sr-x 11 root 512 May 25 10:34 .. -rwxr-xr-x 1 root 147456 May 25 09:38 hostconfig -rwxr-xr-x 1 root 21080 May 25 10:20 hostname -rwxr-xr-x 1 root 180224 May 25 09:38 ifconfig -rwxr-xr-x 1 root 65536 May 25 09:38 init -rwxr-xr-x 1 root 32768 May 25 09:38 intr -rwxr-xr-x 1 root 172032 May 25 09:38 mount -rwxr-xr-x 1 root 106496 May 25 09:39 sh
(un)configuring NIS / YP
Then let's care for a really odd thing. SunOS normally expects to use NIS. I don't want NIS and without an NIS server the new bootclient will hang. So:
mv /export/root/yourclient/var/yp /export/root/yourclient/var/yp.save
Of course NIS can be nice if you have many machines that really use it, but that's up to you then. I don't know much about NIS, so I won't write any explanations on how to configure it. Peter Koch has written something about NIS and SunOS 4: http://www.sun3zoo.de/en/yp.html
configuring the client's network interface
Another network thing to configure is the Ethernet port. Create a file /export/root/yourclient/etc/hostname.le0 with the clients hostname. A 3/60 has Lance Ethernet which is le0. A 4/110 has the older Intel Ethernet which would be ie0. If you're done start up the client and boot from the net at the > prompt:
It should now boot up into multi user mode and you can login as root (no password).
You could now install SunOS patches, but remember that the /usr and /usr/kvm are exported read-only. You should install patches directly on the bootserver. happy hacking! :-)