See also netboot_pointers for other ways to do NetBoot.

While those instructions most likely can be used for any OS (instructions further below on that), I've only tested Archlinux.

Netbooting clients into Archlinux from an OpenWRT device

This instruction is valid if you have ...

  • A working OpenWRT router with some free storage space (1 MB is sufficient)
  • Working internet connection through said router
  • Basic knowledge on how to ssh into the router and configure it
  • Some device (typically a laptop or desktop) that can be connected to the OpenWRT router through a networking cable
  • You want to do some rescue on some existing Linux system on said device, or you want to install Archlinux on it
  • Said device can do netboot through PXE (but cannot load images directly from the Internet through iPXE).

In my case I got into my hand a HP laptop with the Wrong operating system installed, and I wanted to install Archlinux on it. (In my case I was actually moving from an existing identical but slightly broken laptop, so rather than going through the official Archlinux installation guide, I just did a plain copy of the full hard disk after booting it up). I found the other article on this wiki - tftp.pxe-server - but half of what's there was simply not relevant for me. I was surprised on how easy it was to serve PXE from my OpenWRT device.

Ref section 3 in tftp.pxe-server, it's as simple as editing /etc/config/dhcp on the OpenWRT device. Mine looks like this:

config dnsmasq
    (...)
    option enable_tftp '1'
    option tftp_root '/tftp'

(...)

config boot 'archlinux'
        option filename 'archlinux.pxe'
        option serveraddress '192.168.1.1'
        option servername 'OpenWrt'

(Obviously, my openwrt device has local IPv4-adress 192.168.1.1. Note that tftp.pxe-server section 3 specifies that some devices may need some extra code in the boot-section)

It's needed to do /etc/init.d/dnsmasq restart to let the changes take effect. And that's all. Considering all the mess one needs to get through to set up a working DHCP and TFTP on a Linux server, this is very easy.

The Archlinux wiki has a page https://wiki.archlinux.org/title/Netboot describing how to boot Archlinux from the Internet. It reads “Netboot images are small (< 1 MiB) images that can be used to download the latest Arch Linux release on the fly upon system boot” and points to the download page https://archlinux.org/releng/netboot/. It also says “You need sufficient memory (probably 1.5GiB or even more) to store and run the live system, otherwise you may get a kernel panic on boot”. If you have less memory than that, there are certainly smaller images that can be loaded - check up https://netboot.xyz

Run df -h to check if there is enough disk space. On my device, I can see that / is an overlay file system consisting of a 4 MB ROM system that is 100% full, and an overlay file system with 8 MB free space on the overlay partition - so the netboot image will fit. If you want to use an external USB-device then read tftp.pxe-server on how to do that.

I've specified above that tftp will find images through /tftp, so we need to create this:

mkdir /tftp

... and then download the image from the Archlinux site. Right now it can be done like this:

wget https://archlinux.org/static/netboot/ipxe-arch.5ee66f360339.pxe

If you don't want Archlinux, try downloading https://boot.netboot.xyz/ipxe/netboot.xyz.kpxe instead

... though you may want to ensure you get the latest version of the pxe file, and that the file has a good checksum. Perhaps wget isn't available on your OpenWRT device - the page tftp.pxe-server shows how to install it, but you may also download it to your workstation/laptop and then use scp to copy it over.

Connect your device to the OpenWRT router with a network cable, power it on. On some devices it's needed to press F12 repeatedly to get into network boot mode - other buttons like escape, F1, F3, etc may also enter bios or boot menus dependent on the device.

On my HP-laptop I had to do some BIOS configuration before I could boot, namely I had to turn off “secure boot” and turn on “legacy boot”.

When booting archlinux, it presents a list of mirror sites and asks me to choose one of them. It took me some time to find a nearby mirror that actually worked. Perhaps the netboot.xyz site is better ... it would be nice with a boot image that just works without having to do manual steps during the boot process (and possibly with mirror sites running anycast). Downloading the image also took quite some time.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2023/02/15 14:44
  • by tobixen