How to Setup Diskless Booting in RHEL5

Under Contruction

The method for booting workstations via NFS in RHEL4 is well documented and works reasonably well. The same process can be used in RHEL5, but at the current time the necessary tools have not been made available. Details can be found here:

http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/sysadmin-guide/ch-diskless.html

This document describes how to acquire the necessary tools and discusses some of the issues that you will encounter and how to solve them.

Install the Required Software

You need to designate a machine for use as the netboot server. This machine needs the following package (as a minimum) and its dependencies.

  • system-config-netboot

This package is not available (yet) for RHEL5. Take the package from Fedora 6 and install it, but note the required packages below.

You next need to create a client template. This is done by installing the target version of linux on a workstation that is identical (or at least similar) to the workstations that will be booted via nfs.

It’s important to install the following package on the client machine.

  • busybox-anaconda

Patch Sofware

disklessrc

The disklessrc file contains an error that will result in the snapshot directory being mounted read-only.

/usr/share/system-config-netboot/diskless/disklessrc
--- disklessrc.saved    2006-06-08 00:28:54.000000000 +0200
+++ disklessrc  2008-03-31 15:21:38.000000000 +0200
@@ -349,7 +349,7 @@
 
 if [ "${INITRD_DBG}" = "6" ]; then exec /bin/bash; fi
 echo Mounting Snapshot directories
-mount -t nfs $NFS_IP:${NFS_DIR}/snapshot /.snapshot -o rw,nolock &&
+mount -n -t nfs $NFS_IP:${NFS_DIR}/snapshot /.snapshot -o rw,nolock &&
 {
     for i in `grep -v "^#" /.snapshot/files`; do 
        if [ -e $i ]; then 

mount.nfs

The pxeboot scripts do not included a required binary, mount.nfs when building the RAM disk image. Without this binary included on the disk you will get an error similar to the following.

mount: wrong fs type, bad option, bad superblock on server:mountpoint,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

The easiest solution is to modify the following file to automatically add mount.nfs to the RAM disk.

/usr/share/system-config-netboot/diskless/updateDiskless

while we are modifying this file, we may as well correct another annoying (but not serious) bug. Here are the differences:

--- updateDiskless.saved        2006-06-08 00:28:54.000000000 +0200
+++ updateDiskless      2007-09-18 21:31:46.000000000 +0200
@@ -114,7 +114,7 @@
 done;
 #/bin/cp "$ROOT"/usr/share/hwdata/pcitable $MNTPOINT/usr/share/hwdata/ || die;
 # disklessrc now uses modules.pcimap, not pcitable
-BINS="/sbin/busybox.anaconda /sbin/insmod /sbin/modprobe /sbin/rmmod /sbin/dhclient /bin/bash /bin/mount /sbin/route /sbin/ip /usr/bin/expr /sbin/lspci /sbin/ifconfig /sbin/consoletype /sbin/pivot_root /bin/hostname /bin/domainname /usr/bin/host"
+BINS="/sbin/busybox.anaconda /sbin/mount.nfs /sbin/insmod /sbin/modprobe /sbin/rmmod /sbin/dhclient /bin/bash /bin/mount /sbin/route /sbin/ip /usr/bin/expr /sbin/lspci /sbin/ifconfig /sbin/consoletype /sbin/pivot_root /bin/hostname /bin/domainname /usr/bin/host"
 # Set up links to all the busybox functions -
 # may be different for different versions of busybox!
 if [ ! -e $ROOT/sbin/busybox.anaconda ]; then 
@@ -296,7 +296,7 @@
        SEMLS=':s0';
    fi;
 fi
-if [ "$SELINUX" -eq 1 ]; then
+if [ $((SELINUX+0)) -eq 1 ]; then
    /usr/bin/chcon -t fsadm_tmp_t $img >/dev/null 2>&1;
    # under new SELinux, mke2fs/tune2fs can only create filesystems in files with this context
 fi

pxeboot.py

There is another problem that requires that “ramdisk_blocksize=1024” be appended to the kernel command line when booting the clients. Without this, you will get an error similar to the following.

attempt to access beyond end of device
ram0: rw=0, want=18446744056529682440, limit=32768
isofs_fill_super: bread failed, dev=ram0, iso_blknum=17, 
block=-2147483648
No filesystem could mount root, tried:  ext2 iso9660
Kernel panic - not syncing: VFS: Unable to mount root fs on 
unknown-block(1,0)

The easiest thing to do is to edit the following file.

/usr/share/system-config-netboot/pxeboot.py

Again, there are some additional changes that you may want to make, specifically,

  • default serial port settings
  • A fix for snapshot option not working. The ‘-S’ option doesn’t work, while –snapshot does.

Here are the differences.

--- pxeboot.py.saved    2006-06-08 00:28:53.000000000 +0200
+++ pxeboot.py  2007-09-19 11:32:54.000000000 +0200
@@ -60,9 +60,9 @@
         self.ramdisk = None
         self.setEthernet("eth0")
         self.os=None
-        self.setSerial(FALSE)
-        self.setSerialUseSystemConsoleAlso(FALSE)
-        self.setSerialSpeed(9600)
+        self.setSerial(TRUE)
+        self.setSerialUseSystemConsoleAlso(TRUE)
+        self.setSerialSpeed(57600)
         self.setSerialParity('n')
         self.setSerialDataBits('8')
         self.NISdomain=None
@@ -249,7 +249,7 @@
         if r == 0:
             return ""
         else:
-            return "ramdisk_size="+str(r)
+            return "ramdisk_size="+str(r)+" ramdisk_blocksize=1024"
 
     def setKickstart(self,kickstart):
         self.kickstart=kickstart
@@ -474,7 +474,7 @@
     progname = os.path.basename(sys.argv[0])
 
     try:
-        opts, args = getopt.getopt(cmdline, "asmde:K:r:O:lh", ["add","modify","delete", "kickstart=","snapshot=","ramdisk=","serial", "ethernet=","os=","list","help"])
+        opts, args = getopt.getopt(cmdline, "asmde:K:r:O:S:lh", ["add","modify","delete", "kickstart=","snapshot=","ramdisk=","serial", "ethernet=","os=","list","help"])
         for opt, val in opts:
             
             if opt == '-a' or opt == '--add':

scsi.modules

If there are additonal modules that need to be loaded, then adding a file /etc/sysconfig/modules can be done.

/etc/sysconfig/modules/scsi.modules
#!/bin/bash
modprobe mptspi
echo "stabilized --hash --interval 250 /proc/scsi/scsi" | /sbin/nash --quiet
echo "raidautorun /dev/md0" | /sbin/nash --quiet

In this example, the mpt fusion drivers are loaded, then nash is used to wait for them to appear and to start and RAID devices.

 
howto/diskless.txt · Last modified: 2008/03/31 20:05 by dpotter