Netboot - ArchWiki

Jump to content

# Netboot

3 languages

- 中文（简体）
- 日本語
- Lietuvių

From ArchWiki

Netboot images are small (< 1 MiB) images that can be used to download the latest Arch Linux release on the fly upon system boot. It is unnecessary to update the netboot image, the newest release will be available automatically. Netboot images can be downloaded from the Arch Linux Netboot page.

Note:

- 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.
- It is mostly intended for wired connectivity: Wi-Fi support is limited and highly firmware-dependent[1].

## BIOS

To use netboot on a BIOS-based computer, you need either the `ipxe.lkrn` or `ipxe.pxe` image.

### Using ipxe.lkrn

The `ipxe.lkrn` image can be booted like a Linux kernel. Any Linux boot loader (like GRUB or Syslinux) can be used to load it from your hard drive, a CD or a USB drive. For example, the Syslinux wiki gives instructions to install[2] and configure[3] Syslinux on a bootable medium.

You can make flash drive that boots `ipxe.lkrn` with the following steps:

- Find out your device path using lsblk. Let us assume it is `/dev/sdc`.
- Create MBR partition table on the device.
- Create a primary partition with FAT32 file system and flag it as active.
- Mount partition, create `boot/syslinux` directory there and copy `ipxe.lkrn` to the `boot` directory.

    # mount /dev/sdc /mnt
    # mkdir -p /mnt/boot/syslinux
    # cp ipxe.lkrn /mnt/boot

- Create syslinux configuration

    /mnt/boot/syslinux/syslinux.cfg

    DEFAULT arch_netboot
       SAY Booting Arch over the network.
    LABEL arch_netboot
       KERNEL /boot/ipxe.lkrn

- Unmount partition

    # umount /mnt

- Install Syslinux MBR and Syslinux itself

    # dd bs=440 count=1 conv=notrunc if=/usr/lib/syslinux/bios/mbr.bin of=/dev/sdc
    # syslinux --directory /boot/syslinux/ --install /dev/sdc1

- Now you should be able to boot your usb stick with ipxe.lkrn.

Alternatively, you can also try the image with QEMU by running the following command:

    $ qemu-system-x86_64 -enable-kvm -m 2G -kernel ipxe.lkrn

### Using ipxe.pxe

The `ipxe.pxe` image is a PXE image. It can be chainloaded from an existing PXE environment. This allows configuring a DHCP server such that booting from the network will always boot into Arch Linux netboot.

Alternatively, you can also chainload it from existing pxe loader such as pxelinux. This is a menu entry example:

    LABEL arch_netboot_chain
      COM32 pxechn.c32
      APPEND ipxe.a56af4e6a9a9.pxe

For this example to work you must have pxechn.c32 copied to the directory where your pxelinux.0 resides.

## UEFI

The ipxe-arch.efi image can be used to launch Arch Linux netboot in UEFI mode. Only 64-bit UEFI is supported. The image can be added as a boot option via efibootmgr, launched from a boot manager, like systemd-boot or rEFInd, or directly from the UEFI shell. You can also boot it from a standalone USB stick on UEFI systems.

### Installation with efibootmgr

First install the efibootmgr package. Assuming your EFI system partition (ESP) is `/dev/sdd1` and mounted under `esp`, you should move it as follows—let us also give it a more friendly name:

    # mkdir esp/EFI/arch_netboot
    # mv ipxe.*.efi esp/EFI/arch_netboot/arch_netboot.efi

Then you can create a boot entry as follows:

    # efibootmgr --create --disk /dev/sdd --part 1 --loader /EFI/arch_netboot/arch_netboot.efi --label "Arch Linux Netboot" --unicode

### Boot from a USB flash drive

If you want to boot the Netboot EFI binary from a USB flash drive, copy it to the default/fallback boot path (`/EFI/BOOT/BOOTx64.EFI`) on a FAT formatted partition. It does not require creating a EFI system partition on the drive as all UEFI will happily boot any FAT volume from USB flash drives. The most compatible setup would be using the MBR partition table with a single active (bootable) primary partition of type `0c` "W95 FAT32 (LBA)".[4]

The image should be then loaded automatically by UEFI systems.

Note: You will need to disable Secure Boot to boot. Even if you sign the Netboot EFI binary with custom keys, the kernel that is downloaded from a mirror is not signed.

#### In GNU/Linux

For example, assuming `/dev/sdX` as the flash drive, prepare the USB flash drive as follows:

1. If not done yet, create a partition table on `/dev/sdX` and a partition (`/dev/sdXn`) on the device.
2. If not done yet, format the partition to FAT32:

       # mkfs.fat -F 32 /dev/sdXn

3. Mount the file system:

       # mount /dev/sdXn /mnt

4. Create a `/EFI/BOOT` directory on the mounted file system:

       # mkdir /mnt/EFI /mnt/EFI/BOOT

5. Copy `pxe-arch.efi` to the default boot path for x64 UEFI:

       # cp pxe-arch.efi /mnt/EFI/BOOT/BOOTx64.EFI

6. Unmount the file system.

#### In Windows

Prepare the USB flash drive as follows:

1. If not done yet, partition the USB flash drive and format it to FAT32.
2. Navigate to the root of the USB flash drive and create an `EFI` folder in it and a `BOOT` folder inside the `EFI` folder.
3. Copy `pxe-arch.efi` to the `EFI\BOOT` folder.
4. Rename the `pxe-arch.efi` file to `BOOTx64.EFI`.
5. Eject the USB flash drive when done.

## Troubleshooting

### Booting EFI binary gives "device error"

If booting the EFI binary results in `Failed to execute ... device error`, make sure the network stack is enabled in your UEFI settings. It may require initializing the network interface controller's (NIC) option ROM, so additionally look for settings like "OnBoard LAN Boot ROM", "Launch PXE OpROM Policy" or similar.

Categories:

- Installation process
- Arch projects