From 2b7e20493a9e707ebabe2b9cdd30ef26bca423d1 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sun, 19 Jul 2026 09:53:21 +0000 Subject: [PATCH] [FIX] script qemu: boot VMs via UEFI (Debian 13 boot loop) Debian 13 (trixie) genericcloud dropped the BIOS/GRUB-pc bootloader, so SeaBIOS looped forever on "Booting Debian GNU/Linux" and the install never completed. Boot via UEFI (OVMF) by default: trixie boots, and Ubuntu/Debian 12/Fedora keep working (verified Debian 13 and Ubuntu 24.04 end to end). Add a --bios opt-out for hosts without OVMF, and pull the UEFI firmware (ovmf / edk2-ovmf) with the libvirt/QEMU stack. VM deletion already removes the nvram (undefine --nvram). Co-Authored-By: Claude Opus 4.8 (1M context) --- script/qemu/deploy_qemu.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/script/qemu/deploy_qemu.py b/script/qemu/deploy_qemu.py index 06ae551..8c0d2d3 100755 --- a/script/qemu/deploy_qemu.py +++ b/script/qemu/deploy_qemu.py @@ -360,11 +360,18 @@ TOOL_PACKAGES: dict[str, dict[str, str]] = { # Paquets fournissant le démon libvirt + l'émulateur QEMU système. Ils sont # INDISPENSABLES pour exécuter la VM : virsh/virt-install (clients) seuls ne # créent pas le socket /var/run/libvirt/libvirt-sock. +# On inclut le firmware UEFI (OVMF/edk2) : le boot par défaut est UEFI +# (indispensable pour Debian 13+ ; les images récentes n'ont plus de BIOS). DAEMON_PACKAGES: dict[str, list[str]] = { - "apt": ["libvirt-daemon-system", "qemu-system-x86"], - "dnf": ["libvirt-daemon-kvm", "qemu-kvm"], - "pacman": ["libvirt", "qemu-desktop", "dnsmasq"], - "zypper": ["libvirt-daemon", "libvirt-daemon-qemu", "qemu-kvm"], + "apt": ["libvirt-daemon-system", "qemu-system-x86", "ovmf"], + "dnf": ["libvirt-daemon-kvm", "qemu-kvm", "edk2-ovmf"], + "pacman": ["libvirt", "qemu-desktop", "dnsmasq", "edk2-ovmf"], + "zypper": [ + "libvirt-daemon", + "libvirt-daemon-qemu", + "qemu-kvm", + "qemu-ovmf-x86_64", + ], "brew": [], } @@ -977,6 +984,12 @@ def virt_install( "--console", "pty,target_type=serial", ] + # Boot UEFI par défaut : Debian 13 (trixie) et les images cloud récentes + # n'embarquent plus le chargeur BIOS/GRUB-pc et partent en boucle + # « Booting... » en SeaBIOS. UEFI (OVMF) fonctionne pour Ubuntu/Debian/ + # Fedora. --bios force l'ancien BIOS si OVMF est indisponible. + if not args.bios: + cmd += ["--boot", "uefi"] if not args.attach_console: cmd.append("--noautoconsole") runner.run(cmd, privileged=True) @@ -1127,6 +1140,12 @@ def build_parser() -> argparse.ArgumentParser: action="store_true", help="Attache la console série (sinon --noautoconsole).", ) + g_vm.add_argument( + "--bios", + action="store_true", + help="Force l'amorçage BIOS hérité au lieu d'UEFI (par défaut UEFI ; " + "n'utiliser que si le firmware OVMF est absent).", + ) g_cloud = p.add_argument_group("cloud-init") g_cloud.add_argument(