btop icon indicating copy to clipboard operation
btop copied to clipboard

[BUG] apparmor premission denial stops zfs drive io stats from displaying in ubuntu snap btop

Open TheWoodsy opened this issue 1 year ago • 7 comments

Describe the bug Ubuntu 22.04.3 LTS SNAP btop will not show zfs iostats because apparmor denies access. See #339 from an eternity ago.

To Reproduce have ZFS FS > snap install btop

Expected behavior allow access to show zfs mounts io as intended

Info (please complete the following information):

  • btop++ version: 1.2.13
  • Binary: static binary from release
  • Architecture: x86_64
  • Platform: Linux Ubuntu 22.04.3 LTS
  • (Linux) Kernel: 5.15.0-87-generic
  • Terminal used: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)

Additional context SNAP version which is allegedly https://github.com/kz6fittycent/btop Tried looking for anything related to /var/lib/snapd/apparmor/profiles/snap.btop.btop (which needs modification for fix) but couldn't find anything, no idea how snap makes theses files. Should this bug even be attributed here or at the snap repo?...

Workaround/Fix edit /var/lib/snapd/apparmor/profiles/snap.btop.btop find "@{PROC}/spl/kstat/zfs/arcstats r," ~line 790 add line "@{PROC}/spl/kstat/zfs/** r," apparmor_parser -r /var/lib/snapd/apparmor/profiles/snap.btop.btop run btop and enjoy working IO

Please assist. Thanks.

TheWoodsy avatar Oct 21 '23 15:10 TheWoodsy

see also #639

TheWoodsy avatar Nov 02 '23 06:11 TheWoodsy

This issue can be resolved fo the snap case by running the followign after install:

snap connect btop-desktop:hardware-observe
snap connect btop-desktop:mount-observe
snap connect btop-desktop:network-observe
snap connect btop-desktop:process-control
snap connect btop-desktop:removable-media
snap connect btop-desktop:system-observe

EndlessDex avatar Dec 07 '23 18:12 EndlessDex

This issue can be resolved fo the snap case by running the followign after install:

snap connect btop-desktop:hardware-observe
snap connect btop-desktop:mount-observe
snap connect btop-desktop:network-observe
snap connect btop-desktop:process-control
snap connect btop-desktop:removable-media
snap connect btop-desktop:system-observe

adapted for Ubuntu 22.04:

snap connect btop:hardware-observe snap connect btop:mount-observe snap connect btop:network-observe snap connect btop:process-control snap connect btop:removable-media snap connect btop:system-observe

Dec 08 13:56:31 audit[102049]: AVC apparmor="DENIED" operation="open" profile="snap.btop.btop" name="/proc/spl/kstat/zfs/nvme1/" pid=102049 comm="btop" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

Repeats apparmor denied error for each mount point.

This did not remedy.

TheWoodsy avatar Dec 08 '23 04:12 TheWoodsy

Interesting. Please try running snap connections btop and see if any others are missing. My specific issue was with ptrace and networks. That led me to finding the missing permissions. I do not have specific experience with the ZFS issue.

EndlessDex avatar Dec 08 '23 05:12 EndlessDex

literally added everything

snap connect btop:audio-playback snap connect btop:audio-record snap connect btop:avahi-observe snap connect btop:browser-support snap connect btop:camera snap connect btop:content snap connect btop:cups-control snap connect btop:desktop snap connect btop:desktop-legacy snap connect btop:gsettings snap connect btop:hardware-observe snap connect btop:home snap connect btop:joystick snap connect btop:kernel-module-control snap connect btop:lxd-support snap connect btop:mount-control snap connect btop:mount-observe snap connect btop:network snap connect btop:network-bind snap connect btop:network-control snap connect btop:network-manager snap connect btop:network-observe snap connect btop:opengl snap connect btop:personal-files snap connect btop:process-control snap connect btop:removable-media snap connect btop:screen-inhibit-control snap connect btop:system-files snap connect btop:system-observe snap connect btop:system-packages-doc snap connect btop:u2f-devices snap connect btop:unity7 snap connect btop:upower-observe snap connect btop:wayland snap connect btop:x11 error: snap "btop" has no plug named "audio-playback" error: snap "btop" has no plug named "audio-record" error: snap "btop" has no plug named "avahi-observe" error: snap "btop" has no plug named "browser-support" error: snap "btop" has no plug named "camera" error: snap "btop" has no plug named "content" error: snap "btop" has no plug named "cups-control" error: snap "btop" has no plug named "desktop" error: snap "btop" has no plug named "desktop-legacy" error: snap "btop" has no plug named "gsettings" error: snap "btop" has no plug named "joystick" error: snap "btop" has no plug named "kernel-module-control" error: snap "btop" has no plug named "lxd-support" error: snap "btop" has no plug named "mount-control" error: snap "btop" has no plug named "network-bind" error: snap "btop" has no plug named "network-control" error: snap "btop" has no plug named "network-manager" error: snap "btop" has no plug named "opengl" error: snap "btop" has no plug named "personal-files" error: snap "btop" has no plug named "screen-inhibit-control" error: snap "btop" has no plug named "system-files" error: snap "btop" has no plug named "system-packages-doc" error: snap "btop" has no plug named "u2f-devices" error: snap "btop" has no plug named "unity7" error: snap "btop" has no plug named "upower-observe" error: snap "btop" has no plug named "wayland" error: snap "btop" has no plug named "x11"

[===>snap connections btop Interface Plug Slot Notes hardware-observe btop:hardware-observe :hardware-observe - home btop:home :home - mount-observe btop:mount-observe :mount-observe - network btop:network :network - network-observe btop:network-observe :network-observe - process-control btop:process-control :process-control - removable-media btop:removable-media :removable-media manual system-observe btop:system-observe :system-observe -

No dice. Only fix thus-far is the workaround in first post.

TheWoodsy avatar Dec 08 '23 05:12 TheWoodsy

Even the first post didn't fix (for latest rev in the edge channel). I will open a thread on forum.snapcraft.io to see if there's any other input.

NOTE: I've verified the stable channel is working so do NOT refresh to edge!

kz6fittycent avatar Dec 09 '23 22:12 kz6fittycent

Please see my forum post regarding this issue: https://forum.snapcraft.io/t/btop-having-issues-with-segfault-on-hosts-running-zfs/38078

kz6fittycent avatar Dec 09 '23 23:12 kz6fittycent