blockdev: Fall back to blkid -p when udev is unavailable#2169
Open
cgwalters wants to merge 1 commit intobootc-dev:mainfrom
Open
blockdev: Fall back to blkid -p when udev is unavailable#2169cgwalters wants to merge 1 commit intobootc-dev:mainfrom
cgwalters wants to merge 1 commit intobootc-dev:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements a fallback mechanism for block device metadata discovery when the udev database is unavailable, such as within container sandboxes. It introduces blkid -p as a secondary source for partition and table types, updates the Device backfilling logic, and adds new internal CLI subcommands for block device inspection. Feedback was provided to optimize the backfill_missing function by caching the device path to avoid redundant string operations.
See osbuild/osbuild#2428 When running inside a container or sandbox without /run/udev bind-mounted (e.g. osbuild's bwrap), lsblk returns null for partition metadata fields like parttype (partition type GUID) and pttype (partition table type), because these come from the udev database. This causes partition discovery to fail -- most visibly on ppc64le where the PReP partition can't be found by GUID, but also affecting ESP discovery on all architectures. On x86_64 UEFI, bootupd silently falls back to mounted-ESP detection, masking the problem; on ppc64le there is no fallback and the install fails hard. Add a blkid -p fallback in backfill_missing() that probes partition metadata directly from the disk when udev is absent. The udev check tests for /run/udev/data (the actual database directory) rather than /run/udev, because bootc's ensure_mirrored_host_mount() creates an empty /run/udev directory on the bwrap tmpfs that is_same_as_host() then considers 'already mounted'. Tested end-to-end via the BIB tmt test (plan-33-bib-build) with a patched bootupd that removes the mounted-ESP fallback entirely. This follows the same approach coreos-installer uses (PRs bootc-dev#1511, sfdisk-based workaround originally added in PR bootc-dev#688. Assisted-by: OpenCode (Claude Opus 4) Signed-off-by: Colin Walters <walters@verbum.org>
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.
See osbuild/osbuild#2428
When running inside a container or sandbox without /run/udev bind-mounted (e.g. osbuild's bwrap), lsblk returns null for partition metadata fields like parttype (partition type GUID) and pttype (partition table type), because these come from the udev database.
This causes partition discovery to fail -- most visibly on ppc64le where the PReP partition can't be found by GUID, but also affecting ESP discovery on all architectures. On x86_64 UEFI, bootupd silently falls back to mounted-ESP detection, masking the problem; on ppc64le there is no fallback and the install fails hard.
Add a blkid -p fallback in backfill_missing() that probes partition metadata directly from the disk when udev is absent. The udev check tests for /run/udev/data (the actual database directory) rather than /run/udev, because bootc's ensure_mirrored_host_mount() creates an empty /run/udev directory on the bwrap tmpfs that is_same_as_host() then considers 'already mounted'.
Tested end-to-end via the BIB tmt test (plan-33-bib-build) with a patched bootupd that removes the mounted-ESP fallback entirely.
This follows the same approach coreos-installer uses (PRs #1511, sfdisk-based workaround originally added in PR #688.
Assisted-by: OpenCode (Claude Opus 4)