Next Previous Contents

7. NFS booting

This chapter describes how a NetWinder drive can be updated by NFS booting the system from a remote host. This is the most flexible way to update a NetWinder, and it is also (perhaps) the most tricky one to set up for novices.

7.1 Requirements

This method requires a second computer which will act as the boot server for the NetWinder. This server must support NFS and TFTP services, and an ethernet connection of course. It must also have lots of disk space, enough to hold a compressed and an uncompressed version of the NetWinder disk image.

The NetWinder in this case needs 2.0 firmware or better, and everything else is negotiable. Since the NetWinder will boot from the server, you can safely format the NetWinder's hard disk and install a new diskimage onto it. Therefore you only need enough room to hold the uncompressed image (so it will even work for the 810 Meg drives).

7.2 Server preparation

The server needs to be configured so that it can provide a kernel via TFTP, and a root filesystem via NFS for the NetWinder. The examples that follow are written for a PC running RedHat Linux. Things should be pretty similar for most other unix-like operating systems, but I can't possibly list all the different systems.

It is possible to use a second NetWinder as the boot server. The only thing to watch out for is that the tftp daemon that's shipped on all disk images up to #14 suffers from an alignment bug, and therefore doesn't work. The symptoms include an error message about "GAL tftp operation". The fix is pretty simple: arpa/tftp.h must be fixed, then tftpd must be rebuilt.

For simplicity, the following examples assume static IP addresses for both the NetWinder and the rescue server. It is possible to use DHCP, and if you plan on NFS booting many NetWinders, it is even a good idea. However, to improve your chances of actually getting this proceedure to work, the topic of DHCP is left out here.

Preparing /nwroot

Begin by unpacking the NetWinder diskimage tarball on your server. Create a directory called nwroot (or other name if you prefer) in the filesystem root. If you don't have room to unpack the image there, you can put the directory elsewhere and make a symbolic link.

        mkdir /nwroot
        cd /nwroot
        tar zxpf /path/to/YourImage.tar.gz

The fstab file in the image must be updated to match the way this image will be booted. Therefore, edit /nwroot/etc/fstab and comment out all the lines that begin with /dev/hdaX. Then add a line as follows, but replace the IP address with the server's actual IP address:   /       nfs     defaults        0 0

Save the file and your /nwroot will be ready for action.

Notes for kernel 2.2.x and beyond: Upon booting you may encounter the message `Unable to open initial console' if using the older rescue packages or disk images. If this happens, the solution is to create a /dev/console entry (major 5, minor 1) in your NFS image. Alternatively, you can create a symbolic link from /dev/console to /dev/tty0.

Setting NFS exports

The nwroot directory now needs to be exported so that the NetWinder can boot from it. I'll assume the NetWinder's IP address to be, substitute your real address. On the server, edit (or create) /etc/exports so it contains the following line:


Restart the NFS service, so that the changes take effect. On RedHat systems, the command would be:

        /etc/rc.d/init.d/nfs restart

If this causes trouble, ensure that you installed NFS server support in the first place. Additional RPM's might need to be installed. For NFS server support you need the programs portmap, rpc.mountd and rpc.nfsd (and maybe others too..).

Setting up TFTP booting

The server needs to support the TFTP protocol, since the NetWinder will try to get a kernel using this method. Normally, a special directory would be reserved for storing the files to be sent by TFTP. However it's simpler in this case to use the boot directory in the NetWinder disk image, since it already contains the kernels (no point in making additional copies).

To enable the tftp service, it needs to be added to the /etc/inetd.conf file. Most systems will already have an entry for it, probably commented out though. In any case, make sure there is an un-commmented line that reads:

        tftp  dgram  udp  wait  root /usr/sbin/tcpd in.tftpd /nwroot/boot

Note in particular that the directory has been specified as the last argument. This means that when processing a tftp request for a file, the server will look in that directory. To effectuate the changes, the inetd process must be sent a SIGHUP. On a RedHat system this can be accomplished with the following command.

        killall -HUP inetd

In principle, your server should now be ready.

7.3 NetWinder diskless boot

The NetWinder will now be booted from the server. Turn on the NetWinder's power (or reboot it if it was running) and interrupt the boot process at the `Press any key to abort autoboot' prompt. Now the settings for diskless booting need to be adjusted in the firmware. The first thing to do is to assign an IP address and netmask for the NetWinder.

        setenv netconfig_eth0 flash
        setenv eth0_ip

