PXE // NetBSD

See PXE Setup for overall instructions. This is NetBSD specific.

Tracking Daily

look-up for the latest major release branch snapshot and fetch everything but the X sets

w/ rsync (FR is one-day-late)

mkdir -p /tftpboot/netbsd9/
time=201910070020Z
remote=rsync://rsync.fr.netbsd.org/NetBSD-daily/netbsd-9/$time/amd64
#remote=rsync://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-9/latest/amd64

rsync -avz --delete-after --exclude 'binary/sets/x*.tar.xz' $remote/ /tftpboot/netbsd9/amd64/
#--exclude 'binary/sets/x*.tgz' for <=netbsd8

or w/ wget (NY seems up-to-date but has no rsync)

mkdir -p /tftpboot/netbsd9/
remote=https://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-9/latest/amd64/

mkdir -p /tftpboot/netbsd9/amd64/binary/sets/
cd /tftpboot/netbsd9/amd64/binary/sets/
for set in kern-GENERIC modules base comp debug etc man misc tests text; do
       echo -n fetching binary/sets/$set.tar.xz...
       wget -q $remote/binary/sets/$set.tar.xz && echo done
done; unset set

mkdir -p /tftpboot/netbsd9/amd64/binary/kernel/
cd /tftpboot/netbsd9/amd64/binary/kernel/
wget -q $remote/binary/kernel/netbsd-INSTALL.gz && echo netbsd-INSTALL.gz
wget -q $remote/binary/kernel/netbsd-INSTALL_XEN3_DOMU.gz && echo netbsd-INSTALL_XEN3_DOMU.gz
wget -q $remote/binary/kernel/netbsd-XEN3_DOMU.gz && echo netbsd-XEN3_DOMU.gz

mkdir -p /tftpboot/netbsd9/amd64/installation/misc/
cd /tftpboot/netbsd9/amd64/installation/misc/
wget -q $remote/installation/misc/pxeboot_ia32.bin && echo pxeboot_ia32.bin

Setup

Chaining pxelinux.0 and pxeboot_ia32.bin together (that works, the hard part comes later). It is best not use netbsd/ as folder because it might conflict with the default files it’s searching for (NFS2ERR_ISDIR), even if you do the tricky NetBSD:i386:libsa thingy to point to another file.

cd /tftpboot/
ln -sf netbsd9/amd64/installation/misc/pxeboot_ia32.bin
ln -sf netbsd9/amd64/binary/kernel/netbsd-INSTALL.gz netbsd
vi /tftpboot/pxelinux.cfg/default

label netbsd install
    kernel pxeboot_ia32.bin

This needed heavy troubleshooting.

Subject: PXE netboot regression https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54560 http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/i386/stand/pxeboot/Makefile?rev=1.28&content-type=text/x-cvsweb-markup&only_with_tag=MAIN

Subject: pxeboot TFTP block2+ acks broken https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54561

Subject: pxeboot NFS V2 READ Call into the void https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54562

NFS V2

vi /etc/rc.d/rc.nfsd

  # Start 8 nfsd servers by default (an old Sun standard):
  if [ -x /usr/sbin/rpc.nfsd ]; then
    echo "  /usr/sbin/rpc.nfsd CUSTOM 8"
    /usr/sbin/rpc.nfsd --nfs-version 2 8
    #/usr/sbin/rpc.nfsd --nfs-version 2 --no-nfs-version 3 --no-nfs-version 4 8
  fi

  if [ -x /usr/sbin/rpc.mountd ]; then
    echo "  /usr/sbin/rpc.mountd CUSTOM"
    /usr/sbin/rpc.mountd --nfs-version 2
    #/usr/sbin/rpc.mountd --nfs-version 2 --no-nfs-version 3 --no-nfs-version 4
  fi

/etc/rc.d/rc.nfsd restart
pgrep -a rpc
pgrep -a nfs
rpcinfo
cat /proc/fs/nfsd/versions

Testing & Validation

It is good to keep amd64/binary/sets/ as this is the default path used by sysinst. And it also avoids playing with dhcpd.conf, inside the subnet stanza (this is the trick to differenciate the hardware BOOTP requests from the NetBSD pxeboot_ia32.bin BOOTP requests).

TFTP

    next-server TFTP-NFS-SERVER;

NFS version 2

    next-server TFTP-NFS-SERVER;
    option root-path "/tftpboot";

