You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Tested with debian-13 with root hashes. I guess it should still work with PureOS.
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
0 commit comments