Netboot: Difference between revisions
imported>Dhxgit m Port 4011 is needed to successfully netboot UEFI systems -> https://github.com/danderson/netboot/blob/master/pixiecore/README.booting.md#step-15-pxe-ish |
imported>Janik m updated link of pixiecore to the current version |
||
Line 55: | Line 55: | ||
=== See also === | === See also === | ||
NixOS: [https://search.nixos.org/options?channel= | NixOS: [https://search.nixos.org/options?channel=22.11&from=0&size=30&sort=relevance&type=packages&query=services.pixiecore Pixiecore module]. | ||
NixOS manual: [https://nixos.org/nixos/manual/index.html#sec-booting-from-pxe PXE booting]. | NixOS manual: [https://nixos.org/nixos/manual/index.html#sec-booting-from-pxe PXE booting]. |
Revision as of 00:50, 26 December 2022
Building and serving a netboot image
Example
This example uses Pixiecore for hosting, which works in an ordinary network environment with an existing DHCP server.
#!/usr/bin/env bash
set -euo pipefail
nix-build --out-link /tmp/netboot - <<'EOF'
let
bootSystem = import <nixpkgs/nixos> {
# system = ...;
configuration = { config, pkgs, lib, ... }: with lib; {
imports = [
<nixpkgs/nixos/modules/installer/netboot/netboot-minimal.nix>
];
## Some useful options for setting up a new system
services.getty.autologinUser = mkForce "root";
# users.users.root.openssh.authorizedKeys.keys = [ ... ];
# console.keyMap = "de";
};
};
pkgs = import <nixpkgs> {};
in
pkgs.symlinkJoin {
name = "netboot";
paths = with bootSystem.config.system.build; [
netbootRamdisk
kernel
netbootIpxeScript
];
preferLocalBuild = true;
}
EOF
n=$(realpath /tmp/netboot)
init=$(grep -ohP 'init=\S+' $n/netboot.ipxe)
nix build -o /tmp/pixiecore nixpkgs.pixiecore
# Start the PXE server.
# These ports need to be open in your firewall:
# UDP: 67, 69, 4011
# TCP: 64172
sudo /tmp/pixiecore/bin/pixiecore \
boot $n/bzImage $n/initrd \
--cmdline "$init loglevel=4" \
--debug --dhcp-no-bind --port 64172 --status-port 64172
See also
NixOS: Pixiecore module.
NixOS manual: PXE booting.
netboot.xyz
There is now official netboot.xyz support. Just select NixOS from Linux installs and you should be ready to go.
Note: Your iPXE must be recent enough to support https:// links