Closed siph closed 4 months ago
Thanks for the bug report! You should definitely be able to run without elevated privileges, no flags needed. By default systemctl-tui
tries to load both global+user services (same as --scope all
).
Running
systemctl-tui --scope global
will launch properly and show the services, but consistently panics after 5 seconds.
That's strange - it sounds like systemctl-tui
is able to get a list of services from systemd on initial startup, but fails when it's trying to refresh the list of services.
I'm not able to reproduce this unfortunately (it works as expected for me on Ubuntu 23.10 and Debian/Raspbian 11). I wonder if it's a Nix issue... can you reproduce the issue with any of the following?
cargo run
outside of a Nix setup?Also, what version+distro of Linux are you running?
I'm on NixOS. I did some testing yesterday before I ran out of time and It definitely seems to be a NixOS problem (not nix). Something to do with how NixOS handles user-systemd units? I didn't bisect but this is the almost certainly where it happened (https://github.com/rgwood/systemctl-tui/commit/7c92092a5d8c4357f1cb9a131ca149af073ef2cf).
To be clear this used to work like expected and the current version in nixpkgs (0.2.4
) works with NixOS. 0.3.1
does partially work, just not without elevated privileges.
cargo run
on NixOS:
Error: Unable to get services. Check that systemd is running and try running this tool with sudo.
Caused by: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1
- `cargo run` on Ubuntu:latest (same machine with distrobox):
```bash
Error: Unable to get services. Check that systemd is running and try running this tool with sudo.
Caused by:
0: I/O error: No such file or directory (os error 2)
1: No such file or directory (os error 2)
cargo run
on Ubuntu:20.04.6_LTS (The only non-Nixos machine I have): OKnix run github:siph/nixpkgs/systemctl-tui#systemctl-tui
(0.3.1
with nix) on Ubuntu:20.04.6_LTS: OKI didn't test any pre-built binaries because it's kind of tedious on NixOS and the cargo-built binaries returned the same errors so I assume it isn't build-time related.
Thanks, again!
Appreciate the extra detail.
I don't have a NixOS machine/VM right now and probably won't anytime soon, so if someone else has the motivation to figure this out (or just more info on how NixOS handles user services) I'd appreciate it.
As a quick+dirty fix, I suppose I could make it so that a failure to retrieve user services logs an error without panicking. Just feels a little icky because that's something that should never happen and I don't want to mask such a major error on non-NixOS systems. Hmm!
I agree. I'm sure there's a reasonable fix. I'm not an expert but I'm happy to take a deeper look when I have some time or when I'm trying to procrastinate.
I haven't had a chance to look at this but was testing 0.3.5
and --scope global
seems to work without crashing. user
and all
are still failing on my main machine:
Error: Unable to get services. Check that systemd is running and try running this tool with sudo.
Caused by:
org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1
However, I failed to reproduce any of these errors on a different NixOS machine. All scopes worked with user permissions.
My best guess is that something is wrong on my end and because I got perfect functionality from systemctl-tui
on a NixOS machine I will go ahead and close this.
Thanks!
Hi. I maintain
systemctl-tui
innixpkgs
and I have been having some interesting problems while trying to update to0.3.1
.First, I'm a bit confused about what flags should be used when running
systemctl-tui
without elevated privileges and while testing I found that--scope global
seems to be the only one that can find the services (shouldn't--scope user
work?). In prior versions,systemctl-tui
could be ran without any flags or elevated privileges and I just wanted to confirm that this is intentionally no longer the case?However, this amusing bug is the main reason I opened this:![Screenshot_20240130_130552](https://github.com/rgwood/systemctl-tui/assets/6619112/2ab68f75-d6cb-49ad-b02d-9604e399190f)
Running
systemctl-tui --scope global
will launch properly and show the services, but consistently panics after 5 seconds. I haven't noticed any problems when running as superuser.I also tried building against the latest revision (00b5fcf63a0241bb4cf8df54f69cb5be3ce2078a) and got the same results.
Thanks!