The NetWinder Disk-Update-HOWTO

Ralph Siemsen, ralphs@netwinder.org $Revision: 1.11 $, $Date: 2000/11/19 17:13:24 $

This manual explains various ways of installing or upgrading disk images on a NetWinder. It really comes down to untarring an image in the right spot, then changing a few settings in the firmware. Note that if you are using an OfficeServer, you should read Rescue-HOWTO.html instead of this document.

Contents

1 Introduction 3 1.1 Obtaining a new disk image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2 Choosing an installation method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2.1 Rescue partition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.2 Basic method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.3 Remote tarball . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.4 Drive swap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.5 Parallel port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.6 Rescue firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.7 NFS booting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.2.8 NFS rescue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2 Basic method 5 2.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2 Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.3 Image installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.4 Updating etc/fstab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.5 Firmware settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3 Remote tarball 7 3.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.2 Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.2.1 Unix server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.2.2 Windows server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.3 Image installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.4 Post installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4 Drive swap 9

4.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4.2 Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4.3 Freeing space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4.3.1 Moving files between partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.3.2 Formatting a parition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.3.3 Repartitioning the drive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4.4 Installing the image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.5 Post installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

5 Parallel port 11 5.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 5.2 Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 5.3 Image installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 5.4 Post installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

6 Rescue firmware 13 6.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 6.2 Preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

6.2.1 NetWinder setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 6.2.2 The ‘other machine’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

6.3 Installing the image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 6.4 Post installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

7 NFS booting 15 7.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 7.2 Server preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

7.2.1 Preparing /nwroot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 7.2.2 Setting NFS exports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 7.2.3 Setting up TFTP booting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

7.3 NetWinder diskless boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

7.3.1 If it doesn’t boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 7.4 Installing the image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 7.5 Post installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 8 NFS rescue 19

8.1 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

9 Troubleshooting 20 9.1 Proper etc/fstab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 9.2 Delete etc/mtab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 9.3 Mountpoints for /proc, /mnt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 9.4 Unable to open initial console! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 9.5 couldn’t mount because of unsupported optional features . . . . . . . . . . . . . . . . . . . . 21

10 Misc 21 10.1 Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 10.2 To-do . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 10.3 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 10.4 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 10.5 Legal stuff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

1 Introduction

There are a variety of reasons you’d want to update the hard disk image on your NetWinder. From a simple update to a newer disk image, to a forced reinstallation because something went badly wrong, this manual covers the various possibilities. Each chapter in this manual covers a different installation method. Consult the section ‘Choosing an installation method’ below for advice on how to determine the best method for your particular circumstances. There is a general ‘Troubleshooting’ chapter at the end.

1.1 Obtaining a new disk image

Official disk images for the NetWinder can be downloaded from ftp://ftp.netwinder.org/pub/ netwinder/images/ directory (older disk images are in /pub/ccc/images/ instead). For more informa-

tion about the various disk images, please see http://www.netwinder.org/~ralphs/diskimage.html .

There are also some unofficial disk images that may be of interest. Having not tried them myself, I withold further comments and will only say that there is an ongoing port of Debian (see http://www.debian. org/ports/arm/ ) and there is also a RedHat port with versioned glibc called Titan (see http://www.nw.

carleton.ca ).

1.2 Choosing an installation method

A variety of installation methods can be used to update the NetWinder’s disk. Which one is right for you will depend on such factors as how much free space you have on the NetWinder’s hard disk, what type of network connection you have got, etc. The following paragraphs are intended to asist you in selecting an appropriate installation method.

1.2.1 Rescue partition

For the OfficeServer and DM built 15, a "rescue partition" is included on /dev/hda4. It contains a small filesystem that provides facilities to restore the rest of the drive from either a Windows or Unix host, without having to worry about nfs booting. Use of this new rescue system is covered in the Rescue-HOWTO.html .

1.2.2 Basic method

