Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Heads initrd utilities to better support varied Linux distros and storage layouts by improving disk info display (avoiding busybox fdisk limits) and generalizing root-hash handling across more LVM naming schemes.
Changes:
- Replace
fdisk -lparsing with a new sysfs-baseddisk_info_sysfs()helper for System Info disk display. - Improve LVM VG/LV handling to support non-
rootLV names (e.g., Ubuntu-style layouts) and enhance debug tracing. - Refine boot/root detection flow with additional logging and a fast-path when
/bootis already mounted.
Reviewed changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| initrd/etc/gui_functions | System Info now prints disk sizes via disk_info_sysfs() rather than parsing fdisk. |
| initrd/etc/functions | Adds disk_info_sysfs(); adjusts LVM VG discovery parsing; refactors GPT BIOS/GRUB detection and boot-device detection logging. |
| initrd/bin/root-hashes-gui.sh | Adds tracing/debug; generalizes LVM root LV selection and LVM cleanup behavior. |
| initrd/bin/oem-system-info-xx30 | System Info screen now uses disk_info_sysfs() for disk listing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
293a8d9 to
ff96aef
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 4 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
initrd/etc/functions:1378
mount_possible_boot_devicedeclareslocal PARTITION_TYPEbut never uses it, and assigns tosectorswithout declaring it local. This leaves a globalsectorsvariable in the shared /etc/functions environment and adds dead code. Makesectorslocal (and removePARTITION_TYPEif no longer needed) to avoid accidental cross-function coupling.
local BOOT_DEV="$1"
local PARTITION_TYPE
# Unmount anything on /boot. Ignore failure since there might not be
# anything. If there is something mounted and we cannot unmount it for
# some reason, mount will fail, which is handled.
umount /boot 2>/dev/null || true
# Skip bios-grub partitions on GPT disks, LUKS partitions, and LVM PVs,
# we can't mount these as /boot.
# Skip partitions we definitely can't mount for /boot. Log each reason.
if is_gpt_bios_grub "$BOOT_DEV"; then
DEBUG "$BOOT_DEV is GPT BIOS/GRUB partition, skipping"
return 1
fi
if cryptsetup isLuks "$BOOT_DEV"; then
DEBUG "$BOOT_DEV is a LUKS volume, skipping"
return 1
fi
if find_lvm_vg_name "$BOOT_DEV" >/dev/null; then
DEBUG "$BOOT_DEV is an LVM PV, skipping"
return 1
fi
# Get the size of BOOT_DEV in 512-byte sectors
sectors=$(blockdev --getsz "$BOOT_DEV")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ff96aef to
6ab7d10
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6ab7d10 to
2aa58a0
Compare
a2981bc to
8d03b23
Compare
… enabled Signed-off-by: Thierry Laurion <[email protected]>
Compared to HEAD^, this commit updates initrd root-hash probing in: - initrd/bin/root-hashes-gui.sh - initrd/etc/functions Behavior expected to work: - Root-hash create/verify flow on latest Ubuntu, Debian, and PureOS under KVM. - LUKS/LVM root probing based on mountability + expected root directory checks. - Clear unsupported-layout whiptail guidance for unsupported filesystem/layout combinations. Current status and non-goals: - Fedora and QubesOS are untested in this change set. - QubesOS on coreboot q35 with Heads still does not support qemu/kvm; no regression is implied. Signed-off-by: Thierry Laurion <[email protected]>
8d03b23 to
9d03303
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| mkdir -p /tmp/root-hashes-gui | ||
| if ! lvm pvs --noheadings -o vg_name "$DEVICE" >/tmp/root-hashes-gui/lvm_vg 2>/dev/null; then | ||
| # It's not an LVM PV | ||
| # Try to query whether DEVICE is an LVM physical volume. On systems | ||
| # without LVM the command may not exist; treat that like "not a PV". | ||
| if ! lvm pvs --noheadings -o vg_name "$DEVICE" >/tmp/root-hashes-gui/lvm_vg 2>/tmp/root-hashes-gui/lvm_err; then | ||
| # It's not an LVM PV, or lvm failed entirely. Log stderr for debugging. | ||
| DEBUG "lvm pvs failed for $DEVICE, stderr:" "$(cat /tmp/root-hashes-gui/lvm_err)" |
There was a problem hiding this comment.
find_lvm_vg_name() writes its scratch output under /tmp/root-hashes-gui/* even though it lives in the shared /etc/functions library. This creates a hard coupling to the root-hashes flow and can also clobber data if another caller uses the same path. Consider using a more generic per-function temp dir (or mktemp) so /etc/functions utilities remain reusable.
| case "${TRACE_STACK}" in | ||
| *"main($0:"*) | ||
| ;; | ||
| *) | ||
| TRACE_STACK="${TRACE_STACK:+$TRACE_STACK -> }main($0:0)" | ||
| export TRACE_STACK | ||
| ;; | ||
| esac |
There was a problem hiding this comment.
The TRACE_STACK header comment says it appends the script name/line, but the code always records ":0" (TRACE_STACK="...main($0:0)"). Consider capturing the actual source location (e.g., using BASH_SOURCE[1] and BASH_LINENO[0]) so traces are accurate and match the documented format.
| case "${TRACE_STACK}" in | |
| *"main($0:"*) | |
| ;; | |
| *) | |
| TRACE_STACK="${TRACE_STACK:+$TRACE_STACK -> }main($0:0)" | |
| export TRACE_STACK | |
| ;; | |
| esac | |
| # Determine the calling script and line, if available. | |
| if [ "${#BASH_SOURCE[@]}" -ge 2 ]; then | |
| _TRACE_SRC="${BASH_SOURCE[1]}" | |
| else | |
| _TRACE_SRC="$0" | |
| fi | |
| if [ "${#BASH_LINENO[@]}" -ge 1 ]; then | |
| _TRACE_LINE="${BASH_LINENO[0]}" | |
| else | |
| _TRACE_LINE=0 | |
| fi | |
| _TRACE_ENTRY="main(${_TRACE_SRC}:${_TRACE_LINE})" | |
| case "${TRACE_STACK}" in | |
| *"${_TRACE_ENTRY}"*) | |
| ;; | |
| *) | |
| TRACE_STACK="${TRACE_STACK:+$TRACE_STACK -> }${_TRACE_ENTRY}" | |
| export TRACE_STACK | |
| ;; | |
| esac | |
| unset _TRACE_SRC _TRACE_LINE _TRACE_ENTRY |
Compatible with
Meanwhile users have to specify LUKS+LVM from DVD live installers and dodge BTRFS partiton schemes