PXE // NetBSD

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

Introduction

It is good to keep amd64/binary/sets/ as this is the default path used by sysinst.

The netbsd PXE loader seeks for netbsd by default, so you could symlink netbsd-INSTALL.gz from it. Hence it is best NOT to use netbsd/ as folder because it will conflict with the default kernel seek (NFS2ERR_ISDIR), even if you do the tricky NetBSD:i386:libsa thingy to point to another file.

Note – interesting patch about serial baud rate

MWE

    mirror=https://nycdn.netbsd.org/pub/NetBSD-daily

mkdir -p /tftpboot/netbsd9/installation/misc/
cd /tftpboot/netbsd9/installation/misc/
wget -q $mirror/installation/misc/pxeboot_ia32.bin

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

Full sets from France

sync everything but the X sets from the FR mirror (it is one day late)

remote=rsync://rsync.fr.netbsd.org/NetBSD-daily

mkdir -p /tftpboot/netbsd9/
rsync -avz --delete-after --exclude 'binary/sets/x*.tar.xz' $remote/netbsd-9/latest/amd64/ /tftpboot/netbsd9/
# --exclude 'binary/sets/x*.tgz' for <=netbsd8
ls -alF /tftpboot/netbsd9/
chown -R root:root /tftpboot/netbsd9/

Full sets from NYC

or grab the sets from NYC directly (has no rsync)

mirror=https://nycdn.netbsd.org/pub/NetBSD-daily

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

Step 1 - PXE setup

Chaining pxelinux.0 and pxeboot_ia32.bin together

vi /tftpboot/pxelinux.cfg/default

label netbsd install
    kernel netbsd9/installation/misc/pxeboot_ia32.bin

It’s good to interact with the netbsd boot loader manually for validation, so you get back to the prompt when ever loading a kernel fails.

The loader wants NFS by default, but then you need to enable NFS version 2

boot netbsd
boot nfs:netbsd

You can otherwise enforce tftp as such

boot tftp:netbsd

Step 2 - TFTP and default kernel

avoid the NFS V2 trickery AND the dirty symlink

Differenciate the hardware BOOTP/DHCP requests from the NetBSD’s boot-loader to enforce TFTP AND provice a file path. See client classification for more details.

vi /etc/dhcp/dhcpd.conf

    # pxeboot_ia32.bin got loaded by pxelinux menu
    # enforcing TFTP instead of NFS and offering a path for the default kernel
    if substring (option vendor-class-identifier, 0, 17) = "NetBSD:i386:libsa" {
        if filename = "netbsd" {
            filename "tftp:netbsd9/binary/kernel/netbsd-INSTALL.gz";
        }
    }

Additional notes

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

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

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

Troubleshooting

tftp

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

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)

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

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/

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


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun