fix(installer): make GRUB reliable on bare-metal dualboot installs

Three gaps left real machines booting straight into Windows after a
successful install (menu empty, no GRUB entry, no NVRAM record):

- os-prober was disabled (Arch default GRUB_DISABLE_OS_PROBER=true),
  so Windows never appeared in the generated menu; the airootfs
  overlay /etc/default/grub now ships GRUB_DISABLE_OS_PROBER=false.
- The %post chroot often had no ESP mounted and no efivars access, so
  grub-install silently did nothing on real hardware; it now finds and
  mounts an EFI FAT32 partition (including another OS's ESP, e.g.
  Windows) before installing.
- No safety net remained if the first attempt failed; the kickstart
  enables a new fws-grub-finalize.service that, on the installed
  system's first boot, re-installs GRUB with the --removable fallback
  (EFI/BOOT/BOOTX64.EFI) plus an NVRAM entry and regenerates the menu
  with os-prober active - automating the manual TTY repair.
This commit is contained in:
BlackAngelTV committed 2026-09-03 21:57:06 +02:00
1 parent 0022186f2f
commit c6595e1563
6 files changed
+217 -1

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
# FWS — configuration GRUB du système installé.
# Cet overlay écrase le /etc/default/grub par défaut du paquet « grub » dans le
# live (l'installé étant une copie du live, il en hérite).
#
# DIFFÉRENCE CLÉ vs Arch : os-prober est ACTIVÉ (défaut Arch = désactivé, donc
# Windows/autres OS n'apparaissaient JAMAIS au menu GRUB d'une install FWS en
# dual-boot). fws-grub-finalize et le %post du kickstart re-génèrent aussi le
# menu avec ce réglage après l'installation.
GRUB_DEFAULT=0
GRUB_TIMEOUT=8
GRUB_DISTRIBUTOR="FWS"
GRUB_DISABLE_OS_PROBER=false
@@ -0,0 +1,18 @@
[Unit]
Description=FWS - finalisation GRUB au premier demarrage (NVRAM + dual-boot)
# Filet de securite bare-metal : l'installation (%post) peut se terminer sans
# entree NVRAM (efivars inaccessible dans le chroot) ou sans Windows au menu
# (os-prober). Au 1er demarrage du systeme installe, fws-grub-finalize pose
# GRUB en --removable + entree NVRAM « FWS » + regenere le menu avec
# os-prober. Marqueur de succes -> le service ne se relance plus ensuite.
ConditionPathExists=!/var/lib/fws/grub-finalize-done
After=local-fs.target
Wants=systemd-udev-settle.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/fws-grub-finalize
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target