From 455150f97f9e6025e82236e5a389b4c8bf61ba73 Mon Sep 17 00:00:00 2001 From: Daniel Maksymilian Syrnicki Date: Mon, 28 Sep 2026 14:21:14 +0200 Subject: [PATCH] fix(installer): use Limine on 32-bit UEFI firmware Atom Bay Trail / Cherry Trail mini-PCs and tablets have a 64-bit CPU behind 32-bit UEFI. We picked systemd-boot there (Arch ships no ia32 build), and archinstall 4.4's GRUB path hardcodes --target=x86_64-efi, so the installed system could not boot. archinstall's Limine path copies both BOOTIA32.EFI and BOOTX64.EFI and chooses the entry by /sys/firmware/efi/fw_platform_size; the default layout's FAT /boot satisfies its layout check. 64-bit UEFI and BIOS keep systemd-boot / GRUB. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Wq1hzUp4ZmCKHDuLKCnu73 --- tests/test_app.py | 13 +++++++++++++ webinstaller/app.py | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/tests/test_app.py b/tests/test_app.py index 425c414..6ab75b4 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -390,3 +390,16 @@ def test_error_page_offers_retry(monkeypatch, tmp_path): html = app_module.app.test_client().get("/install/log").get_data(as_text=True) assert "Try again" in html assert "next-steps" not in html + + +def test_detect_bootloader_by_firmware(tmp_path): + import app as app_module + + efi = tmp_path / "efi" + assert app_module._detect_bootloader(efi) == "Grub" # BIOS / legacy + efi.mkdir() + assert app_module._detect_bootloader(efi) == "Systemd-boot" # no bitness file + (efi / "fw_platform_size").write_text("64\n") + assert app_module._detect_bootloader(efi) == "Systemd-boot" + (efi / "fw_platform_size").write_text("32\n") + assert app_module._detect_bootloader(efi) == "Limine" diff --git a/webinstaller/app.py b/webinstaller/app.py index a3b9ed9..160d4c7 100644 --- a/webinstaller/app.py +++ b/webinstaller/app.py @@ -515,10 +515,20 @@ def _post_install_commands(hostname, admin_username, admin_password): ] -def _detect_bootloader(): +def _detect_bootloader(efi_dir=Path("/sys/firmware/efi")): # systemd-boot is UEFI-only; on BIOS/legacy it trips HardwareIncompatibilityError # inside archinstall. /sys/firmware/efi exists iff we were booted via UEFI. - return "Systemd-boot" if Path("/sys/firmware/efi").exists() else "Grub" + if not efi_dir.exists(): + return "Grub" + # 64-bit CPU behind 32-bit UEFI (Atom Bay Trail / Cherry Trail mini-PCs + # and tablets): Arch ships no ia32 systemd-boot, and archinstall's GRUB + # path hardcodes --target=x86_64-efi. Its Limine path installs both + # BOOTIA32.EFI and BOOTX64.EFI and picks the entry by firmware bitness. + try: + bitness = (efi_dir / "fw_platform_size").read_text().strip() + except OSError: + bitness = "64" + return "Limine" if bitness == "32" else "Systemd-boot" def build_archinstall_config(s):