Skip to content

Avoid UEFI GRUB entries on BIOS-booted guests#470

Merged
petrutlucian94 merged 1 commit into
cloudbase:masterfrom
mihaelabalutoiu:fix-osmorphing-bios-grub-firmware
Jul 10, 2026
Merged

Avoid UEFI GRUB entries on BIOS-booted guests#470
petrutlucian94 merged 1 commit into
cloudbase:masterfrom
mihaelabalutoiu:fix-osmorphing-bios-grub-firmware

Conversation

@mihaelabalutoiu

@mihaelabalutoiu mihaelabalutoiu commented Jul 7, 2026

Copy link
Copy Markdown
Member

When OSMorphing runs from a UEFI-booted minion while migrating a BIOS-booted guest, the guest chroot still exposes the minion's /sys/firmware/efi (the minion's /proc /sys /dev /run are bind-mounted into the chroot). Red Hat–family bootloader tooling detects that path and assumes the guest is UEFI-booted, so it generates UEFI-specific GRUB entries (linuxefi/initrdefi) for a BIOS guest.

Since the BIOS GRUB (i386-pc) has no such commands, the guest fails to boot after migration:

error: can't find command 'linuxefi'
error: can't find command 'initrdefi'

Solution

  1. Mask the minion's firmware in the guest chroot. When the migrated OS firmware type is BIOS and the minion exposes EFI firmware, mount a tmpfs over /sys/firmware inside the mounted guest root. This prevents tools running in the chroot (e.g. grub2-mkconfig via /etc/grub.d/10_linux) from incorrectly detecting UEFI and emitting UEFI boot entries, so a BIOS guest gets linux16/initrd16.

  2. Avoid unnecessary GRUB regeneration. The cloud-init handling now regenerates grub.cfg only when cloud-init=disabled is actually present in /etc/default/grub, removing a gratuitous grub2-mkconfig invocation that widened exposure to this issue.

Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
self._exec_cmd_chroot(
"sed -i '/cloud-init=disabled/d' %s" % grub_conf_disabler)
self._schedule_grub2_update()
contents = self._read_file_sudo(grub_conf_disabler)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change but it seems useful, avoiding an unnecessary grub update.

@petrutlucian94

Copy link
Copy Markdown
Member

Please add a PR description, describing the problem and the solution.

@mihaelabalutoiu

Copy link
Copy Markdown
Member Author

Please add a PR description, describing the problem and the solution.

Done

@petrutlucian94 petrutlucian94 merged commit e68ad2e into cloudbase:master Jul 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants