rgwood / systemctl-tui

A fast, simple TUI for interacting with systemd services and their logs
MIT License
235 stars 5 forks source link

can't run on WSL #1

Closed fdncred closed 1 year ago

fdncred commented 1 year ago

It looks cool so I wanted to try it out on ubuntu wsl with systemd running. I get this

cargo r
Finished dev [unoptimized + debuginfo] target(s) in 0.07s
     Running `target/debug/systemctl-tui`
Error: I/O error: No such file or directory (os error 2)

Caused by:
    No such file or directory (os error 2)

I assume that's because there's some file it's not able to find, or maybe it just doesn't work in WSL?

rgwood commented 1 year ago

Hmm, probably a WSL-specific issue; I haven’t tested it on WSL yet but it’s been fine on several native Linux machines.

rgwood commented 1 year ago

If you run the executable with sudo does it still fail?

fdncred commented 1 year ago

Same.

sudo ./target/debug/systemctl-tui                                                                       1  161  10:52:15 AM
[sudo] password for fdncred:
Error: I/O error: No such file or directory (os error 2)

Caused by:
    No such file or directory (os error 2)
fdncred commented 1 year ago

Looks like it's the zbus::Connection that's failing.

fdncred commented 1 year ago

This could totally be my system too

> systemctl 
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
fdncred commented 1 year ago

And yet, this works. Sorry for spamming you so much. WSL is a bit weird, but we know this already. :) image

fdncred commented 1 year ago

One last spam. Here's the secret sauce for WSL. I added the [boot] section.

[interop]
enabled = true # enable launce of windows binaries; default is true
appendWindowsPath = false # append windows path to $PATH variable; default is true
systemd = true

[boot]
systemd = true

[network]
generateResolvConf = true

image

rgwood commented 1 year ago

Glad you figured it out!

I'll try to add a better error message when systemd isn't running.