Skip to content

Instantly share code, notes, and snippets.

@ams0
Last active January 19, 2025 08:32
Show Gist options
  • Save ams0/24830d9f84e694c5280a1fd0678636f5 to your computer and use it in GitHub Desktop.
Save ams0/24830d9f84e694c5280a1fd0678636f5 to your computer and use it in GitHub Desktop.
PXEboot into an Ubuntu installer

Netboot Talos and headless ubuntu with iPXE and netboot.xyz

  1. Download the iso, extract the files /casper/initrd and /casper/vmlinuz, place them alongside the iso so they can be served over the network. In my case, I use nginx and the base: http://pi.nas.home:8888/ubuntu/
  2. create and serve the metadata, for example: http://pi.nas.home:8888/ubuntu/metadata; create the user-data and the (empty) meta-data file
  3. Add a MAC-specific .ipxe file to netboot.xyz, called exactly MAC-<mac_with_no_:>.ipxe
  4. Boot the machine, wait a little then log in with ubuntu-server user and r00tme password, or using the installer and the SSH key (you can exit the installer from the help menu).

For Talos/Omni

  1. Create the installtion media from Omni, grab the PXE URL, paste it in the browser and copy paste the #ipxe file in netboot.xyz (using the same MAC convention)
  2. Boot the machine and see it appear in Omni!

Note the INSTALLER_META_BASE64 string contains a base64-encode version of the tags, you don't need to regenerate the image to change them. For example, MHhjPW1hY2hpbmVMYWJlbHM6CiAgcHhlOiAnJwogIGhvbWU6ICcnCg== is equal to

0xc=machineLabels:
  pxe: ''
  home: ''

this adds the pxe and home tags.

Unifi Setup

Make sure you set the next server tot he IP of the netboot instance and the file to netboot.xyz.efi; at first I tried the .ikpxe file but was too big for the legacy boot loaders; once I switch all machines to UEFI boot the error went away.

#!ipxe
# ubuntu plucky penguin
# $seedfrom used to find the user-data and meta-data files by nocloud-net provider for cloud-init.
# the trailing slash is important, the cloud-init sticks 'meta-data' or 'user-data' right after it, without prepending a forward slash.
set seedfrom http://pi.nas.home:8888/ubuntu/metadata
# $base url is where the vmlinuz and initrd live.
# they were fished out from the live-server iso file. the iso file is also in this directory.
set base http://pi.nas.home:8888/ubuntu/
kernel ${base}/vmlinuz initrd=initrd autoinstall url=${base}/plucky-live-server-amd64.iso net.ifnames=0 biosdevname=0 ip=dhcp ds=nocloud;s=${seedfrom}
initrd ${base}/initrd
boot
#!ipxe
kernel http://pi.nas.home:8888/talos/talos-kubespaces-1.9.2-amd64 talos.platform=metal console=tty0 init_on_alloc=1 slab_nomerge pti=on consoleblank=0 nvme_core.io_timeout=4294967295 printk.devkmsg=on ima_template=ima-ng ima_appraise=fix ima_hash=sha512 talos.environment=INSTALLER_META_BASE64=REDACTED== siderolink.api=https://kubespaces.siderolink.omni.siderolabs.io?grpc_tunnel=false&jointoken=REDACTED talos.events.sink=[fdae:41e4:649b:9303::1]:8090 talos.logging.kernel=tcp://[fdae:41e4:649b:9303::1]:8092
initrd http://pi.nas.home:8888/talos/talos-kubespaces-1.9.2-amd64.xz
boot
#cloud-config
# set password to r00tme
chpasswd:
expire: false
list:
- ubuntu-server:$6$.c38i4RIqZeF4RtR$hRu2RFep/.6DziHLnRqGOEImb15JT2i.K/F9ojBkK/79zqY30Ll2/xx6QClQfdelLe.ZjpeVYfE8xBBcyLspa/
ssh_authorized_keys:
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment