Commit b3c8e82
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 b3c8e82
File tree
5 files changed
+130
-28
lines changed- initrd
- bin
- etc
5 files changed
+130
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
122 | 123 | | |
123 | | - | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| |||
214 | 215 | | |
215 | 216 | | |
216 | 217 | | |
| 218 | + | |
217 | 219 | | |
218 | | - | |
| 220 | + | |
219 | 221 | | |
220 | 222 | | |
221 | 223 | | |
| |||
| 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 | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
| 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 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
680 | 733 | | |
681 | 734 | | |
682 | 735 | | |
| |||
1087 | 1140 | | |
1088 | 1141 | | |
1089 | 1142 | | |
1090 | | - | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
1095 | 1151 | | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
1096 | 1156 | | |
1097 | 1157 | | |
1098 | 1158 | | |
| |||
1163 | 1223 | | |
1164 | 1224 | | |
1165 | 1225 | | |
1166 | | - | |
| 1226 | + | |
1167 | 1227 | | |
1168 | 1228 | | |
1169 | 1229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
175 | 212 | | |
176 | 213 | | |
177 | 214 | | |
| |||
181 | 218 | | |
182 | 219 | | |
183 | 220 | | |
184 | | - | |
185 | | - | |
| 221 | + | |
186 | 222 | | |
187 | 223 | | |
188 | 224 | | |
| |||
0 commit comments