For people with plenty of free disk space, this is the easiest method. You download the compressed disk image (tarball) onto your NetWinder, then expand it onto a free partition. Requires enough space to hold the compressed and uncompressed images simultaneously (about 900 MB for build #12).

1.2.3 Remote tarball

The compressed tarball can be downloaded to another machine and be expanded from there across a (local) network connection. The ‘other’ machine must support NFS file sharing (unix machine) or SMB file sharing (Windows) and must have enough room to hold the compressed disk image. The NetWinder must have enough room for the uncompressed image (ideally on an unused partition).

1.2.4 Drive swap

You can remove the hard disk from the NetWinder and install it in an ordinary PC. This will of course void your warrantee! You’ll need a laptop IDE adaptor cable, available at most computer stores, since the connector is physically smaller. Then you can set the drive as slave and format/install to your hearts content from the host PC system.

1.2.5 Parallel port

If you own a parallel-port device such as the Backpack CD-ROM or a tape drive, you can use this to hold the disk image. The NetWinder can even boot off the cd-rom drive (it takes forever, since the parallel port is fairly slow). You can also use ZIP drives, though you won’t be able to fit an entire disk image onto one of course. Still useful for emergency booting though.

1.2.6 Rescue firmware

Certain versions of the NetWinder firmware come with a ‘rescue’ filesystem that allows the machine to be booted without using the hard disk or the network connection. It turns your NetWinder into an NFS server, so that another computer on your network can connect to it and decompress the disk image. This method requires a second (unix) machine as an NFS client, with enough room to hold the compressed disk image.

1.2.7 NFS booting

The NetWinder can boot from another server (typically another Linux machine) using TFTP to fetch the kernel and NFS to access the root filesystem. It can be quite tricky to get this setup, so this option is not recommended for novices. It requires a second computer with enough room for the compressed and uncompressed disk image, and it must have tftp and nfs server support.

1.2.8 NFS rescue

Mike Montour has developed a trimmed-down and more automatic method similar to the NFS booting technique, but without the overhead of an entire disk image on the rescue server. His latest version also includes a GUI tool to help set up the server for tftp, nfs, and dhcp services. This method also requires a second (unix) machine that can support network booting.

2 Basic method

The chapter describes the basic method for installing a new diskimage on a NetWinder. The methods described in the other chapters are variations on the basic method, so this chapter makes for good background reading even if you are using one of the other methods. See the first chapter for an overview of the different installation methods.

2.1 Requirements

This is the simplest method but requires considerable hard drive space - enough to hold the compressed disk image (about 250 MB for build #12) as well as the uncompressed image (about 650 MB). Add to this the space occupied by the existing disk image, and you’ll see that this method is practical only on machines with hard disks of 2 GB or more capacity.

A new disk image is also required, of course. It can be downloaded (via FTP) from netwinder.org as a tar.gz archive. Alternatively you might have received the image on CDROM or other media; you should transfer the image onto the NetWinder by some means - FTP, NFS, SMB, HTTP - keep in mind that the image is a binary file.

2.2 Preparation

Some manipulation may be required to free up space on the partition where the new image is to be installed. While it is not strictly necessary for the partition to be empty, subtle problems can arise if old files are mixed with the new image. We recommend clearing the partition completely to avoid trouble. See also section 4.3 for more information on how to free up a partition.

The df command will allow you to check disk usage. Typical output from this command is shown below. Don’t be alarmed if the values reported by your system differ.

        Filesystem         1024-blocks  Used Available Capacity Mounted on
        /dev/hda1            1014784  645694   316651     67%   /
        /dev/hda3            2792760   72888  2575451      3%   /home

Here we see that the third partition /dev/hda3 contains only 72 MB of data, whereas there remain 316 MB of free space on the first partition /dev/hda1. If we moved the data from the third partition into the first, then /dev/hda3 would be empty and we could install the new diskimage there. Since unix doesn’t allow files to be moved across filesystems, we first copy the data from /dev/hda3 and later delete it. You must be root to run these commands of course.

        cd /
        umount /dev/hda3
        mount /dev/hda3 /mnt/hda3
        cp -ax /mnt/hda3/. /home
        umount /dev/hda3

The data has now been copied to the /home directory, which is now on /dev/hda1. To prevent side effects, you should also edit the /etc/fstab file and comment out the line beginning with /dev/hda3, or delete the entire line. Otherwise, your system may have difficulty trying to mount /dev/hda3 next time you reboot.

The free partition can now be cleared out, either by formatting it or by deleting all the files (rm -rf). Again this isn’t strictly necessary but it is recommended. Be sure you give the right partition number otherwise you’ll end up formatting the wrong partition. The commands for formatting the third partition, and then mounting it on /mnt/hda3, are as follows.

        mke2fs /dev/hda3
        mount /dev/hda3 /mnt/hda3

Now you’re ready to install the new disk image onto /mnt/hda3. You can use the df command to verify the amount of free space if you wish.

Special note: If you are running dm-3.1-15 disk image, then you must pass extra flags to mke2fs otherwise the firmware and kernel won’t recognize your filesystem correctly. To format a partition you should use these commands

        mke2fs -O sparse_super /dev/hda3

2.3 Image installation

To install the image, use the tar command to extract files from the compressed image. If you have not yet downloaded the image, do so now (placing it wherever there is enough room). Then use the following commands to expand the archive. The example assumes that your "empty" partition has been mounted on /mnt/hda3 (as in the previous section):

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

Replace YourImage with the name of the image you downloaded (including the full path, if it’s not located in the current directory). This process will take 5 to 10 minutes, on average.

2.4 Updating etc/fstab

The etc/fstab file will need to be edited before the new image can be booted. Using your favourite text editor, open the file /mnt/hda3/etc/fstab. The line that begins with /dev/hda3 should be deleted or commented out. The line that begins with /dev/hda1 should then be changed so that it begins with /dev/hda3 (or whichever partition you’ve just installed to). Save the modified file and exit the editor. Then unmount the partition in anticipation of rebooting:

        sync
        cd /
        umount /mnt/hda3

While it should not be necessary with official disk images, you might want to check that the file etc/mtab does not exist in your image (before you unmount it). Delete this file if it does exist (for example, rm

/mnt/hda3/etc/mtab).

2.5 Firmware settings

The last step is to change the firmware settings so as to boot from the new partition. Reboot the machine (using CTRL-ALT-DEL for example) and then upon reboot, at the ‘Press any key to abort autoboot’ prompt, press a key. Enter the following commands to switch over to /dev/hda3:

        load-defaults
        setenv kerndev /dev/hda3
        setenv rootdev /dev/hda3
        save-all
        boot

The save-all command may be omitted if you just want to test boot the new image (you can re-issue it later on). See the Firmware-HOWTO at

http://www.netwinder.org/~ralphs/howto/Firmware-HOWTO.html for more information.

The new disk image should now boot. If not, consult the Troubleshooting chapter at the end of this manual. To access your old disk image (perhaps to copy out some personal files, for example) you can mount it with a command like:

        mount /dev/hda1 /mnt

3 Remote tarball

This chapter describes a slight variation on the basic method for installing a new disk image on a NetWinder. It is useful if there is not enough disk space on the NetWinder to hold both the compressed and uncompressed images.

3.1 Requirements

This method requires sufficient space on the NetWinder to stored the new, uncompressed disk image (about 650 MB for build #12). The NetWinder must also have network connectivity (ethernet) - the nwconfig program can used to configure IP address and other parameters.

In addition, a second computer is needed to hold the compressed disk image (about 250 MB). This can be another unix machine, or a Windows machine - anything capable of communicating with the NetWinder via ethernet. Configuration of the remote system is not covered in much detail here.

3.2 Preparation

On the NetWinder, a disk partition should be freed up. This process is described in detail in section 2.2 of the previous chapter. In the following examples, it will be assumed that an empty partition has been mounted on /mnt/hda3.

The ‘other computer’ (hereafter called the server) also needs to be set up. The compressed disk image should be downloaded to this server machine. The image should then be made available to the NetWinder by putting it into an NFS share (for unix systems) or into a public folder (for Windows machines). Unix shares are normally listed in the /etc/exports file, while Windows handles it by right-clicking on the directory name and changing the properties.

The NetWinder must then be configured for access to the (remote) compressed disk image. The process depends on the type of server being used.

3.2.1 Unix server

The following commands show how to mount a remote NFS server so that theNetWinder can access its files. Replace 192.168.1.2 with the IP address of the server and replace /exportname with the actual name of the exported filesystem. This must match the name given in the /etc/exports file on the server.

        mkdir /mnt/server
        mount 192.168.1.2:/exportname /mnt/server

To verify proper operation, use the command ls /mnt/server - you should see the compressed disk image in the listing.

3.2.2 Windows server

In the case of a Windows machine acting as the server, you will have created a shared folder with a name such as SHARE. You can access this share from your NetWinder using the smbmount command. Substitute the Windows computer’s name for COMPUTER, and specify your windows USERNAME and WORKGROUP as well. You’ll be prompted for your password.

        mkdir /mnt/server
        smbmount //COMPUTER/SHARE /mnt/server -U USERNAME -W WORKGROUP

In case of difficulty, consult the smbmount man page. To verify that it is working correctly, enter the command ls /mnt/server - you should see the compressed disk image in the listing.

3.3 Image installation

The proceedure for installing the image is nearly the same as that described in the basic method, except that the image now streams over the ethernet from the server system. The commands for installation are as follows.

        cd /mnt/hda3
        tar zxpf /mnt/server/YourImage.tar.gz

Replace YourImage with the name of the compressed disk image that you downloaded to the server. The process will nominally take about 10 minutes, but it depends on how much traffic is on the network. You can monitor progress by switching to another terminal or window and using the df command.

3.4 Post installation

Please refer to sections 2.4 and 2.5 in the previous chapter for the post-installation instructions. Note that it is essential to update the etc/fstab file before attempting to boot the new image.

4 Drive swap

This chapter describes how to install a new diskimage on a NetWinder by removing the hard disk and installing it as the slave drive in another system. This method is not recommended since it will void the warrantee, but its a practical method especially for those people with very small hard disks.

4.1 Requirements

This method requires a second computer where the NetWinder’s hard disk can be installed. The second machine could be another NetWinder, or an ordinary PC running some form of unix. In the case of a regular PC, an adaptor cable is required since the NetWinder hard drive is of the 2.5" laptop variety, which will not plug directly into the normal IDE connectors. Adaptors are available at most computer stores for about $10.

Static electricity can kill a NetWinder! Be sure to be properly grounded before you start poking around inside your computer.

4.2 Preparation

The NetWinder’s hard drive should be connected to the host computers IDE controller, and (possibly) the master/slave jumper will need to be adjusted on the NetWinder’s drive. To gain access to the drive, open the four screws on the bottom of the NetWinder. Usually it’s possible to move the NetWinder close enough to the PC so that the cable can be directly connected, if not, you’ll have to remove the hard drive itself (the screws are on the bottom of the motherboard).

Once the drive is connected, the PC can be powered up. Do whatever is necessary for the drive to be detected (this might mean going into the BIOS and specifying the drive parameters, or on modern PC’s, the drive will be auto-detected). I’ll assume for the purpose of this example that the PC’s main hard drive is /dev/hda and that the NetWinder’s drive is /dev/hdb - but you’ll have to verify that this is the case on your machine (use the dmesg command for this).

4.3 Freeing space

There must be enough room to install the new disk image on the NetWinder’s drive. You have the option of moving/deleting files to free up a partition, or you might choose to format the NetWinder’s hard disk completely and repartition it as you wish. I cannot give you a step-by-step guide here, so I’ll describe the available options and let you decide.

4.3.1 Moving files between partitions

To transfer files between partitions, you need to mount both partitions and then use the cp and rm commands. Two mountpoints are required for this - you can use any two directories - for example /mnt/one and /mnt/two. Of course the directories must exist before they can be used, so go wild with the mkdir command. Then mount the two partitions (picking on /dev/hdb1 and /dev/hdb2 for this example):

        mount /dev/hdb1 /mnt/one
        mount /dev/hdb2 /mnt/two

Now files can be copied from /mnt/one to /mnt/two (or vice-versa) using the cp command. To remove the originals after they’ve been copied, use the rm command. When you’re done, unmount the partitions again:

        sync
        umount /mnt/one
        umount /mnt/two

4.3.2 Formatting a parition

Once a partition has been cleared of files, or if you don’t want to keep the old files, the format command can be used to initialize a new filesystem. This will completely wipe out everything on the partition, with no way to restore it. Use with care, and check very carefully that the correct partition and drive are specified.

        mke2fs /dev/hdb1

The preceeding example will format the first partition on the second (slave) drive, presumably the NetWinder drive. In case you’re not clear on the naming convention yet, the drives are called /dev/hdXY where X is a letter (a for the first drive, b for the second, etc) and Y is a number indicating the partition (starting from one).

4.3.3 Repartitioning the drive

In some cases it may be desirable to repartition the entire drive, for example if you are updating an old system and don’t want to keep the old version anyhow. Note that after repartitioning, you must format the partitions, and this will destroy all data on the drive.

To adjust the partition tables, use the fdisk command. You have to tell it which drive you want to repartition - for example say fdisk /dev/hdb to adjust the partition table on the second (slave) drive. The rest of the commands (for deleting a partition, creating a new one, etc) are explained in the on-line help. There is also a nice man page (man fdisk) that gives more information.

The recommended disk layout is as follows: the first partition is the root filesystem (type 83, Linux) usually about 1 GB in size. The second partition is used for swap (type 82, Linux swap) and is 64 to 128 MB in size. Anything remaining space is allocated to third partition and gets mounted as /home.

4.4 Installing the image

To install the image, you need to ensure that both the source and destination partitions are mounted, then you can use the tar command to extract files from the diskimage. Most likely, the diskimage is located on your main disk (hda) and the destination is the first partition on hdb. In this case, the appropriate commands are as follows:

        mount /dev/hdb1 /mnt/hdb1
        cd /mnt/hdb1
        tar zxpf /path/to/YourImage.tar.gz

You’ll need to ensure that the mountpoint /dev/hdb1 exists (or use a different name), and you’ll need to specify an appropriate path and filname instead of path/to/YourImage. This process should be pretty quick, about 5-10 minutes, since the data is moving over the IDE bus directly.

4.5 Post installation

After the installation of the disk image is completed, be sure to review the etc/fstab file in the installed image. The entries in this file must correspond with the way the partitions are used, eg. if the first partition contains the main image, then it should be mounted as / in the fstab file. Keep in mind that the drive names listed in the fstab file should be those that will be seen when the disk drive is booted on the NetWinder (/dev/hda in most cases). Also be sure to edit the right etc/fstab file - you want to edit the one in the image you just untarred, not the one belonging to the host PC.

The drive can then be unmounted and the PC can be powered down. The NetWinder’s hard disk should then be reinstalled. If the partition usage has changed, then firmware settings may need to be changed. Consult section 2.5 for details, but remember to use the appropriate /dev/hdaX value for your particular situation.

5 Parallel port

It’s possible to update or reinstall a NetWinder disk image via a parallel-port device, such as the Backpack CD-ROM. Its pretty slow and therefore not recommended in general, but if you happen to have a suitable drive, and don’t mind waiting, then this method is for you.

5.1 Requirements

There are two variations on the parallel port method. One way is to use the parallel port device simply as a storage place for the diskimage tar file. In this case, the NetWinder must have enough room on a spare partition to hold the uncompressed disk image. You’ll also need to make or obtain a CDROM (or tape or disk, as the case may be) containing the image tar file.

Alternatively, it is possible to boot off the parallel port device (at least, San made it work a long time ago). In this case, the NetWinder’s hard disk could theoretically be reformatted and the new image installed over top. Therefore you would not need a "spare partition" to hold the new image. The difficulty with this method is that you need a bootable CDROM, and unfortunately I can’t tell you how to make/obtain one. If anyone has experience, please let me know.

5.2 Preparation

A partition should be freed up to make room for the uncompressed image. The process is described in sections 2.2 and 4.3 (read both if in doubt). It will be assumed in the following that /dev/hda3 has been freed and is mounted on /mnt/hda3.

Next, the parallel port device needs to be made available. Ensure that it’s plugged in and powered on. Most likely the device will be a CD-ROM player, since zip drives are not large enough to hold the disk image. So the example listed here will assume a Backpack CDROM. This happens to be a device that I have tested. For other parallel devices, consult http://netwinder.org/~ralphs/parport.html for the appropriate commands.

        insmod nls
        insmod isofs
        insmod paride
        insmod bpck
        insmod pcd
        mount -o ro /dev/pcd0 /mnt/cdrom

To verify that it’s working right, issue the command ls /mnt/cdrom and you should see the diskimage tarball in the listing.

5.3 Image installation

As in the other install methods, the disk image should now be untarred to the free disk partition. The command sequence will be similar to

        cd /mnt/hda3
        tar zxpf /mnt/cdrom/YourImage.tar.gz

Naturally you have to substitute the appropriate name for YourImage. The process could take quite a long time, since the transfer over the parallel port is rather slow. It also uses a lot of CPU power, so the computer may be very slow to respond if you try and do anything else while the image is uncompressing.

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

6 Rescue firmware

This chapter describes how to restore a NetWinder disk using the ‘rescue’ flash filesystem. This allows a NetWinder to boot completely from the flash memory, and then become an NFS server. You can then use a second computer on your network to connect to the NetWinder and install a new disk image.

Thanks go to Mike Montour (mmontour@iname.com) who first put together the rescue filesystem and has been improving it ever since. San Mehat adapted the filesystem so that it could be stored in flash memory. I’ve also twiddled with it a bit and released my own version (nettrom-2.0.4a+ralphs). Please note that the startnfs script described below only exists in the 2.0.4a+ralphs version!

6.1 Requirements

First and foremost, this method requires a NetWinder with a rescue filesystem embedded in the firmware. The only sure-fire way to find out is to try and boot the rescue filesystem (see section XX below). If your machine boots as usual off the hard disk, you don’t have rescue firmware installed. In that case, either upgrade

the flash (see the Firmware-HOWTO at http://netwinder.org/~ralphs/howto/Firmware-HOWTO.html

), or use one of the other installation methods.

The second requirement is to have another computer, preferably a unix machine, which can act as an NFS client. The diskimage tarball should be downloaded to this machine. This machine will then mount the NetWinder’s hard disk and untar across the network to the NetWinder.

6.2 Preparation

As with the other methods, a partition should be freed on the NetWinder disk (unless you plan to reinstall everything, in which case you can just format the partition, of course). Consult sections 2.2 and 4.3 for more information on how to free a partition.

6.2.1 NetWinder setup

The NetWinder will now be turned into an NFS server and be made to export the (empty) partition so that it can be mounted from the ‘other’ computer. The first step is to reboot the NetWinder and to enter the firmware menu by pressing a key when prompted, ‘Press any key to abort autoboot’. Configure the NetWinder’s IP address and netmask, and enable the rescue filesystem:

        setenv netconfig_eth0 flash
        setenv eth0_ip 192.168.1.1/24
        setenv rdconfig flash
        boot

Be sure to specify the NetWinder’s actual IP address and netmask. The welcome message should then be displayed. If you do not see it, or if the system boots off the hard disk like it usually would, then your firmware lacks a rescue filesystem. In this case, you can either change the firmware, or use one of the other installation methods.

Optionally, the mke2fs and e2fsck commands can now be used to format and verify partitions, respectively. The partition table itself cannot be altered, unfortunately, since there is not enough room in the rescue filesystem for the fdisk program to be included.

The last step is to actually export the (empty) partition, and to start the NFS daemons. Mike has set up a convenient script for doing this. For reasons unknown, firmware versions with the rescue suffix don’t include this script (perhaps San didn’t think it was needed...) There is a corrected version called nettrom-2.0.4a+ralphs which does include the script (and is otherwise identical). The following example shows how to use the script.

        startnfs 192.168.1.254 /dev/hda3

This causes /dev/hda3 to be mounted on /mnt/localdisk and then exported to the host 192.168.1.254. You should of course substitute the IP address of your ‘other’ computer in its place.

If the startnfs command fails, try rebooting and repeating the startnfs process again. Usually it succeeds after a few tries. If you have repeated problems, you can contact me for help (mostly because I’d like to nail down exactly what the conditions are that lead to the problem).

6.2.2 The ‘other machine’

The other computer will now mount the NetWinder’s exported filesystem. I suggest creating a mountpoint /mnt/netwinder for this purpose. Substitute the NetWinder’s actual IP address into the following mount command:

        mkdir /mnt/netwinder
        mount 192.168.1.1:/mnt/localdisk /mnt/netwinder

If this fails, try pinging the NetWinder to make sure the network connection is working. If ping works, but the mount fails, go back to the NetWinder and ensure that the NFS service started without errors. On some systems, you might have to add the flag -t nfs to the mount command.

To verify that things are working, try doing ls /mnt/netwinder. This should show an empty filesystem. The df command should show that /mnt/netwinder has sufficient space to hold the uncompressed disk image (about 650 MB for build #12).

6.3 Installing the image

The image can be untarred directly to the NFS disk image now. Since the uncompressed data must be transfered over the network, it could take quite some time. Be patient... To monitor progress, you can switch to another terminal and use the df command.

        cd /mnt/netwinder
        tar zxpf /path/to/YourImage.tar.gz

You will have to supply the full pathname for YourImage. The image could of course be located on another NFS (or otherwise) mounted volume, if you wanted to.

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

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.

7.2.1 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:

        192.168.1.254:/nwroot   /       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.

7.2.2 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 192.168.1.1, substitute your real address. On the server, edit (or create) /etc/exports so it contains the following line:

        /nwroot 192.168.1.1(rw,no_root_squash)

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

7.2.3 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 192.168.1.1/24

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 192.168.1.254
        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 192.168.1.254:/nwroot
        boot

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.

7.3.1 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
        save-all

That’s it!

8 NFS rescue

This method was developed by Mike Montour (mmontour@iname.com) as an alternative to the full NFSboot method described in the previous chapter. It’s meant to simplify the process of configuring the server, and it also takes less space on the server (since it doesn’t require the whole NetWinder disk image to be decompressed).

8.1 Usage

Mike has prepared a README for the use of his rescue filesystem. It is available at http://www.netwinder. org/~mmontour/ . The NFS-rescue disk images are also available from the same place. Overall, the process is similar to that described in the previous chapter, ‘NFS booting’. Some of the differences include:

• The package includes a configuration utility to help you set up the tftp and NFS server on the server, and also creates a DHCP configuration file (but it’s important to read your HOWTO to understand what the configuration utility is doing).

• When booting the Netwinder, the Firmware commands are:

             load-defaults
             setnetwork eth1        (or eth0)
             setenv kernconfig tftp
             setenv rootconfig nfs
             boot

(It should get everything else over DHCP)

• "Installing the image" is the same, except that you don’t have to log in, and the local partitions are mounted under /exports/hdaN by default. Unpacking the tarball from the NFS host onto the local disk is also the preferred installation method with my package (which now includes tar).

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.

9 Troubleshooting

Here is a list of things to check when nothing is working. Unfortunately, it is not very complete listing. If you’ve got suggestions for things to add, please mailto:ralphs@netwinder.org .

9.1 Proper etc/fstab

Be sure to check the etc/fstab file in your new disk image before shutting down and trying to boot it for the first time. The default file might not be applicable to the way you’ve partitioned your disk. Make sure that there are entries for only those partitions you actually use. Comment out any /dev/hdXY lines if you don’t need them.

Also, make sure that the root device is properly specified. The root device is the line whose mountpoint (second column) is simply ‘/’. Make sure that the device name immediately to the left of it actually is the partition where you’ve installed the disk image. This should be the same value that you put into the rootdev parameter in the firmware.

9.2 Delete etc/mtab

If there is a file called etc/mtab in your newly installed image, delete it. This is used to cache the actual mounted filesystems (it looks much like /etc/fstab). The system will re-create a proper file when it needs one. Having an old version of mtab around can prevent the machine from booting.

9.3 Mountpoints for /proc, /mnt

Sometimes the mountpoints don’t get included in a disk image. Fix this by going to the root directory of the new image and running the following commands.

        mkdir proc
        mkdir mnt
        mkdir mnt/hda1
        mkdir mnt/hda2
        mkdir mnt/hda3

9.4 Unable to open initial console!

When booting a 2.2.x kernel on a disk image designed for 2.0, you may encounter the message ‘Unable to open initial console’ shortly afteer the kernel boots. The solution is pretty simple, you have to create a /dev/console entry in your NFS disk image. Either of the following two command can be used; the first one is preferred:

        mknod /dev/console c 5 1
        ln -s tty0 /dev/console

Keep in mind you want to create the node in the NFS image that’s exported to your NetWinder for booting, as opposed to the root filesystem of your NFS server. So you should really say /path_to_nfs/dev/console

instead of /dev/console.

9.5 couldn’t mount because of unsupported optional features

If you’re getting this error whey you try to boot your newly installed system, then the problem is that you used a new version of mke2fs and it has turned on some new features, which the NetWinder firmware does not understand. Until the firmware is fixed, the solution is to use mke2fs -O sparse_super /dev/hdaX when you format your filesystem. It may also be possibly to change this after-the-fact with the tune2fs program, but I’ve not tried it.

10 Misc

10.1 Author

The author and maintainer of the NetWinder Disk-Update-HOWTO is Ralph Siemsen (ralphs@netwinder.org). Please send me any comments, additions, corrections so that the can be included in the next release. The latest version of this document can be obtained from

http://www.netwinder.org/~ralphs/howto/Disk-Update-HOWTO.html .

10.2 To-do

The ‘sgml2info’ version of this document doesn’t show the examples properly - for some reason the linefeeds are removed. Why is this and how do I fix it?

10.3 History

May 22, 1999 (version 1.0): First public release of this document.

May 27, 1999 (version 1.1): Completed missing sections, added links to Carelton project, put in more cross-references.

Jun 7, 1999 (version 1.4): Added NFS-rescue section (thanks Mike!)

Jun 21, 1999 (version 1.5): Fixed typo in section 6.2 NetWinder setup (thanks to Steve Cockwell), added clarification about "rescue" versus "ralphs" versions of the firmware.

Dec 12, 1999 (version 1.6): Fixed typo in section 7.2, the filesystem type in the example was incorrectly listed.

Apr 10, 2000 (version 1.7): Documented the -O sparse_super option for mke2fs, which is necessary on dm-3.1-15.

10.4 Contributors

Right now this is a product entirely of my own imagination.

Mike Montour (mmontour@iname.com) designed the NFS-rescue package.

Steve Cockwell (stevec@sierra.lazarus.ca) spotted a typo in the Rescue-firmware chapter.

Jason Jackson (jrjackso@warg.uwaterloo.ca) spotted a typo in section 6, it should read netconfig_eth0...

Sean MacLennan (seanm@netwinder.org) for spotting a typo in section 7.2, the /etc/fstab entry should show a filesystem of nfs and not ext2. Robert Scwartz (roberts@corel.com) caught my silly typo of the sparse_super option for mke2fs.

10.5 Legal stuff

This document is copyright (c) Ralph Siemsen, 1999. Permission is granted to make and distribute copies of this manual provided the copyright notice and this permission notice are preserved on all copies. There is no warrantee whatsoever.