fix(installer): create the EFI partition even with "bootloader --disabled"

On a blank UEFI disk the installed system only booted with the USB key
plugged in (HP OMEN MAX 16, see OMEN-demarrage-sans-cle-usb.md): Anaconda
had created /boot and the LVM PV but no EFI system partition.

The kickstart disables Anaconda's bootloader because Arch has no grub2-*
binaries and GRUB is installed by the %post. Anaconda then sets
skip_bootloader, and schedule_partitions() drops the "efi" request of the
automatic partitioning ("skipping unneeded stage1 efi request"). The
anaconda PKGBUILD now patches that condition so the ESP is still created
when no stage1 partition exists yet.

The first-boot log of that machine also showed fws-grub-finalize writing
GRUB to /dev/sda2, the Ventoy key's EFI partition, because it took the
first ESP of the system. The kickstart and fws-grub-finalize now look on
the disk carrying / first, then on internal disks only, and log a
CRITICAL line instead of borrowing a removable device's ESP.
This commit is contained in:
nocode committed 2026-11-03 12:09:09 +01:00
1 parent 86f326ad65
commit cbdf86fa9f
5 files changed
+85 -18

No files matched your search

@@ -63,10 +63,22 @@ fi
# On lit PARTTYPE (un CODE : GUID en GPT, 0xef en MBR — jamais d'espace) et on
# interroge chaque partition séparément : une valeur par appel, donc aucun
# décalage de colonnes même si un champ est vide.
#
# Sans disque en argument, SEULS les disques internes (RM=0) sont parcourus.
# Vu en réel (HP OMEN, NVMe installé sans ESP) : la clé d'installation était
# encore branchée au 1er démarrage, sa partition EFI (Ventoy) était la
# « première ESP du système », GRUB y a été installé — et la machine ne
# démarrait plus qu'avec la clé.
find_esp() {
_disk="${1:-}"
lsblk -nrpo NAME,FSTYPE $_disk 2>/dev/null | awk '$2=="vfat"{print $1}' \
| while read -r _part; do
if [ -n "$_disk" ]; then
_disks="$_disk"
else
_disks="$(lsblk -dnpo NAME,TYPE,RM 2>/dev/null | awk '$2=="disk" && $3==0 {print $1}')"
fi
for _d in $_disks; do
lsblk -nrpo NAME,FSTYPE "$_d" 2>/dev/null | awk '$2=="vfat"{print $1}'
done | while read -r _part; do
_ptype="$(lsblk -nrdo PARTTYPE "$_part" 2>/dev/null | tr 'A-Z' 'a-z')"
case "$_ptype" in
c12a7328-f81f-11d2-ba4b-00a0c93ec93b|0xef) printf '%s\n' "$_part" ;;
@@ -125,14 +137,15 @@ if [ -d /sys/firmware/efi ]; then
if [ -n "$rootdisk" ]; then
esp="$(find_esp "$rootdisk")"
fi
# Repli : première ESP du système (ex. ESP Windows réutilisée).
# Repli : première ESP d'un disque INTERNE (ex. ESP Windows réutilisée).
[ -n "$esp" ] || esp="$(find_esp)"
if [ -n "$esp" ]; then
echo "[FWS] ESP : $esp → montage sur /boot/efi (ne pas démonter, reboot ensuite)"
mkdir -p /boot/efi
mount "$esp" /boot/efi 2>/dev/null || echo "[FWS] montage ESP impossible ($esp)"
else
echo "[FWS] aucune partition EFI trouvée sur ce système"
echo "[FWS] CRITIQUE : aucune partition EFI sur un disque interne — GRUB UEFI ne peut"
echo "[FWS] pas être installé ; ce système ne démarre que par un support externe."
fi
fi