PXE booting with sysrec.dat on an nfs share

All other questions
Post Reply
Posts: 9
Joined: 06 Mar 2006, 21:12

PXE booting with sysrec.dat on an nfs share

Post by cdsteinkuehler » 19 Jun 2007, 22:05

I recently worked on getting sysrcd 0.3.6 booting from the network using pxe and nfs (ie: no cdrom involved). The details of configuring this to actually work well are slightly non-obvious (at least to me!), so I thought I'd share my setup, in case anyone else needs to do the same thing.

The obvious parts:
  • Get the 0.3.6 version of the system rescue CD.

    Extract the CD contents to your nfs share

    Unpack/patch/repack the initial ramdisk image, fixing the busybox udhcpc client bug: http://www.sysresccd.org/forums/viewtopic.php?t=1534
    If desired, you can make your initrd file a few hundred KB smaller by removing some .svn directories: http://www.sysresccd.org/forums/viewtopic.php?t=1533
    NOTE: These modifications may not be required if they are incorperated into a later verison of sysrcd (check the changelog).

    Make the kernel and new initrd file accessable via tftp

    Configure your PXE loader (I use pxelinux with menu.c32 from the syslinux folkx) with appropriate nfs boot options. I use the settings from the default CD boot entry and added the following two settings for NFS:
At this point if you have everything properly setup, the machine will boot via pxe, pxelinux will load the sysrcd kernel and initial ramdisk, the nfs share will be mounted read-only, the squashfs in sysrcd.dat will be mounted, and the init scripts will start running...

...then everything blows up becuase the auto-detect scripts disable the network interface, which pretty much kills the nfs client and takes the root filesystem along with it! :cry:

While there are lots of potential work-arounds for this, I found the following combination of sysrcd and gentoo features to work the best for me:
  • Use the "/add/ directory with *.tar.gz files" sysrcd feature to overlay some customized configuration files on the ram-based root filesystem. This allows you to specify a real network configuration.

    Use gentoo's softlevel feature to avoid having the autodetect scripts overwirte your desired network configuration.
Start by making an etc directory structure somewhere:
  • mkdir /tmp/etc
    mkdir /tmp/etc/conf.d
    mkdir -p /tmp/etc/runlevels/boot
Then create a configuration file for the network. The following file says to do nothing (noop) if the interface was configured (ie: setup by udhcpc in the /linuxrc script when it mounted our nfs share) or use dhcp if the interface is currently not configured. I also disable hot-plugging, which was always seeming to erase the network configuration in my tests, but I may just not know enough about gentoo to make it work.

Code: Select all

# cat etc/conf.d/net.pxe
modules_eth0=( "!plug" )
config_eth0=( "noop" "dhcp" )
To finish the confiugration, a couple of symlinks need to be created so eth0 will be configured at boot time and the new custom runlevel exists:
  • ln -s /etc/init.d/net.eth0 /tmp/etc/runlevels/boot
    ln -s default /tmp/etc/runlevels/pxe
Now tar/gzip your configuration files and add it to your nfs sysrcd image in the "add" directory:
  • cd /tmp
    tar -czvf /tmp/config.tar.gz etc
    mkdir /home/nfs/sysrcd/0.3.6/add
    cp /tmp/config.tar.gz /home/nfs/sysrcd/0.3.6/add/
Finally, you need to configure your pxe boot loader to pass one more kernel parameter to specify a custom runlevel, ie: softlevel=pxe

References: Changelog
  • Aug. 23 2007 - Updated config.tar.gz creation instructions fixing issue pointed out by NewSonya
Last edited by cdsteinkuehler on 23 Aug 2007, 18:17, edited 1 time in total.

Posts: 2
Joined: 03 Jul 2007, 13:23
Location: Russia

Post by NewSonya » 03 Jul 2007, 13:38

Cool, it really works!
Many thanks for the solution.

But in initrd it is necessary to add the driver for NIC. I use 3c0m and realtek (3c59x.ko and 8139cp.ko).
Accordingly it is necessary to add lines in /etc/modules/net in rescuecd.igz

The command creates archive with /tmp/ inside:
tar -czvf /tmp/config.tar.gz /tmp/etc
Will be more correct so:
cd /tmp
tar -czvf config.tar.gz *

And one more problem which I and could not solve:
through dhcp does not writes to the file /etc/resolv.conf parameters of a DNS server.

Posts: 5
Joined: 05 Jul 2007, 14:05

Post by Mel » 05 Jul 2007, 14:33

Yes ! Exactly what y need !

Works fine for me too, i tryed with the 3.7beta3, so i havent had to patch the udhcpc bug ^^.

Just a small thing, i couldn't start the x server (got a no keyboard error ...), wonder if it's a beta bug ...or not ...

i take a look at my resolv.conf just in case ... if i got the same problem too ...

keep in touch ^^ and thanks a lot !!!

Site Admin
Posts: 2715
Joined: 17 Jul 2003, 09:44

Post by admin » 05 Jul 2007, 17:37

The problem with XOrg is fixed in 0.3.7-beta4

Posts: 5
Joined: 05 Jul 2007, 14:05

Post by Mel » 06 Jul 2007, 13:39

Thanks for the new beta xORG works fine now !

I look at my resolv.conf and i got the same problem as NewSonya, it sticks with 192.168.x.x (something like that ...)

I haven't any default route also.

I use the net-setup command to give it a try and the configuration applied correctly.

But (don't know if i should ask in this thread or in the beta forum ...) when i try to launch gparted, he doesn't recognize the partition on my disk, haven't thoroughly search but, i can mount the partition and use partimage though.

So in any case, if it seems interesting for someone ...

Posts: 2
Joined: 03 Jul 2007, 13:23
Location: Russia

Post by NewSonya » 08 Jul 2007, 20:15

I have also tried booting on a network of the Knoppix distributive. It too is based on Debian. There parameters of a DNS server were defined normally. In a resolv.conf file true parameters have been written down. Maybe take startup script from there?

Posts: 12
Joined: 11 Jul 2007, 23:31

Post by namit » 09 Aug 2007, 00:33

what does this mean

Unpack/patch/repack the initial ramdisk image, fixing the busybox udhcpc client bug: http://www.sysresccd.org/forums/viewtopic.php?t=1534 where do i get this ram disk from ?

Posts: 1
Joined: 28 Aug 2008, 10:33

Post by Deker » 28 Aug 2008, 10:35

Yeah! Thanks! Works fine. Thanks a lot!

Post Reply