grow-var: resolve the whole disk with lsblk -d; refuse anything else - #3
Open
mobileoverlord wants to merge 2 commits into
Open
grow-var: resolve the whole disk with lsblk -d; refuse anything else#3mobileoverlord wants to merge 2 commits into
mobileoverlord wants to merge 2 commits into
Conversation
`lsblk -no PKNAME <partition>` also lists the partition's holders, and for a dm slave the dm child's row comes first - its PKNAME is the partition itself. On an encrypted /var this resolved "disk" to /dev/nvme0n1p16 and `sgdisk -e` then wrote a fresh GPT over the LUKS2 header (primary at 0, secondary at 16 KiB both destroyed; the mapping survived only because the key was already in the kernel). Observed on a Jetson Orin Nano on the first encrypted-/var boot; the plaintext path never hit it because there the var device is the partition and lsblk's first row is its own. Use -d (no dependents) and, before sgdisk touches anything, require the resolved device to be of TYPE disk. Claude-Session: https://claude.ai/code/session_01AqE5abpz1hSdeM9ZCRLLrf
The LUKS branch used blockdev --getsz, which util-linux-blockdev provides and the image does not ship: on a Jetson AGX Thor with encrypted /var the partition was extended and then the unit died with 'line 128: blockdev: command not found' (status 127) before the dm/partition size comparison. /sys/class/block/<dev>/size is the same 512-byte sector count for both the partition and the dm-N node behind /dev/mapper/var.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lsblk -no PKNAME <partition>also lists the partition's holders, and for a dm slave the dm child's row comes first — its PKNAME is the partition itself. On an encrypted/varthis resolved "disk" to/dev/nvme0n1p16andsgdisk -ewrote a fresh GPT over the LUKS2 header (primary and secondary both destroyed; the mapping survived only because the key was already in the kernel). Observed on a Jetson Orin Nano on its first encrypted-/varboot (meta-avocado #310). Plaintext boards never hit it because there the var device is the partition and lsblk's first row is its own — but every encrypted-var target (imx93, qemu) is exposed.Fix:
lsblk -dno PKNAME, and refuse to runsgdiskunless the resolved device isTYPE=disk.Verified on the board: fixed resolution gives
/dev/nvme0n1 type=disk ptable=gpt; the old form givesnvme0n1p16 type=part.https://claude.ai/code/session_01AqE5abpz1hSdeM9ZCRLLrf