From 76452dddbd3456ab17670e1b360a84e214cafa42 Mon Sep 17 00:00:00 2001 From: Sahil Shah Date: Wed, 18 Jun 2025 07:13:11 -0400 Subject: [PATCH] Revise tpm API, add sanity check for mount proc 1. Update tpm2_getcap with new flag style 2. Installer fails vgchange in rare cases where /proc is not mounted in time, add failsafe checks to ensure it exists --- part2/stages/Functions/install-main | 5 +++++ part2/stages/Remove-partitions | 5 +++++ part2/stages/TPM-Check | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/part2/stages/Functions/install-main b/part2/stages/Functions/install-main index 086d1fa..f2440f3 100644 --- a/part2/stages/Functions/install-main +++ b/part2/stages/Functions/install-main @@ -41,6 +41,11 @@ mk_xc_lvm() { local PARTITION_DEV="$1" + # Ensure /proc is mounted + if ! mountpoint -q /proc; then + mount -t proc proc /proc || return 1 + fi + do_cmd vgchange -a n || return 1 do_cmd pvcreate -ff -y "${PARTITION_DEV}" || return 1 diff --git a/part2/stages/Remove-partitions b/part2/stages/Remove-partitions index 0254af0..f1d040e 100755 --- a/part2/stages/Remove-partitions +++ b/part2/stages/Remove-partitions @@ -22,6 +22,11 @@ . ${DISK_CONF} # ^^^ defines ${TARGET_DISK} +# Ensure /proc is mounted +if ! mountpoint -q /proc; then + mount -t proc proc /proc || return 1 +fi + # Deactivate LVs in all VGs. do_cmd vgchange -a n >&2 diff --git a/part2/stages/TPM-Check b/part2/stages/TPM-Check index 84aa802..2d0aa39 100755 --- a/part2/stages/TPM-Check +++ b/part2/stages/TPM-Check @@ -68,7 +68,7 @@ log_tpm_attrs() { tpm2=$? if [ "${tpm2}" -eq 0 ]; then - tpm2_getcap --capability=properties-fixed >&2 + tpm2_getcap properties-fixed >&2 else tpm_version >&2 fi