fix(installer): improve bootloader installation and debug logging
- Add fallback GRUB installation for UEFI systems using --removable flag to ensure boot without NVRAM entries - Fix BIOS disk detection for LVM root partitions by using lsblk with proper filtering instead of pkname - Enhance debug logging to include %post chroot phase logs (fws-post.log) which indicate bootloader success - Automatically mount and retrieve installation logs from the installed disk to verify bootloader installation - Add detailed comments explaining UEFI/BIOS fallback strategies and LVM-aware disk detection These changes ensure the system can boot even when NVRAM entries are missing or forgotten by firmware, and provide better visibility into bootloader installation success during the debug phase.
This commit is contained in:
@@ -119,16 +119,28 @@ mkinitcpio -P || echo "[FWS] AVERTISSEMENT : mkinitcpio a échoué"
|
||||
# --- 3) GRUB installé à la main (cf. bootloader --disabled) ------------------
|
||||
install_grub() {
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
# UEFI. efibootmgr crée l'entrée NVRAM « FWS », mais il peut MANQUER de
|
||||
# l'airootfs et son install dépend du réseau → on ne BLOQUE pas dessus.
|
||||
pacman -Q efibootmgr &>/dev/null || pacman -Sy --noconfirm efibootmgr || true
|
||||
# (a) Entrée NVRAM dédiée (best effort, si efibootmgr dispo) :
|
||||
grub-install --target=x86_64-efi --efi-directory=/boot/efi \
|
||||
--bootloader-id=FWS --recheck
|
||||
--bootloader-id=FWS --recheck || true
|
||||
# (b) Chemin de SECOURS EFI/BOOT/BOOTX64.EFI (--removable) : boote SANS
|
||||
# aucune entrée NVRAM. INDISPENSABLE en VM / sans réseau / firmware
|
||||
# qui « oublie » l'entrée — c'est lui qui garantit le 1er boot UEFI.
|
||||
grub-install --target=x86_64-efi --efi-directory=/boot/efi \
|
||||
--bootloader-id=FWS --removable --recheck
|
||||
else
|
||||
# BIOS : retrouver le disque physique portant « / ».
|
||||
# BIOS : installer GRUB dans le MBR du DISQUE physique (PAS une partition)
|
||||
# portant « / », même quand « / » est sur du LVM (chaîne
|
||||
# LV → PV partition → disque). « lsblk -s » descend vers le physique ; on
|
||||
# prend la 1re ligne de type « disk ». (L'ancien « lsblk -no pkname »
|
||||
# renvoyait la PARTITION sda2 → grub-install échouait sur un root LVM.)
|
||||
local rootsrc disk
|
||||
rootsrc="$(findmnt -no SOURCE / 2>/dev/null)"
|
||||
disk="$(lsblk -no pkname "$rootsrc" 2>/dev/null | head -1)"
|
||||
[ -n "$disk" ] || { echo "[FWS] Disque BIOS introuvable"; return 1; }
|
||||
grub-install --target=i386-pc --recheck "/dev/$disk"
|
||||
disk="$(lsblk -spno NAME,TYPE "$rootsrc" 2>/dev/null | awk '$2=="disk"{print $1; exit}')"
|
||||
[ -n "$disk" ] || { echo "[FWS] Disque BIOS introuvable pour '$rootsrc'"; return 1; }
|
||||
grub-install --target=i386-pc --recheck "$disk"
|
||||
fi
|
||||
}
|
||||
if install_grub; then
|
||||
|
||||
Reference in New Issue
Block a user