fix(tools): report host view instead of snap mount namespace#8
Merged
Conversation
Strict-confined snaps with base core24 see /etc/os-release and
/proc/self/mountinfo from the snap's mount namespace, not the host's,
so system_info reported "Ubuntu Core 24", list_mounts was dominated by
snap squashfs and bind-mount entries, and list_block_devices reported
sda1 mounted at /var/lib/snapd/hostfs with /boot shadowed by the snap
base.
- system_info: prefer /var/lib/snapd/hostfs/{etc,usr/lib}/os-release
when in a snap (granted by the existing system-observe plug).
- list_mounts: read /proc/1/mountinfo instead of /proc/self/mountinfo
when in a snap; PID 1 lives in the host's mount namespace.
- list_block_devices: post-process the lsblk JSON, rewriting each
device's mountpoint/mountpoints/fsroots from a major:minor index
built from PID 1's mountinfo.
- procfs: factor MountsForPID(pid) out of Mounts() to enable the above.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Strict-confined snaps with base core24 see /etc/os-release and /proc/self/mountinfo from the snap's mount namespace, not the host's, so system_info reported "Ubuntu Core 24", list_mounts was dominated by snap squashfs and bind-mount entries, and list_block_devices reported sda1 mounted at /var/lib/snapd/hostfs with /boot shadowed by the snap base.