PXE boot loads wrong disk after OS installation

Hello everyone,

I am using MAAS 3.5.7 in a lab environment.
The servers’ power driver is a webhook (probably irrelevant to the issue).

Each server has two disks:

  • /dev/nvme0n1 — NVMe disk (target for OS installation)
  • /dev/sda — SATA disk (not marked as boot and with no partitions)

The operating system is correctly installed on /dev/nvme0n1.
The /dev/sda disk is not marked as boot and has no partitions, as shown in the MAAS Storage screen:

The BIOS boot order is set to:

  1. PXE
  2. NVMe disk

Expected behavior:
After OS installation, PXE should fall back to booting from /dev/nvme0n1, which is marked as the boot disk in MAAS.


Observed behavior:
After the OS is installed and the system reboots, the server starts via PXE.
PXE then displays something like “booting from local disk” and loads /dev/sda instead of /dev/nvme0n1.

This results in an endless boot loop, as the SATA disk has no valid OS.

To confirm the issue, I manually installed FreeDOS on /dev/sda. After reinstalling the OS via MAAS, PXE booted into FreeDOS — proving that the PXE fallback is loading the wrong disk.


Notes:

  • If I manually change the boot device in BIOS to the NVMe disk, the OS installed by MAAS boots successfully.
  • This suggests that the PXE boot script used by MAAS may be selecting the first disk detected by firmware (/dev/sda) instead of the disk marked as boot disk in MAAS.

Question:
Is there any known workaround for this behavior?
Or is this a known bug in the PXE fallback logic in MAAS?

Did you deploy vanilla ubuntu or a custom image?

@r00ta vanilla image, ubuntu 24.04 with and without hwe kernel. Same behaviour.

This is weird according to your screenshot. MAAS should have wiped that disk, so you would not boot into that OS

@r00ta
I’m looking for PXE menus and found this template.
I guess this template shows what is happening…

cat config.local.amd64.template  
DEFAULT local  
  
LABEL local  
  SAY Booting local disk ...  
  KERNEL chain.c32  
  APPEND hd0 

here: APPEND hd0

Could it be that hd0 refers to the first disk the BIOS recognizes as hd0, and not necessarily the disk MAAS considers the bootable disk?

This is indeed an odd issue. What happens if you remove the sda disk entirely from the machine’s config?

If I physically remove the disk from the server, everything works, but the extra disk configuration still remains in MAAS’s storage settings.
If I keep the disk plugged in but remove it from the storage configuration, the issue persists it still tries to boot from the first disk (in this case, sda).