It’s also better to interact with the netbsd boot loader manually for validation, so you get back to the prompt when ever loading a kernel fails. DO NOT FORGET TO SPECIFY tftp: otherwise boot through nfs: (the default).

boot tftp:netbsd
boot netbsd

You should ideally enable the NFS flavour of your service otherwise the following might be helpful. The netbsd PXE loader boots netbsd by default and we’ve copied netbsd-INSTALL.gz to netbsd already. But the loader wants NFS by default so this would provide a way to make TFTP the default.

if substring (option vendor-class-identifier, 0, 17) = "NetBSD:i386:libsa" {
    if filename = "netbsd" {
        filename "tftp:netbsd/amd64/binary/kernel/netbsd-INSTALL.gz";
    }
}

PXE loader tuning

Tweaking pxeboot_ia32.bin, but this is only possible from within a NetBSD system

#installboot -v -e -o bootconf,modules pxeboot_ia32.bin
#vi boot.cfg

TFTP Troubleshooting

Unknown error: code 60
boot: Input/output error

==> this just means timeout e.g. it is trying to reach NFS instead of TFTP. Use tftp:.

NFS Troubleshooting

Permission denied
boot: Input/output error

==> wrong NFS root-path syntax for netbsd, try without the IP "/tftpboot";

rpc_call: error = 2
Unknown error: code 72
boot: Input/output error

remote can't support version # (2)

==> V2 vs V3/V4 NFS version issue. pxeboot_ia32 wants V2, as the manual says. See above.

Unknown error: code 45
boot: Input/output error

Error: NFS2ERR_OPNOTSUPP

==> switch to no_subtree_check NFS export… yes, you’re welcome (it took me about 4 hours to figure it out)

BUGS

Subject: pxeboot TFTP block2+ acks broken https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54561

Subject: pxeboot NFS V2 READ Call into the void https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54562

Obsolete - memdisk/floppy

Obsolete method, using memdisk against the floppy installer (DEPRECATED),

wget ftp://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.0.2/i386/binary/kernel/netbsd-INSTALL_FLOPPY.gz
#TODO what is the last release providing floppy?

vi /var/lib/tftpboot/pxelinux.cfg/default

label NetBSD install floppy
kernel memdisk
append netbsd-INSTALL_FLOPPY.gz

Additional Notes

com0

Booting a NetBSD installer from pxelinux http://netbsd.2816.n7.nabble.com/Booting-a-NetBSD-installer-from-pxelinux-td222731.html

Netbooting NetBSD in KVM http://useofwords.blogspot.com/2012/10/netbooting-netbsd-in-kvm.html

pxe booting netbsd-4.0 on a soekris net4501 https://port-i386.netbsd.narkive.com/VxdbavEU/pxe-booting-netbsd-4-0-on-a-soekris-net4501

NetBSD PXE boot Install (without NFS)(转) http://blog.itpub.net/10752019/viewspace-941832/

Resources

installboot – install disk bootstrap software https://netbsd.gw.com/cgi-bin/man-cgi?installboot+8

pxeboot – network boot NetBSD/x86 through a PXE BIOS extension https://netbsd.gw.com/cgi-bin/man-cgi?pxeboot+8

boot – system bootstrapping procedures https://netbsd.gw.com/cgi-bin/man-cgi?x86/boot+8

Diskless NetBSD HOW-TO http://www.netbsd.org/docs/network/netboot/

Introduction (i386-specific), Diskless NetBSD HOW-TO https://www.netbsd.org/docs/network/netboot/intro.i386.html

Netbooting to install to a local hard drive http://www.netbsd.org/docs/network/netboot/local.install.html

NetBSD5-Netzwerkinstallation http://wp.lando.cc/category/operation-systems/netbsd/

how to install(boot) netbsd using pxelinux https://wiki.netbsd.org/tutorials/how_to_install__40__boot__41___netbsd_using_pxelinux/

Netbooting g4u via PXE http://math.uwb.edu.pl/~mariusz/projects/g4u/

Re: pxeboot_ia32.bin boot.cfg support how to? https://mail-index.netbsd.org/netbsd-users/2011/04/19/msg008204.html

Création d'un serveur de démarrage PXE sous NetBSD, pour installer… NetBSD ! http://connect.ed-diamond.com/GNU-Linux-Magazine/GLMF-166/Creation-d-un-serveur-de-demarrage-PXE-sous-NetBSD-pour-installer-NetBSD

trying to build a NetBSD PXE installer with pxelinux https://mail-index.netbsd.org/netbsd-users/2013/08/25/msg013203.html


Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml