This script is an opinionated helper to bootstrap and configure Raspberry Pi computers to boot from wired network via PXE (Preboot eXecution Environment). I am developing it along writing a more detailed blog post about out how to bootstrap manually. It is currently work in progress and only tested on Raspberry Pi 4 with Raspberry Pi OS Lite (64 bit, Debian Bullseye). It does the following things:
- Upgrade system packages
- Install screen, and unattended upgrades
- Deactivate wlan
- Deactivate swap
- Switch network management to systemd-networkd
- Switch network address resolution to systemd-resolved
- Configure network interface
- Initialize remote filesystems
- Configure filesystem table and boot options
- Update network boot EEPROM
You can execute the script directly from the repository with the following command.
sh -c "$(curl -sL https://raw.githubusercontent.com/krgr/raspberry-pi-pxe-bootstrap/main/install.sh)"
If you clone the repository locally, you can run it locally via ./install.sh
.
The script by default presents a menu that allows you to select to (b)ootstrap netwoork boot, (c)heck bootloader config, or (e)exit. It will ask for reboots, and you need to run the script multiple (3) times to finish the full bootstrapping. if you want to execute just parts of the script, you can pass the corresponding functions as a parameter. The accepted parameters are:
bootstrap
: simply bypassing the menu and starting a full bootstrapupdate_system
: update packages, install additional packagesdisable_wifi
: disable wpa_supplicant, configure disabled wifidisable_swap
: disables the local swap fileswitch_network_daemon
: switches from dhcpcd and openresolv to systemd-networkd and -resolvedinit_remote_filesystems
: configures and initializes remote root and boot partisions, flashes EEPROMbootloader_config
: check / print bootloader config
Example:
./install.sh update_system
The script recognizes the following environment variables
NAS_IP
: pass the default IP to use for mounting network storage during the NFS initialization, and for initial tftpboot (DHCP)