Commit 879fb3c
committed
Replace fdisk -l with sysfs-based disk enumeration for better busybox compatibility
fdisk -l is unreliable in busybox environments due to 2TB max size based on max
sector assumption.
Changes:
- Add list_block_devices() helper function to initrd/etc/functions and
initrd/etc/gui_functions that uses sysfs to enumerate all block devices
(SATA, NVMe, VirtIO, IDE)
- Update show_system_info() in initrd/etc/gui_functions to use sysfs for
disk size reporting instead of parsing fdisk output
- Update show_system_info() in initrd/bin/oem-system-info-xx30 to use sysfs
for disk size reporting
- Replace device_has_partitions() in initrd/etc/functions to check for
partition entries in sysfs instead of parsing fdisk output
- Replace is_gpt_bios_grub() in initrd/etc/functions to use sysfs partition
attributes (PARTTYPENAME) instead of fdisk parsing. Improves reliability
for GPT disk detection while maintaining backward compatibility.
- Update detect_boot_device() in initrd/etc/functions to use list_block_devices()
- Update boot device selection in initrd/bin/config-gui.sh to use
list_block_devices()
- Update root device selection in initrd/bin/config-gui.sh to use
list_block_devices()
- Update root device detection in initrd/bin/root-hashes-gui.sh to use
list_block_devices()
Benefits:
- Fixes disk detection failures with virtio block devices (qcow2 disks)
- Works reliably in busybox environments
- More robust than fdisk output parsing
- Supports all block device types (sd*, nvme*, vd*, hd*)
- Improves debuggability with explicit logging
Note: Interactive partitioning in initrd/etc/luks-functions still uses fdisk
for actually writing partition tables, which is its legitimate use case.
Signed-off-by: Thierry Laurion <insurgo@riseup.net>1 parent 3b656d0 commit 879fb3c
File tree
5 files changed
+72
-30
lines changed- initrd
- bin
- etc
5 files changed
+72
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
| 218 | + | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
53 | 57 | | |
54 | | - | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
370 | | - | |
| 369 | + | |
| 370 | + | |
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
676 | 668 | | |
677 | 669 | | |
678 | | - | |
679 | | - | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
680 | 709 | | |
681 | 710 | | |
682 | 711 | | |
| |||
1087 | 1116 | | |
1088 | 1117 | | |
1089 | 1118 | | |
1090 | | - | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
1095 | 1127 | | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
1096 | 1132 | | |
1097 | 1133 | | |
1098 | 1134 | | |
| |||
1162 | 1198 | | |
1163 | 1199 | | |
1164 | 1200 | | |
1165 | | - | |
1166 | | - | |
| 1201 | + | |
| 1202 | + | |
1167 | 1203 | | |
1168 | 1204 | | |
1169 | 1205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
175 | 178 | | |
176 | 179 | | |
177 | 180 | | |
| |||
181 | 184 | | |
182 | 185 | | |
183 | 186 | | |
184 | | - | |
185 | | - | |
| 187 | + | |
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
| |||
0 commit comments