Skip to content

Netboot

Krijn Doekemeijer edited this page Feb 8, 2023 · 1 revision

Eventually we want to be able to restore devices through netboot, currently this is still a work in progress. We document the steps we can already reliably execute, and some remaining issues. Our ideas are based on https://ubuntu.com/server/docs/install/netboot-amd64.

  1. sudo apt install dnsmasq # Install dnsmasq
  2. vim /etc/dnsmasq.conf.d/pxe.conf # Setup our DHCP stuff and enable tftp
#
interface=<the interface that connects the nodes>,lo
bind-interfaces
dhcp-range=<the interface that connects the nodes>,192.168.0.100,192.168.0.200
dhcp-boot=<boot file that we created later>
enable-tftp
tftp-root=/srv/tftp
  1. After each change to the the DHCP conf do: sudo systemctl restart dnsmasq.service Also ensure that systemd-resolve is not conflicting, and kill processes that are running on the DHCP ports.
  2. Download necessary files to tftp (so they can be downloaded)
apt download shim-signed
dpkg-deb --fsys-tarfile shim-signed*deb | tar x ./usr/lib/shim/shimx64.efi.signed -O | sudo tee -a /srv/tftp/bootx64.efi
apt download grub-efi-amd64-signed
dpkg-deb --fsys-tarfile grub-efi-amd64-signed*deb | tar x ./usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed -O | sudo tee -a /srv/tftp/grubx64.efi
apt download grub-common
dpkg-deb --fsys-tarfile grub-common*deb | tar x ./usr/share/grub/unicode.pf2 -O | sudo tee -a /srv/tftp/unicode.pf2
  1. move Linux files as well (replace with what version you want e.g. Jammy):
wget http://cdimage.ubuntu.com/ubuntu-server/daily-live/current/focal-live-server-amd64.iso
mount ubuntu-19.10-live-server-amd64.iso /mnt
cp -r /mnt/casper/ /srv/tftp/
  1. vim /srv/tftp/grub/grub.cfg # Enable the grub boot
set default="0"
        set timeout=-1
        
        if loadfont unicode ; then
          set gfxmode=auto
          set locale_dir=$prefix/locale
          set lang=en_US
        fi
        terminal_output gfxterm
        
        set menu_color_normal=white/black
        set menu_color_highlight=black/light-gray
        if background_color 44,0,30; then
          clear
        fi
        
        function gfxmode {
                set gfxpayload="${1}"
                if [ "${1}" = "keep" ]; then
                        set vt_handoff=vt.handoff=7
                else
                        set vt_handoff=
                fi
        }
        
        set linux_gfx_mode=keep
        
        export linux_gfx_mode
        
        menuentry 'Ubuntu 22' {
                gfxmode $linux_gfx_mode
                linux /casper/vmlinuz $vt_handoff quiet splash
                initrd /casper/initrd
        }
  1. reboot target and in BIOS options make sure to use network boot (ethernet). Then it should boot into grub automatically.

Current complications:

  • We get errors with stdin during booting Ubuntu and immediatly move into initramfs.
  • We do not get access to the internet
Clone this wiki locally