Avoid UEFI GRUB entries on BIOS-booted guests#470
Merged
petrutlucian94 merged 1 commit intoJul 10, 2026
Merged
Conversation
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) |
Member
There was a problem hiding this comment.
Unrelated change but it seems useful, avoiding an unnecessary grub update.
Member
|
Please add a PR description, describing the problem and the solution. |
Member
Author
Done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 /runare 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
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/firmwareinside the mounted guest root. This prevents tools running in the chroot (e.g.grub2-mkconfigvia/etc/grub.d/10_linux) from incorrectly detecting UEFI and emitting UEFI boot entries, so a BIOS guest getslinux16/initrd16.Avoid unnecessary GRUB regeneration. The cloud-init handling now regenerates
grub.cfgonly whencloud-init=disabledis actually present in/etc/default/grub, removing a gratuitousgrub2-mkconfiginvocation that widened exposure to this issue.