PXE booting

I'm attempting to get PXE booting working on my network and have almost got it working, save for setting up the intial bootloader, which according to various sources can use
either gpxelinux.0 :- http://www.wonkity.com/~wblock/docs/html/pxe.html

or /boot/pxeboot https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-diskless.html

The first article, which I followed religiously, contains an outdated link, however I did manage to find a newer version of SYSLINUX although the archive did not contain the files mentioned, only the sources. Am I expected to build them on my system? The article does not suggest this is necessary


The other item, from The Handbook mentions a couple of options for dhcpd.conf namely:-

Code:
   # path of boot loader obtained via tftp
     filename "FreeBSD/install/boot/pxeboot" ;

   # pxeboot boot loader will try to NFS mount this directory for root FS
   option root-path "192.168.0.1:/b/tftpboot/FreeBSD/install/" ;


How am I supposed to interpret FreeBSD/install in the above option?

I presume this isn't a literal string.
 
You downloaded the wrong Syslinux archive. The right one has the binaries, not the sources. http://www.syslinux.org/ is temporarily down right now, so I can't post the exact link.

There is a port, which I have not tried recently, but it should build the binaries from source: sysutils/syslinux.

The PXE article is almost always in need of updating, sorry about that.
 
Your article was really excellent and very clear, so much so that getting PXE booting was almost a breeze. PXE booting was something I'd never managed successfully, although I first setup remote booting under OS/2 20 years ago.
IBM called it RIPL http://en.wikipedia.org/wiki/Remote_Initial_Program_Load.

As for your article, I only managed to get Reboot working initially :). mfsbsd didn't work because of a typo:-

Code:
# cp /tmp/mfsbsd-9.1-RELEASE-i386.img /usr/tftpboot/images/mfsbsd/mfsbsd

I'm now trying to iron out what I've missed in the other options, but I'm very please to have it set up. It's a great alternate to having a YUMI multiboot USB pendrive, although I'd still like to add a few options which have with YUMI such as being able to initiate a Windows install from an ISO on a USB stick.
 
Sorry, could you be more specific about the typo? It does look like I should be more specific and just gzip the mfsBSD image in the first place.

It should be possible to write a program that would take a complete menu-based PXE setup like this and put it on a memory stick. Menu options that depend on network filesystems will not work, of course, but any that provide an image direct from the disk will.
 
wblock@ said:
Sorry, could you be more specific about the typo?

Shouldn't this:

cp /tmp/mfsbsd-9.1-RELEASE-i386.img /usr/tftpboot/images/mfsbsd/mfsbsd

be this?

cp /tmp/mfsbsd-9.1-RELEASE-i386.img /usr/tftpboot/images/mfsbsd/mfsbsd.gz
 
wblock@ said:
The PXE article is almost always in need of updating, sorry about that.

An update would be really useful... particularly for Clonezilla which I can't get working at all... It ends up with:-
Code:
/bin/sh: can't access tty; job control turned off
(initramfs)
 
balanga said:
wblock@ said:
Sorry, could you be more specific about the typo?

Shouldn't this:

cp /tmp/mfsbsd-9.1-RELEASE-i386.img /usr/tftpboot/images/mfsbsd/mfsbsd

be this?

cp /tmp/mfsbsd-9.1-RELEASE-i386.img /usr/tftpboot/images/mfsbsd/mfsbsd.gz

No. The tip mentions that it can be compressed, but that is a separate step. The instructions should just gzip() it as part of the procedure.
 
I'm attempting to get PXE booting working on my network and have almost got it working, save for setting up the intial bootloader, which according to various sources can use
either gpxelinux.0 :- http://www.wonkity.com/~wblock/docs/html/pxe.html

or /boot/pxeboot https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/network-diskless.html


The other item, from The Handbook mentions a couple of options for dhcpd.conf namely:-

Code:
   # path of boot loader obtained via tftp
     filename "FreeBSD/install/boot/pxeboot" ;

   # pxeboot boot loader will try to NFS mount this directory for root FS
   option root-path "192.168.0.1:/b/tftpboot/FreeBSD/install/" ;


How am I supposed to interpret FreeBSD/install in the above option?

I presume this isn't a literal string.


I have religiously followed the FreeBSD/install route today including things like make buildworld and make buildkernel which took many hours and after correct many errors and omissions I thought I'd see how well it all went. It looked promising when I saw:
Code:
BTX loader 1.00 BTX version is 1.02
on my laptop. But then:
Code:
NFS MOUNT RPC error: 72
/
can't load 'kernel'

Please help.

I did notice a thread on the FreeBSD mailing list with a similar problem: http://FreeBSD.1045724.n5.nabble.com/Previously-working-PXE-setup-now-fails-td5919662.html but couldn't figure out what was wrong or how to fix it.
 
I did notice a thread on the FreeBSD mailing list with a similar problem
Nah, that was a different problem and I don't recall exactly what I did to solve it. The main lesson from that thread however, is how and why NFSv4 does not work for root:
As I think I've mentioned before, a NFSv4 root fs won't work, so don't bother trying...
(Because) client mount needs a unique identifier for the client machine. The host uuid used for this is set during booting. To make an NFSv4 root fs to work, there needs to be some way to generate a unique identifier for the machine before it accesses the root fs.

Anyway, with regards to your problem:
  • Simplify your setup to get PXE working, then gradually add features you want. If a new feature (complication you add) results in breakage, you will have a better clue on where to look. Therefore, you are correct in using the BTX boot-loader for now before adding the custom boot-loader feature.
  • I assume that you are able to mount the exported NFS directories on your laptop when you boot it normally (non-PXE)? What is the NFS version shown for exported root (v3 vs v4)?
  • That error happens before the BTX menu gets displayed right? In the exported root path's boot folder: Do you have the kernel folder and have you placed correct settings in loader.conf (not system root but NFS exported root)?
  • Have you enabled these options in the kernel configuration file?
Code:
options    NFSCL     # Network Filesystem Client
options    NFS_ROOT   # NFS usable as /, requires NFSCL

Your first objective is to get to the BTX loader menu, where you will have some command capability (like list kernel modules and mount-paths).
 
It looks as though nfsd is not working properly.

I'm using FreeBSD 10.0, so the nfsd that comes with that, but I notice when starting nfsd it says NFSv4 is disabled. I also notice showmount does not show /etc/exports correctly after it has been updated, I need to separately restart mountd first. I was under the impression that restarting nfsd automatically restarted mountd.
 
Last edited by a moderator:
As I suggested,
  1. Get exports working on host
  2. Connect to those exported NFS folders over the network from a separate (Linux laptop for example) client.
 
Just as a follow up the error
Code:
NFS MOUNT RPC error: 72
has now disappeared but I still get
Code:
/
can't load 'kernel'

Any suggestions as to how to make some progress? Could this be a permissions problem or something to do with the path?
 
It seems I misunderstood your previous post. I thought that entry was one of several in exports.
  • Does this file exist? /b/tftpboot/FreeBSD/install/boot/kernel/kernel?
  • Anything of significance in /var/log/xfer.log?
  • Can you confirm that the kernel you have placed in above directory was built with below? These are needed for the client machines to read from NFS. NFSCL is not loadable as a module when it comes to PXE, and needs to be in the kernel.
Code:
options    NFSCL     # Network Filesystem Client
options    NFS_ROOT   # NFS usable as /, requires NFSCL
 
I keep changing /etc/exports in an effort to try and make some progress. It currently has that single entry which I am able to mount.

The kernel file does exist and as for building it, that was simply done by following the instructions in The Handbook

https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-diskless.html

Those instructions do not mention the options you refer to. In any case I wouldn't know how to build with those options. I am assuming that the instructions in The Handbook are correct.
 
In that Handbook document it also states:
Refer to diskless(8) for more information.
The referenced man page states:
The kernel for the diskless clients, which will be loaded using NFS or TFTP, must include support for the NFS client:
options NFSCL
options NFS_ROOT
If you are using a boot mechanism that does not pass network configuration to the kernel using the kernel environment, you will also need to include the following options (MY EDIT: when using Grub for example):
options BOOTP
options BOOTP_NFSROOT
options BOOTP_COMPAT
Note: the PXE environment does not require these options.
The diskless booting environment relies on memory-backed file systems to support temporary local storage in the event that the root file system is mounted read-only; as such, it is necessary to add the following to the device section of the kernel configuration:
device md

Kernel configuration is documented: https://www.freebsd.org/doc/handbook/kernelconfig-config.html. Create the file MYKERNEL in /usr/src/sys/amd64/conf with:
Code:
include GENERIC
ident MYKERNEL

options NFSCL
options NFS_ROOT
# make -C /usr/src/ buildkernel KERNCONF=MYKERNEL
 
In that Handbook document it also states:

The referenced man page states:

Kernel configuration is documented: https://www.freebsd.org/doc/handbook/kernelconfig-config.html
Create the file MYKERNEL in /usr/src/sys/amd64/conf with:
Code:
include GENERIC
ident MYKERNEL

options NFSCL
options NFS_ROOT
# make -C /usr/src/ buildkernel KERNCONF=MYKERNEL

It looks as though these options are already in GENERIC, so the chances are that when I ran make buildkernel the KERNEL was built with the correct option, although maybe this is something I could check if I knew what to look for.
 
It looks as though these options are already in GENERIC, so the chances are that when I ran

make buildkernel

the KERNEL was built with the correct option, although maybe this is something I could check if I knew what to look for...

Run sysctl kern.conftext | grep the_option_you_are_looking_for.
 
You are misspelling it and so am I. This is the correct one:

Code:
% sysctl kern.conftxt | grep NFS
options NFS_ROOT
options NFSLOCKD
options NFSD
options NFSCL
 
sysctl kern.conftxt will display the kernel configuration only if you have included
Code:
options INCLUDE_CONFIG_FILE
It looks as though these options are already in GENERIC
Yep, you're right. The latest GENERIC seems to have that already.

What about the contents of /var/log/xfer.log? You should see something like:
Code:
RRQ from <IP> filename FreeBSD/install/boot/pxeboot
Also, dmesg and messages may yield some clues. Failing these, you'll have to run wireshark, or tcpdump -w out.pcap -i <iface_name> then read that out.pcap file in wireshark.

What architecture (amd64, i386, arm) are the clients?
 
I finally figured out what I had done wrong!

It was simply a question of paths. Once I changed /usr/local/etc/dhcpd.conf to
Code:
option root-path "/b/tftpboot/FreeBSD/install";
rather than
Code:
option root-path "/b/tftpboot";
everything worked as it should... finally.

I think my confusion stems from The Handbook https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-diskless.html

which states:
31.8.1. Setting Up the PXE Environment
Written by Craig Rodrigues.
The steps shown in this section configure the built-in NFS and TFTP servers. The next section demonstrates how to install and configure the DHCP server. In this example, the directory which will contain the files used by PXE users is /b/tftpboot/FreeBSD/install. It is important that this directory exists and that the same directory name is set in both /etc/inetd.conf and /usr/local/etc/dhcpd.conf.

In the example shown, it is not the case:-

  1. Uncomment the following line in /etc/inetd.conf by making sure it does not start with a # symbol:

    tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /b/tftpboot
 
Back
Top