PXE

From VyOS Wiki
Jump to: navigation, search

Note: the following has been tested on helium (v1.1.7).

It is assumed you have a working PXELINUX configuration.

  • Extract live/vmlinuz and live/filesystem.squashfs from the Helium ISO.

The debian-live scripts used by VyOS are broken. I applied the changes on this pull request to fix PXE booting and tftp:// URLs.

  • Edit your PXELINUX configuration (usually pxelinux.cfg/default) to add:
 label vyos
   kernel /vyos/vmlinuz
   append initrd=/vyos/initrd.img console=ttyS0 console=tty0 boot=live nopersistent noautologin nonetworking nouser hostname=vyos fetch=http://<IP ADDRESS>/<PATH TO filesystem.squashfs>/filesystem.squashfs 
   ipappend 2

Some notes:

  • If nothing works, try addding "verbose debug=vc" to the append line. The scripts will notice those and do "set -x", so you'll be able to see what's going on.
  • / for PXELINUX is the directory pxelinux.cfg is in. So for example in my setup I have:
 /opt/kickstart/tftpboot/vyos/vmlinuz
 /opt/kickstart/tftpboot/vyos/initrd.img
 /opt/kickstart/tftpboot/pxelinux.cfg/default
 /opt/kickstart/export/vyos/filesystem.squashfs

and so e.g. /vyos/vmlinuz is /opt/kickstart/tftpboot/vyos/vmlinuz.

  • fetch= is a URL to filesystem.squashfs. You can use tftp:// http:// and ftp:// URLs here. I haven't tested FTP though. TFTP is extremely slow, so I recommend using HTTP.

The address part must be an IP address, NOT a domain name. This is because the supplied initramfs does not support resolving domain names (yet).

Also obviously if you use HTTP you'll need an HTTP server listening at that address. python -m SimpleHTTPServer <directory> 80 works well in a pinch.

  • "ipappend 2" is to work around a bug in /bin/ipconfig in the initramfs (the DHCP client). The bug is as follows: ipconfig will send DHCP OFFERs, and replies will come but ipconfig won't see them, and so the script will spin for a while and eventually give up, triggering a kernel panic.

"ipappend 2" tells PXELINUX to add bootif=<interface PXELINUX used> to the kernel cmdline. The live scripts will see this and run ipconfig only on that one interface. This works every time.

The box I was setting up when I ran into this bug has 4 NICs, and there's a Cisco router acting as a DHCP relay on that network, so that's probably why I'm having trouble. You can leave "ipappend 2" there though even if you only have a single NIC, it'll still work.

NOTE: I did try to apply the fix in https://bugs.launchpad.net/ubuntu/+source/klibc/+bug/1327412, but it didn't work for me. Suggestions welcome.

  • For future reference, the append line is mostly what's in the ISOLINUX config on the ISO.