Skip to content

fix(tools): report host view instead of snap mount namespace#8

Merged
gjolly merged 1 commit into
mainfrom
fix/snap_view
May 13, 2026
Merged

fix(tools): report host view instead of snap mount namespace#8
gjolly merged 1 commit into
mainfrom
fix/snap_view

Conversation

@gjolly

@gjolly gjolly commented May 13, 2026

Copy link
Copy Markdown
Collaborator

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.

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>
@gjolly gjolly merged commit d494adb into main May 13, 2026
2 checks passed
@gjolly gjolly deleted the fix/snap_view branch May 13, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant