bpytop: [BUG] PermissionError: [Errno 13] Permission denied: '/proc/diskstats' when running from snap

Upon invocation bpytop starts, displays loading screen and promptly exits with the error message: Bpytop exited with errorcode (1). See /root/snap/bpytop/147/.config/bpytop/error.log for more information! The log file boils down to PermissionError: [Errno 13] Permission denied: '/proc/diskstats' I can read /proc/diskstats as normal user (permission 444).

To Reproduce

snap install bpytop
bpytop

Expected behavior bpytop starts in all its glory

Info

  • bpytop version: 1.0.42
  • psutil version: 5.7.2
  • PopOs 20.04, linux pop-os 5.4.0-7642-generic # 46~ 1598628707~ 20.04~ 040157c-Ubuntu
  • Terminal used: bash
  • Font used:?
  • Python: 3.8.2
  • snap: 2.47.1
  • snapd: 2.47.1
  • series 16

Additional context

20/10/20 (22:04:37) | ERROR: Data collection thread failed with exception: [Errno 13] Permission denied: ‘/proc/diskstats’ Traceback (most recent call last): File “/snap/bpytop/147/usr/bin/bpytop”, line 2597, in _runner collector._collect() File “/snap/bpytop/147/usr/bin/bpytop”, line 2930, in _collect io_counters = psutil.disk_io_counters(perdisk=True if SYSTEM == “Linux” else False, nowrap=True) File “/snap/bpytop/147/usr/lib/python3/dist-packages/psutil/init.py”, line 2063, in disk_io_counters rawdict = _psplatform.disk_io_counters(**kwargs) File “/snap/bpytop/147/usr/lib/python3/dist-packages/psutil/_pslinux.py”, line 1123, in disk_io_counters for entry in gen: File “/snap/bpytop/147/usr/lib/python3/dist-packages/psutil/_pslinux.py”, line 1074, in read_procfs with open_text(“%s/diskstats” % get_procfs_path()) as f: File “/snap/bpytop/147/usr/lib/python3/dist-packages/psutil/_common.py”, line 727, in open_text return open(fname, “rt”, **kwargs) PermissionError: [Errno 13] Permission denied: ‘/proc/diskstats’ 20/10/20 (22:04:37) | WARNING: Exiting with errorcode (1). Runtime 0:00:02

(try running bpytop with --debug flag if error.log is empty)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 20 (5 by maintainers)

Most upvoted comments

This tip from the README file fixed the issue for me:

Give permissions

sudo snap connect bpytop:mount-observe
sudo snap connect bpytop:network-control
sudo snap connect bpytop:hardware-observe
sudo snap connect bpytop:system-observe
sudo snap connect bpytop:process-control
sudo snap connect bpytop:physical-memory-observe

(As would a non snap package so it works on systems that snap doesn’t work on (like where ~ isn’t in /home) )

@kz6fittycent Figured that was likely. Guess they need to manually review it, not sure who would actually be dumb enough to write malware in python though 😃