Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

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

fix: show install failure diagnostics on screen

When disk install fails, the failure screen now shows:
- Why it failed (no source, no ESP, repartition failed, copy failed)
- Which block devices were found and their status
Previously just said "disk install failed" with no details.

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

+68 -5
+68 -5
fedac/native/src/ac-native.c
··· 722 722 return total; 723 723 } 724 724 725 + // Install failure reason — set by auto_install_to_hd, displayed on failure screen 726 + static char install_fail_reason[256] = ""; 727 + static char install_fail_detail[256] = ""; 728 + 725 729 // Auto-install kernel to internal drive's EFI System Partition 726 - // Returns 1 on success, 0 on failure. 730 + // Returns 1 on success, 0 on failure (sets install_fail_reason/detail). 727 731 static int auto_install_to_hd(ACGraph *graph, ACFramebuffer *screen, 728 732 ACDisplay *display, int pixel_scale) { 729 733 char source_mount[32] = "/mnt"; 730 734 char source_dev[32] = ""; 731 735 int source_mounted_tmp = 0; 732 736 char kernel_src[96] = ""; 737 + install_fail_reason[0] = '\0'; 738 + install_fail_detail[0] = '\0'; 733 739 char bootloader_src[96] = ""; 734 740 char chain_kernel_src[96] = ""; 735 741 char install_kernel_src[96] = ""; ··· 814 820 ((access(kernel_src, F_OK) != 0 && access(chain_kernel_src, F_OK) != 0) && 815 821 !systemd_boot_layout)) { 816 822 ac_log("[install] No removable install source with kernel found\n"); 823 + snprintf(install_fail_reason, sizeof(install_fail_reason), 824 + "no USB boot source found"); 817 825 // Log available block devices for diagnostics 818 826 ac_log("[install] Block devices:\n"); 827 + int dpos = 0; 819 828 const char *scan[] = {"sda","sdb","sdc","sdd","nvme0n1","nvme1n1","mmcblk0",NULL}; 820 829 for (int i = 0; scan[i]; i++) { 821 830 char dp[32]; snprintf(dp, sizeof(dp), "/sys/block/%s", scan[i]); 822 831 if (access(dp, F_OK) == 0) { 823 832 int rem = is_removable(scan[i]); 824 833 ac_log("[install] /dev/%s removable=%d\n", scan[i], rem); 834 + dpos += snprintf(install_fail_detail + dpos, 835 + sizeof(install_fail_detail) - dpos, 836 + "/dev/%s %s ", scan[i], rem == 1 ? "(USB)" : rem == 0 ? "(int)" : "(?)"); 825 837 } 826 838 } 827 839 if (source_mounted_tmp) umount("/tmp/src"); ··· 940 952 // Remount and retry 941 953 if (mount(devpath, "/tmp/hd", "vfat", 0, NULL) != 0) { 942 954 ac_log("[install] remount failed after repartition\n"); 955 + snprintf(install_fail_reason, sizeof(install_fail_reason), 956 + "repartition failed on %s", devpath); 957 + snprintf(install_fail_detail, sizeof(install_fail_detail), 958 + "sfdisk=%d mkfs then mount failed", rrc); 943 959 if (display) 944 960 draw_boot_status(graph, screen, display, "repartition failed!", pixel_scale); 945 961 usleep(2000000); ··· 993 1009 ac_log("[install] copy result: %ld bytes\n", sz); 994 1010 } 995 1011 996 - if (sz > 0) { 1012 + if (sz <= 0) { 1013 + ac_log("[install] copy failed on %s (sz=%ld)\n", devpath, sz); 1014 + snprintf(install_fail_reason, sizeof(install_fail_reason), 1015 + "copy failed on %s", devpath); 1016 + snprintf(install_fail_detail, sizeof(install_fail_detail), 1017 + "kernel copy returned %ld bytes", sz); 1018 + umount("/tmp/hd"); 1019 + continue; 1020 + } 1021 + 1022 + { 997 1023 // Also overwrite Windows Boot Manager path (ThinkPad BIOS often 998 1024 // boots this first regardless of boot order) — but only if space permits 999 1025 struct statvfs vfs; ··· 1041 1067 usleep(800000); 1042 1068 } else if (!installed) { 1043 1069 ac_log("[install] No suitable HD partition found for install\n"); 1070 + if (!install_fail_reason[0]) { 1071 + snprintf(install_fail_reason, sizeof(install_fail_reason), 1072 + "no internal FAT32/ESP partition found"); 1073 + // Build detail: list what we tried 1074 + int dpos = 0; 1075 + dpos += snprintf(install_fail_detail + dpos, 1076 + sizeof(install_fail_detail) - dpos, "usb=%s ", usb_blk[0] ? usb_blk : "?"); 1077 + for (int i = 0; part_candidates[i]; i++) { 1078 + const char *blk = part_candidates[i]; 1079 + char dp[32]; snprintf(dp, sizeof(dp), "/sys/block/%s", blk); 1080 + if (access(dp, F_OK) != 0) continue; 1081 + int rem = (blk[0] == 's' && blk[1] == 'd') ? is_removable(blk) : 0; 1082 + const char *skip = ""; 1083 + if (usb_blk[0] && strcmp(blk, usb_blk) == 0) skip = "=boot"; 1084 + else if (rem == 1) skip = "=USB"; 1085 + else skip = "=tried"; 1086 + dpos += snprintf(install_fail_detail + dpos, 1087 + sizeof(install_fail_detail) - dpos, 1088 + "%s%s ", blk, skip); 1089 + } 1090 + } 1044 1091 } 1045 1092 if (source_mounted_tmp) umount("/tmp/src"); 1046 1093 return installed; ··· 1235 1282 int l1w = font_measure_matrix(line1, 1); 1236 1283 font_draw_matrix(graph, line1, (screen->width - l1w) / 2, screen->height / 2 + 0, 1); 1237 1284 1285 + // Show failure diagnostics 1286 + if (!install_ok && install_fail_reason[0]) { 1287 + graph_ink(graph, (ACColor){200, 160, 100, 255}); 1288 + int rw = font_measure_matrix(install_fail_reason, 1); 1289 + font_draw_matrix(graph, install_fail_reason, 1290 + (screen->width - rw) / 2, screen->height / 2 + 16, 1); 1291 + 1292 + if (install_fail_detail[0]) { 1293 + graph_ink(graph, (ACColor){140, 140, 160, 255}); 1294 + int dw = font_measure_matrix(install_fail_detail, 1); 1295 + font_draw_matrix(graph, install_fail_detail, 1296 + (screen->width - dw) / 2, screen->height / 2 + 28, 1); 1297 + } 1298 + } 1299 + 1300 + int yoff = (!install_ok && install_fail_reason[0]) ? 16 : 0; 1238 1301 graph_ink(graph, (ACColor){180, 180, 210, 255}); 1239 1302 const char *line2 = "R/Enter = reboot"; 1240 1303 int l2w = font_measure_matrix(line2, 1); 1241 - font_draw_matrix(graph, line2, (screen->width - l2w) / 2, screen->height / 2 + 16, 1); 1304 + font_draw_matrix(graph, line2, (screen->width - l2w) / 2, screen->height / 2 + 32 + yoff, 1); 1242 1305 1243 1306 if (!install_ok) { 1244 1307 graph_ink(graph, (ACColor){150, 150, 170, 255}); 1245 1308 const char *line3 = "Esc = continue USB boot"; 1246 1309 int l3w = font_measure_matrix(line3, 1); 1247 - font_draw_matrix(graph, line3, (screen->width - l3w) / 2, screen->height / 2 + 30, 1); 1310 + font_draw_matrix(graph, line3, (screen->width - l3w) / 2, screen->height / 2 + 46 + yoff, 1); 1248 1311 } 1249 1312 1250 1313 if ((blink % 60) < 36) { 1251 1314 graph_ink(graph, (ACColor){120, 120, 140, 255}); 1252 1315 const char *line4 = install_ok ? "waiting for reboot..." : "waiting for key..."; 1253 1316 int l4w = font_measure_matrix(line4, 1); 1254 - font_draw_matrix(graph, line4, (screen->width - l4w) / 2, screen->height / 2 + 48, 1); 1317 + font_draw_matrix(graph, line4, (screen->width - l4w) / 2, screen->height / 2 + 62 + yoff, 1); 1255 1318 } 1256 1319 1257 1320 ac_display_present(display, screen, pixel_scale);