I successfully got a VM to boot in BIOS mode

We are running a bunch of VMs under KVM in BIOS mode, and are currently working out how to migrate these VMs to boot under LXD.

Interestingly, we do not have local storage, and boot our VMs from iSCSI storage. Thankfully, we do not manually configure iSCSI boot settings (iBFT) because that is handled by iPXE in our environment.

The issue was that converting a host to EFI is commonly known as a huge pain, and involves repartitioning hosts if you don’t want to host a kernel and initramfs somewhere else. It gets messy.

There is sparse documentation on getting BIOS VMs to boot on LXD, BUT we have been successful in getting this to work.

The basic steps are:

  1. Install seabios
  2. bind mount the seabios directory somewhere LXD can use it
  3. Add this location read-only to the VM config via raw.apparmor
  4. Set the bios to use via raw.qemu -bios

The VM should then boot normally. It should fail through to ipxe boot if there are no storage devices available.

This fixed our issue, and our VMs are booting normally. Commands used for reference:

root@lxc:/# apt-get install seabios
root@lxc:/# mount --bind /usr/share/seabios /var/lib/snapd/hostfs/usr/share/seabios/ # This should probably be added to fstab
root@lxc:/# lxc config show disposable-me-3
architecture: x86_64
  raw.apparmor: /var/lib/snapd/hostfs/usr/share/seabios/bios-256k.bin r, # Add this so the VM can see the bios
  raw.qemu: -bios /var/lib/snapd/hostfs/usr/share/seabios/bios-256k.bin # And this so it boots to the bios
  security.secureboot: "false"
devices: {}
ephemeral: false
- production
- external
stateful: false
description: ""

This commit note was the key to my finding this:

Also referenced this:



1 Like