Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

install: register UEFI NVRAM entry + copy debug log to USB

Two missing pieces explaining "install said success but won't boot":

1. UEFI NVRAM entry was never created. ThinkPads (and most non-Mac
firmware) only fall back to /EFI/BOOT/BOOTX64.EFI on REMOVABLE media
— internal disks need an explicit NVRAM entry pointing at the loader.
We installed the file but never told the firmware about it. After
reboot the firmware would skip the new ESP, fall through to the next
boot device (USB, or a stale Fedora "fedora" entry pointing at a
now-deleted grubx64.efi).

Now after a successful copy: remove any prior "AC Native OS" entries
(idempotent reinstall), then `efibootmgr -c -d <disk> -p <part> -L
'AC Native OS' -l '\EFI\BOOT\BOOTX64.EFI'`. -c prepends to BootOrder
so we boot first. efibootmgr is already bundled in initramfs;
/sys/firmware/efi/efivars is mounted by init.

2. Install debug log lived only in tmpfs (/tmp/install-debug.log) so
it died at reboot — making post-mortem of partial failures
impossible. Now copy it to /mnt/install-debug.log on the boot USB
at the end of every install attempt (success or fail), so
subsequent diagnosis can read sfdisk/mkfs/efibootmgr output.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+47
+47
fedac/native/src/ac-native.c
··· 1836 1836 } 1837 1837 1838 1838 umount("/tmp/hd"); 1839 + 1840 + // Register a UEFI NVRAM boot entry pointing at the freshly 1841 + // written ESP. Without this, ThinkPad / most non-Mac firmware 1842 + // won't try `\EFI\BOOT\BOOTX64.EFI` on internal disks at all 1843 + // — only removable media gets the fallback path. The new 1844 + // install would write fine but the firmware wouldn't see it 1845 + // at boot, falling through to USB or a stale Fedora entry. 1846 + // 1847 + // Skipped silently if efivarfs isn't mounted (some firmware 1848 + // exposes it read-only); install still completes — user can 1849 + // boot via F12 menu and we'll add the entry on second boot. 1850 + if (installed) { 1851 + char parent_blk[32] = ""; 1852 + get_parent_block(devpath + 5, parent_blk, sizeof(parent_blk)); 1853 + int part_num = 1; 1854 + { 1855 + int len = (int)strlen(devpath); 1856 + int i = len; 1857 + while (i > 0 && devpath[i-1] >= '0' && devpath[i-1] <= '9') i--; 1858 + if (i < len) part_num = atoi(devpath + i); 1859 + } 1860 + if (parent_blk[0] && access("/sys/firmware/efi/efivars", F_OK) == 0) { 1861 + char ebcmd[512]; 1862 + // Remove any prior "AC Native OS" entries (idempotent reinstall). 1863 + snprintf(ebcmd, sizeof(ebcmd), 1864 + "for n in $(efibootmgr 2>/dev/null | awk '/AC Native OS/{print substr($1,5,4)}'); do " 1865 + "efibootmgr -B -b $n >/dev/null 2>&1; done"); 1866 + system(ebcmd); 1867 + // Add new entry pointing at our /EFI/BOOT/BOOTX64.EFI 1868 + // on the new ESP. Position it first in BootOrder so 1869 + // firmware tries it before any stale Fedora entries. 1870 + snprintf(ebcmd, sizeof(ebcmd), 1871 + "efibootmgr -c -d /dev/%s -p %d -L 'AC Native OS' " 1872 + "-l '\\EFI\\BOOT\\BOOTX64.EFI' >> /tmp/install-debug.log 2>&1", 1873 + parent_blk, part_num); 1874 + int erc = system(ebcmd); 1875 + ac_log("[install] efibootmgr add rc=%d for /dev/%s p%d\n", erc, parent_blk, part_num); 1876 + } 1877 + } 1878 + 1879 + // Copy the install debug log onto the boot USB so post-mortem 1880 + // is possible without re-running. tmpfs evaporates on reboot; 1881 + // /mnt is the live USB partition. 1882 + if (access("/tmp/install-debug.log", F_OK) == 0) { 1883 + copy_file("/tmp/install-debug.log", "/mnt/install-debug.log"); 1884 + sync(); 1885 + } 1839 1886 } 1840 1887 } 1841 1888 }