Naturally you should put in the NetWinder's real IP address and netmask value. The next step is to configure the firmware so that it will fetch the kernel from the server, instead of reading it from the local hard disk:

        setenv kernconfig tftp
        setenv kerntftpserver
        setenv kerntftpfile vmlinux

Substitute the server's IP address above. Finally, the firwmare is told to use the NFS exported directory as the root filesystem.

        setenv rootconfig nfs
        setenv rootpath

If you wish, you can issue the save-all command before the boot command - if something fails, you won't have to type all those setenv's again. Later on, when the new disk image has been installed, you need only change kernconfig and rootconfig to switch back to local (disk-based) booting.

If it doesn't boot

Diagnosing what is failing can be quite difficult sometimes. There are a large number of things to check, any of which could cause trouble. The following tips will hopefully help in diagnosing the problem. If you get really stuck, as for help on the mailing lists / newsgroups.

The first thing that should happen after the boot command is given is that the kernel should be downloaded via TFTP from the server. A counter will show the bytes as they are received, and it should take a couple of seconds at least (the kernel is about 1MB in size). If the count doesn't appear at all, there is a problem with tftp on your server, or a networking problem (NetWinder can't talk to the server). Check the the IP addresses and netmasks.

If downloading succeeds, the kernel will then be booted. If your monitor goes black or looses sync for an extended time, then the kernel failed to boot. Check that your firmware is compatible with the kernel that the TFTP server is sending. You might have to upgrade or downgrade one or the other.

The kernel should then boot, and print its usual messages about detected hardware. Then it will try to mount the NFS share. IF the mount fails, it might hang here, or give an error. If it says "NFS server not responding, still trying" then be patient, it will probably work. Anything else (error -13 for example) means the NFS export couldn't be mounted. Check the server, maybe try mounting it from yet another machine.

One of the first things you'll see after the NFS is successfully mounted is the message "INIT version... starting". In this case you should be home free. Expect some warnings during the nfs boot (for example, ef2sck will complain when it tries to scan the root disk, since it can't handle an nfs filesystem). You should eventually get to a login prompt.

7.4 Installing the image

Once the NetWinder is nfs booted, you should login in as root (password is 'vnc') and then type mount to ensure that you really are NFS booted. The output from mount should show that "/" is not mounted on /dev/hda1.

At this point there are a number of options. If you wish, you may repartition the NetWinder's hard disk by typing fdisk /dev/hda. If you do so, you'll have to format the new partition with mke2fs. This will of course erase everything on the disk. (Please see the note in section 2.2 regarding the -O sparse_super option).

In any event you should free up a partition to hold the new disk image. For consistency with previous chapters, I'll assume that /dev/hda3 has been freed in the following examples. See sections 2.2 and 4.3 for tips on how to free a partition.

You can untarr the diskimage to the free partition, or you can copy recusively all the files from the NFS mount to the free partition. The former is quicker so I'll describe it here.

On the server, the YourFile.tar.gz diskimage should be copied or moved into the /nwroot directory. It will therefore be visible to the NetWinder.

On the NetWinder, the image can be installed using the following commands.

        mount /dev/hda3 /mnt/hda3
        cd /mnt/hda3
        tar zxpf /YourImage.tar.gz

Since the files are being copied across the network, this process could take some time.

7.5 Post installation

Be sure to fixup the etc/fstab file in the newly installed image before shutting down, and adjust the firmware parameters upon reboot. Please refer to sections 2.4 and 2.5 for the details on how to do this. Note in the examples in section 2.x assume your new image to be located on /dev/hda3; if you've used a different partition, you must adjust the examples to suit.

If you used the save-all command in section 7.3 above, then remember to "undo" those settings so that your machine will boot from its hard disk again:

        setenv kernconfig fs
        setenv rootconfig disk

That's it!

Next Previous Contents