Code Monkey home page Code Monkey logo

htop-snap's Introduction

This is the snap for htop, an interactive process viewer.
It works on Ubuntu, Fedora, Debian, and other major Linux distributions.

htop

Command-line Installation

sudo snap install htop

(Don't have snapd installed?)

That'll install the latest stable release of htop.

Or, if you're feeling adventurous, try the Launchpad autobuilds for the next major release from the edge channel:

sudo snap install htop --edge

Permissions (optional)

Once installed, this snap can optionally be connected to some extra plugs:

sudo snap connect htop:mount-observe
sudo snap connect htop:network-control  # DELAYACCT support

The Snapcrafters

maxiberta

License

The build files in this repository are provided under the terms of the MIT license.

htop is an open source system monitor licensed under the GPL version 2 or later.

The htop logo in this repository has been adopted from the upstream repository, thus inheriting its license.

Upstream

For more information on htop have a look at its homepage or the source repository.

htop-snap's People

Contributors

albertodonato avatar benbe avatar evandandrea avatar flexiondotorg avatar maxiberta avatar popey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

htop-snap's Issues

htop won't work with kitty

Kitty is currently not available as a snap so I cannot install it with snap. Kitty via apt and htop via apt work fine but Kitty via apt and htop via snap does not.

ubuntu@ubuntu-inspiron:~$ snap install htop
htop 3.0.2 from Maximiliano Bertacchini (maxiberta) installed
ubuntu@ubuntu-inspiron:~$ apt list kitty
Listing... Done
kitty/focal,now 0.15.0-1build1 amd64 [installed]
ubuntu@ubuntu-inspiron:~$ snap list htop
Name  Version  Rev   Tracking       Publisher  Notes
htop  3.0.2    1332  latest/stable  maxiberta  -
ubuntu@ubuntu-inspiron:~$ htop
locales-launch: Data of en_AU locale not found, generating, please wait...
Error opening terminal: xterm-kitty.
ubuntu@ubuntu-inspiron:~$

htoprc is not being loaded/saved

When you run htop and change the settings using F2 and quit, the settings are not saved, so that subsequent uses of htop have default settings.

When I run using the full path:

/snap/htop/current/usr/local/bin/htop

the settings are correctly loaded from ~/.config/htop/htoprc. So I suspect this has something to do with the wrapper script mentioned in #2.

This is using the htop 3.0.5 snap.

I/O tab N/A on Debian/Ubuntu

I/O tab shows N/A on fresh install of Ubuntu/Debian (any version, e.g. Ubuntu 22.04, Debian 11). I've connected all plugs. I see no errors in syslog from apparmor. There is no this issue on CentOS snap. Same issue has other users too (#18).

May be this is related, but I see this not every time:

kernel: [87874.809717] audit: type=1400 audit(1678972246.849:72): apparmor="DENIED" operation="capable" profile="/snap/snapd/18357/usr/lib/snapd/snap-confine" pid=3095775 comm="snap-confine" capability=12 capname="net_admin"
kernel: [87874.811390] audit: type=1400 audit(1678972246.849:73): apparmor="DENIED" operation="capable" profile="/snap/snapd/18357/usr/lib/snapd/snap-confine" pid=3095775 comm="snap-confine" capability=38 capname="perfmon"

Environment and debug:

# snap debug confinement 

strict

# snap debug sandbox-features

apparmor:             kernel:caps kernel:dbus kernel:domain kernel:file kernel:ipc kernel:mount kernel:namespaces kernel:network kernel:network_v8 kernel:policy kernel:ptrace kernel:query kernel:rlimit kernel:signal parser:cap-audit-read parser:cap-bpf parser:mqueue parser:qipcrtr-socket parser:unsafe parser:xdp policy:default support-level:full
confinement-options:  classic devmode strict
dbus:                 mediated-bus-access
kmod:                 mediated-modprobe
mount:                layouts mount-namespace per-snap-persistency per-snap-profiles per-snap-updates per-snap-user-profiles stale-base-invalidation
seccomp:              bpf-actlog bpf-argument-filtering kernel:allow kernel:errno kernel:kill_process kernel:kill_thread kernel:log kernel:trace kernel:trap kernel:user_notif
udev:                 tagging

# snap connections htop

Interface         Plug                   Slot               Notes
hardware-observe  htop:hardware-observe  :hardware-observe  -
mount-observe     htop:mount-observe     :mount-observe     manual
network           htop:network           :network           -
network-control   htop:network-control   :network-control   manual
process-control   htop:process-control   :process-control   -
system-observe    htop:system-observe    :system-observe    -

# snap list

Name     Version   Rev    Tracking       Publisher     Notes
certbot  2.4.0     2836   latest/stable  certbot-eff✓  classic
core20   20230207  1828   latest/stable  canonical✓    base
core22   20230210  522    latest/stable  canonical✓    base
htop     3.2.2     3654   latest/stable  maxiberta     -
snapd    2.58.2    18357  latest/stable  canonical✓    snapd

# SNAPD_DEBUG=1 SNAP_CONFINE_DEBUG=1 snap run htop

2023/03/16 16:06:27.914156 tool_linux.go:204: DEBUG: restarting into "/snap/snapd/current/usr/bin/snap"
2023/03/16 16:06:27.930338 logger.go:184: DEBUG: -- snap startup {"stage":"start", "time":"1678971987.930332"}
2023/03/16 16:06:27.938103 cmd_run.go:1037: DEBUG: executing snap-confine from /snap/snapd/18357/usr/lib/snapd/snap-confine
2023/03/16 16:06:27.939851 cmd_run.go:440: DEBUG: SELinux not enabled
2023/03/16 16:06:27.939922 tracking.go:46: DEBUG: creating transient scope snap.htop.htop
2023/03/16 16:06:27.939942 tracking.go:189: DEBUG: session bus is not available: cannot find session bus
2023/03/16 16:06:27.939950 tracking.go:191: DEBUG: falling back to system bus
2023/03/16 16:06:27.940724 tracking.go:196: DEBUG: using system bus now, session bus was not available
2023/03/16 16:06:27.942291 tracking.go:319: DEBUG: create transient scope job: /org/freedesktop/systemd1/job/1571
2023/03/16 16:06:27.959259 tracking.go:419: DEBUG: job result is "done"
2023/03/16 16:06:27.959310 tracking.go:426: DEBUG: transient scope snap.htop.htop.33fce624-45a0-494b-870a-0859a05e9c21.scope created
2023/03/16 16:06:27.959691 tracking.go:146: DEBUG: waited 18.893718ms for tracking
2023/03/16 16:06:27.959721 logger.go:184: DEBUG: -- snap startup {"stage":"snap to snap-confine", "time":"1678971987.959717"}
DEBUG: -- snap startup {"stage":"snap-confine enter", "time":"1678971987.962342"}
DEBUG: umask reset, old umask was  022
DEBUG: security tag: snap.htop.htop
DEBUG: executable:   /usr/lib/snapd/snap-exec
DEBUG: confinement:  non-classic
DEBUG: base snap:    core22
DEBUG: ruid: 0, euid: 0, suid: 0
DEBUG: rgid: 0, egid: 0, sgid: 0
DEBUG: apparmor label on snap-confine is: /snap/snapd/18357/usr/lib/snapd/snap-confine
DEBUG: apparmor mode is: enforce
DEBUG: -- snap startup {"stage":"snap-confine mount namespace start", "time":"1678971987.963121"}
DEBUG: creating lock directory /run/snapd/lock (if missing)
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: opening lock directory /run/snapd/lock
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: opening lock file: /run/snapd/lock/.lock
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: sanity timeout initialized and set for 30 seconds
DEBUG: acquiring exclusive lock (scope (global), uid 0)
DEBUG: sanity timeout reset and disabled
DEBUG: ensuring that snap mount directory is shared
DEBUG: unsharing snap namespace directory
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: releasing lock 5
DEBUG: opened snap-update-ns executable as file descriptor 5
DEBUG: opened snap-discard-ns executable as file descriptor 6
DEBUG: creating lock directory /run/snapd/lock (if missing)
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: opening lock directory /run/snapd/lock
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: opening lock file: /run/snapd/lock/htop.lock
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: set_effective_identity uid:0 (change: no), gid:0 (change: yes)
DEBUG: sanity timeout initialized and set for 30 seconds
DEBUG: acquiring exclusive lock (scope htop, uid 0)
DEBUG: sanity timeout reset and disabled
DEBUG: initializing mount namespace: htop
DEBUG: setting up device cgroup
DEBUG: libudev has current tags support
DEBUG: device /sys/devices/virtual/misc/rfkill has matching current tag
DEBUG: get bpf object at path /sys/fs/bpf/snap/snap_htop_htop
DEBUG: found existing device map
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: get next key for map 8
DEBUG: found 18 existing entries in devices map
DEBUG: delete key for c 139:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 143:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:9
DEBUG: delete elem in map 8
DEBUG: delete key for c 138:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:3
DEBUG: delete elem in map 8
DEBUG: delete key for c 142:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 136:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 137:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 5:2
DEBUG: delete elem in map 8
DEBUG: delete key for c 10:242
DEBUG: delete elem in map 8
DEBUG: delete key for c 5:1
DEBUG: delete elem in map 8
DEBUG: delete key for c 141:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:5
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:8
DEBUG: delete elem in map 8
DEBUG: delete key for c 140:-1
DEBUG: delete elem in map 8
DEBUG: delete key for c 5:0
DEBUG: delete elem in map 8
DEBUG: delete key for c 10:200
DEBUG: delete elem in map 8
DEBUG: delete key for c 1:7
DEBUG: delete elem in map 8
DEBUG: load program of type 0xf, 33 instructions
DEBUG: v2 allow c 1:3
DEBUG: v2 allow c 1:5
DEBUG: v2 allow c 1:7
DEBUG: v2 allow c 1:8
DEBUG: v2 allow c 1:9
DEBUG: v2 allow c 5:0
DEBUG: v2 allow c 5:1
DEBUG: v2 allow c 5:2
DEBUG: v2 allow c 136:4294967295
DEBUG: v2 allow c 137:4294967295
DEBUG: v2 allow c 138:4294967295
DEBUG: v2 allow c 139:4294967295
DEBUG: v2 allow c 140:4294967295
DEBUG: v2 allow c 141:4294967295
DEBUG: v2 allow c 142:4294967295
DEBUG: v2 allow c 143:4294967295
DEBUG: v2 allow c 10:200
DEBUG: inspecting type of device: /dev/rfkill
DEBUG: v2 allow c 10:242
DEBUG: device /sys/devices/virtual/misc/tun has matching current tag
DEBUG: inspecting type of device: /dev/net/tun
DEBUG: v2 allow c 10:200
DEBUG: device /sys/module/rfkill has matching current tag
DEBUG: cannot get major/minor numbers for syspath /sys/module/rfkill
DEBUG: process in cgroup /system.slice/snap.htop.htop.33fce624-45a0-494b-870a-0859a05e9c21.scope
DEBUG: cgroup /sys/fs/cgroup//system.slice/snap.htop.htop.33fce624-45a0-494b-870a-0859a05e9c21.scope opened at 12
DEBUG: attach type 0x6 program 10 to cgroup 12
DEBUG: associated snap application process 348196 with device cgroup snap.htop.htop
DEBUG: forked support process 348212
DEBUG: changing apparmor hat to mount-namespace-capture-helper
DEBUG: helper process waiting for command
DEBUG: sanity timeout initialized and set for 30 seconds
DEBUG: block device of snap core22, revision 547 is 7:5
DEBUG: sanity timeout initialized and set for 30 seconds
DEBUG: joining preserved mount namespace for inspection
DEBUG: found base snap device 7:5 on /
DEBUG: sanity timeout reset and disabled
DEBUG: preserved mount is not stale, reusing
DEBUG: joined preserved mount namespace htop
DEBUG: releasing lock 7
DEBUG: sending command 0 to helper process (pid: 348212)
DEBUG: sanity timeout reset and disabled
DEBUG: helper process received command 0
DEBUG: helper process exiting
DEBUG: waiting for response from helper
DEBUG: waiting for the helper process to exit
DEBUG: helper process exited normally
DEBUG: resetting PATH to values in sync with core snap
DEBUG: -- snap startup {"stage":"snap-confine mount namespace finish", "time":"1678971987.970799"}
DEBUG: set_effective_identity uid:0 (change: yes), gid:0 (change: yes)
DEBUG: creating user data directory: /root/snap/htop/3654
DEBUG: requesting changing of apparmor profile on next exec to snap.htop.htop
DEBUG: ruid: 0, euid: 0, suid: 0
DEBUG: loading bpf program for security tag snap.htop.htop
DEBUG: read 6608 bytes from /var/lib/snapd/seccomp/bpf//snap.htop.htop.bin
DEBUG: read 152 bytes from /var/lib/snapd/seccomp/bpf/global.bin
DEBUG: execv(/usr/lib/snapd/snap-exec, /usr/lib/snapd/snap-exec...)
DEBUG:  argv[1] = htop
DEBUG: umask restored to  022
DEBUG: working directory restored to /root
DEBUG: -- snap startup {"stage":"snap-confine to snap-exec", "time":"1678971987.972417"}
2023/03/16 16:06:27.975617 logger.go:184: DEBUG: -- snap startup {"stage":"snap-exec to app", "time":"1678971987.975612"}

WARNING: cannot create user data directory

Hi! First, thank for snaping this!

I'm using Ubuntu Core in a Intel NUC board. Ubuntu Core 18 was installed on the internal eMMC storage (https://www.ubuntu.com/download/iot/intel-nuc).

Once Htop Snap is intalled, I run this command: 'htop' and there is a warning:

2019/01/12 15:40:34.496324 cmd_run.go:835: WARNING: cannot create user data directory: cannot create "/home/iotcomm/snap/htop/1066": mkdir /home/iotcomm/snap: no space left on device cannot create user data directory: /home/iotcomm/snap/htop/1066: No space left on device

Best regards.

ENV lost when executing htop

I think that something is wrong with the ENV when executing htop, because, for example, when I choose the "Tree" view, the "lines" are drawn using ASCII:
image

But if I execute the binary directly, like this:

$ /snap/htop/current/bin/htop

UTF-8 characters are used:

image

App armor denies access to `/proc/spl/kstat/zfs/arcstats`

I've installed htop version 3.0.5 and am running into the issue that htop is not able to access /proc/spl/kstat/zfs/arcstats.

This is an excerpt from the syslog:

[42062.241628] audit: type=1400 audit(1616518163.683:3498): apparmor="DENIED" operation="open" profile="snap.htop.htop" name="/proc/spl/kstat/zfs/arcstats" pid=872438 comm="htop" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

The effect is also noticeable within the interface, where all ZFS ARC related meters are disfunctional.

$ snap info htop
name:      htop
summary:   Interactive processes viewer
publisher: Maximiliano Bertacchini (maxiberta)
store-url: https://snapcraft.io/htop
contact:   https://github.com/maxiberta/htop-snap/issues
license:   GPL-2.0
description: |
  `htop` is an ncurses-based process viewer similar to top, but it allows one to scroll the list
  vertically and horizontally to see all processes and their full command lines. Tasks related to
  processes (killing, renicing) can be done without entering their PIDs.

  Once installed, this snap can _optionally_ be connected to some extra plugs (permissions):

     sudo snap connect htop:hardware-observe  # temperature+battery status
     sudo snap connect htop:mount-observe
     sudo snap connect htop:network-control  # DELAYACCT

  Main website: https://htop.dev/
commands:
  - htop
snap-id:      hJmReLmgXSUj4SF7WhyTVRV6IzUa4QUZ
tracking:     latest/stable
refresh-date: today at 05:30 CET
channels:
  latest/stable:    3.0.5              2021-01-28 (2184) 16MB -
  latest/candidate: 3.0.5              2021-01-28 (2184) 16MB -
  latest/beta:      ↑
  latest/edge:      3.0.5-189-g7b293dc 2021-03-22 (2470) 16MB -
installed:          3.0.5                         (2184) 16MB -

htop 3.0.5 snap returns error message when starting.

The following error message is returned:
Error: File /etc/sensors3.conf: Permission denied

The application starts allright, but still drops the error message.
htop_error

The file /etc/sensors3.conf is owned by root as expected.
Output of snap version:

snap    2.48.2
snapd   2.48.2
series  16
ubuntu  20.04
kernel  5.4.0-64-generic

The apt/deb version of htop 3.0.5 works without issue.

I/O tab

Ubuntu 22.04,

sudo htop
on I/O tab columns DISK R/W,DISK READ,DISK WRITE (IO_RATE, IO_READ_RATE, IO_WRITE_RATE) has N/A values.
Screenshot_3

no longer install latest snap - depends on core22

I can no longer install the latest snap for htop, I get this:

→ snap install htop
error: cannot perform the following tasks:
- Ensure prerequisites for "htop" are available (cannot install snap base "core22": snap "core22" assumes unsupported features: snapd2.55.5 (try to refresh snapd))
→ snap list
Name                    Version   Rev    Tracking       Publisher     Notes
core20                  20220527  1518   latest/stable  canonical✓    base
snapd                   2.56      16010  latest/stable  canonical✓    snapd

The host is running Rocky Linux 8.6. The RPM installed is snapd-2.55.3-1.el8.x86_64.

log spam AVC apparmor="DENIED"

Hello,

how to avoid log spam ?

AVC apparmor="DENIED" operation="open" profile="snap.htop.htop" name="/proc/2599/task/2600/" pid=11974 comm="htop" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

i remove snap and choose apt version 😮‍💨

Incompatible htop license change

Hi @maxiberta - you've listed this github repository as MIT licensed and it performs a build of the htop sources. The htop sources are made available under the GPLv2 license, which is incompatible with the MIT license. Derivative works based on GPLv2 licensed works are again subject to being licensed under the GPLv2. Could you update the license on this repository accordingly please?

References: https://en.wikipedia.org/wiki/GNU_General_Public_License#Compatibility_and_multi-licensing

Many thanks!

-- BenBE (on behalf of the htop maintainers)

Delay stats not available

Delay stats like PERCENT_CPU_DELAY, PERCENT_IO_DELAY, PERCENT_SWAP_DELAY are not available as columns in the htop snap.
From the documentation, it seems CAP_NET_ADMIN is needed, so it should be just a matter of adding a plug for the network-control interface to the snap.

Can't lsof of processes

Hi! First, thank for snaping this!

Second: I've seen that when I try to list the open files of a process (using 'l') I get this message:

Could not execute 'lsof'. Please make sure it is available in your $PATH.

I guess the solution would be as easy as adding lsof to the stage-packages, but I'm not sure.

Thanks again!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.