Diskless Windows Cookbook

Paul Whittaker (Paul.Whittaker@iname.com)
Director, Cloud Network Technologies Pty Ltd, Australia

This HowTo is intended for use with Windows NT 4.0 Terminal Server Edition. I have no experience with Windows 2000 (yet), but I believe that the same basic procedure could be applied to Windows 2000 server even more easily (without the need for one or both of the add-on server packages).

If you don't already have a Windows Terminal Server, I advise you to think carefully about whether you really want to do this. Windows Terminal Server solutions are very expensive, and there are other lower-cost means of accessing Microsoft applications from a Linux-based server, or accessing Microsoft documents from Linux-based applications. This HowTo is really aimed at sites that already have a major investment in Microsoft platforms and an ongoing need for extensive use of Microsoft apps, but who want to transition to a thin-client model while recycling existing desktop hardware. To give you some idea of the cost, I have roughly estimated the total licensing costs of a 10-user solution - not including application costs (Microsoft Office etc) - at just short of US$3000.

This recipe assumes a fairly in-depth knowledge of Linux and various network protocols. I suggest you do some background reading on Etherboot and the Linux Terminal Server Project operational model before proceeding.

Ingredients

Method

  1. Install the LTSP components on your Linux box. If by some miracle you have found a Windows-NT-based NFS server that supports block- and character-special files and symbolic links, you can use one of the standard kernels provided at the LTSP website and skip to step 5.

    Unless you intend to do dry-run boot tests from your Linux box, it is not necessary to run ltsp_initialize at this point, or to get bogged down in the details of LTS setup. We are only using Linux as an intermediary to generate a root filesystem footprint - the configuration can be done later from Windows.

  2. Compile a devfs-enabled kernel bzImage using make bzImage ROOT_DEV=''. There is a patch you can apply to 2.2.x kernel sources to add devfs support, but there are some side-issues, and I would suggest just grabbing 2.4.x kernel source (with devfs built in) and using this. I used 2.4.0 source with this config file for clients with NE2000 compatible network cards. DHCP kernel-level IP autoconfiguration should not be necessary if using recent versions of Etherboot and mknbi.

    If you intend to use loadable modules you will also need to compile the modules and install them into /tftpboot/lts/ltsroot/lib/modules/kernel-version. Note that the version 2.4.x kernel sources install modules using a new directory layout that most likely won't be understood by your modutils, in which case you will need to massage the modules directory back into the traditional format (because we'll be using the modprobe and depmod binaries from your Linux distro). The following procedure should work for a version 2.4.x kernel:

    make modules
    make modules_install
    mkdir -p /tftpboot/lts/ltsroot/lib/modules/new-kernel-version
    cd /lib/modules/new-kernel-version/kernel
    mv fs drivers/* /tftpboot/lts/ltsroot/lib/modules/new-kernel-version
    cd /
    rm -rf /lib/modules/new-kernel-version /tftpboot/lts/ltsroot/modules
    cp /sbin/depmod /tftpboot/lts/ltsroot/sbin
    chroot /tftpboot/lts/ltsroot /sbin/depmod -a

  3. Create a tagged image using mknbi-linux. Unfortunately it appears that you must explicity state the NFS root path that you intend to use because, despite appearances, NT4TSE's DHCP Server doesn't provide RootPath information that Etherboot/Linux can make sense of.

    cd /usr/src/linux/arch/i386/boot
    rdev -R bzImage 0
    rdev -r bzImage 1
    mknbi-linux --ipaddrs=rom --rootdir=/tftpboot/lts/ltsroot bzImage >vmlinuz
    cp vmlinuz /tftpboot/lts
    

    My personal preference is to keep the TFTP and NFS areas separate rather than have the latter a subset of the former, so for my kernel I actually used --rootdir=/ltsroot for use in the directory d:\ltsroot on my server.

  4. Obtain and compile devfsd and install it into the ltsroot hierarchy. Devfsd requires modprobe, which LTSP doesn't normally use, so we will need to make some minor modifications.

    cp devfsd /sbin/modprobe /tftpboot/lts/ltsroot/sbin
    cp /usr/lib/libnsl.so.1 /tftpboot/lts/ltsroot/lib
    cp devfsd.conf modules.devfs /tftpboot/lts/ltsroot/etc
    rm -rf /tftpboot/lts/ltsroot/dev/*
    ed /tftpboot/lts/ltsroot/etc/rc.local << EOF
    /^function get_cfg/
    /^}/
    a
    
    #
    # Set up devfs compatibility devices
    #
    /sbin/devfsd /dev
    .
    1,\$s/\/dev\/ram/\/dev\/ram0/
    /insmod/
    d
    i
            /sbin/modprobe \${MODULE}
    .
    w
    q
    EOF
    ed /tftpboot/lts/ltsroot/etc/modules.devfs << EOF
    /^include /
    s/^/#/
    w
    q
    EOF
    

    Note that as you are now using modprobe you will need to remove the ".o" extensions from all your MODULES_NN lines in /tftpboot/lts/ltsroot/etc/lts.conf.

  5. Patch, compile and install rdesktop.

    cp rdesktop /tftpboot/lts/ltsroot/ltsbin
    cp /usr/X11R6/bin/xinit /tftpboot/lts/ltsroot/bin
    cd /usr/X11R6/lib
    cp libXmu.so.6 libXt.so.6 libSM.so.6 libICE.so.6 /tftpboot/lts/ltsroot/lib
    ln -s /tmp/xinitrc /tftpboot/lts/ltsroot/.xinitrc
    ed /tftpboot/lts/ltsroot/etc/rc.local << EOF
    /\*)/
    i
            RDP)  XSERVER=\`get_cfg XSERVER XF86_SVGA\`
    	      RDP_SERVER=\`get_cfg RDP_SERVER \${DEFAULT_SERVER}\`
    	      echo "while true; do /ltsbin/rdesktop -u Administrator -4 -F -T x \${RDP_SERVER}; done" >/tmp/xinitrc
    	      echo "/bin/xinit -- /ltsbin/\${XSERVER}" >/tmp/start_ws
    	      ;;
    
    .
    w
    q
    EOF
    

    Finally, edit /tftpboot/lts/ltsroot/etc/lts.conf and set UI_MODE to RDP and SERVER to the IP address of your NT4TSE server.

  6. Install and activate the TFTP and NFS servers on your Terminal Server.

    I recommend giving each server a separate directory to work with, eg. c:\tftpboot for the TFTP server and c:\ltsroot for NFS server. You must ensure that the root path you used in the mknbi-linux command in step 3 matches the directory name that you use for the NFS server (without the leading drive letter and colon, and with forward-slashes substituted for back-slashes). Be careful not to compromise the security of your server; your diskless clients only need TFTP access to a single file, and read-only NFS access to their root directory. Initially, however, you must give your Linux development box read-write access to the LTS root directory so that the files can be transferred. Once your diskless PCs are up and running properly you can revoke this access.

    If using the Millwood TFTP server, install by positioning the binary in the desired permanent location and running using tftpds -install and then configure using the new icon which appears in the Control Panel. Make sure that you select Limit to default directory. You will need to manually start the TFTP service after it is installed - the install procedure sets startup to Automatic but doesn't actually start the service.

    Setting up the SFU NFS server is very easy. Once installed from CD (you need only install the NFS server, no other components of SFU are required), just start Windows NT Explorer, right click on on the directory you want to share via NFS and select Sharing.... In the window which appears you will see a new NFS Sharing tab which you can use to activate NFS sharing. Use the Permissions button to set sharing to Read-Only for the default group ALL_MACHINES, and then add an explicit Read-Write permission for your Linux development box.

  7. Copy files from your Linux development box to the correct locations on your NT4TSE server.

    cd /tftpboot/lts
    tftp your-server-name
    binary
    put vmlinuz
    quit
    mount your-server-name:/path-to-ltsroot /mnt
    cd ltsroot
    tar cf - . | (cd /mnt; tar xf -)
    umount /mnt

  8. Set up the DHCP Server on your NT4TSE server.

    N.B.: The DHCP server doesn't work properly straight off the NT4TSE CD. You must apply a Service Pack after installing it; I'm not sure what the minimum Service Pack it needs is, but SP6 does the trick.

    Start DHCP Manager from the menu, double click Local Machine and create a new scope using the option in the Scope menu. It's OK to make use of an existing subnet to host your diskless clients, you don't need a dedicated one. If you do this, however, make sure that you add exclusions for any network entities that already exist on that subnet and aren't diskless PCs, including your Terminal Server itself. Lease Duration should be set to Unlimited.

    Select the newly-created scope and then pick Scope... from the DHCP Options menu. Minimally, add Root Path and Bootfile Name options, and set the values of these appropriately. You must use UNIX conventions here, which means forward-slashes instead of back-slashes and no drive letter prefixes. You will probably want to add some other options as well. Here's what I use:

    OptionValue
    017 Root Path/ltsroot
    028 Broadcast Address10.255.255.255
    030 Mask Supplier Option0x1
    036 Ethernet Encapsulation0x1
    066 Boot Server Host Namenimbus
    067 Boot File Name/tftpboot/vmlinuz

    Now select Add Reservations... from the Scope menu, and add entries for each of your diskless clients, so that there is a one-to-one mapping of ethernet (MAC) addresses onto IP addresses. The MAC address goes into the field named Unique Identifier - just use 12 sequential hexidecimal digits with no separating punctuation. I found that setting Client Name didn't work - the only way I could get the DHCP server to send the client its hostname was to set the 012 Host Name option using the Options... button for every single reservation entry. Mind you, I'm not using WINS or DNS - your mileage may vary.

    Finally activate the scope from the Scope menu.

  9. Set up your diskless PCs for Etherboot.

    This may mean fitting a ROM chip, using a flash programming utility to program a flash PROM, or writing a ROM image to a floppy disk. ROM chips burned with Etherboot ROM images are available from DisklessWorkstations.Com. Free custom ROM images can be generated and downloaded on demand from ROM-o-matic.net. To prepare a bootable floppy using a floppy-boot ROM image, just use your Linux box to dd it to /dev/fd0H1440 or use rawrite.exe from Windows.

  10. Configure LTS, boot client PCs and perform fine-tuning.

    At this point you should read the LTSP doco and set up lts.conf file as appropriate. Note that in a Windows-only server environment we will not be able to make use of LTSP's advanced features such as the Font Server, Remote Apps and floppy disk/printer support.

    If all goes well you should now be able to get at least as far as booting Linux. You'll probably need to do quite a bit of additional fine-tuning to get the X server working with your particular brands of video cards and monitors.

    If you are using WordPad or similar to edit your configuration files, be careful not to inadvertently introduce carriage-return characters into the file as this can mess things up quite badly (as I discovered). In particular, be careful when doing Windows cut-and-paste operations. It's probably safer to NFS-mount ltsroot onto your Linux box and edit from there.