gwbres / systemctl

:penguin: Small rust crate to interact with systemd
Apache License 2.0
23 stars 14 forks source link

Does not work on Arch linux #14

Open RoastBeefer00 opened 1 year ago

RoastBeefer00 commented 1 year ago

I am importing using use systemctl::*; and running the following code:

let services = list_units(None, None).unwrap();
println!("Services: {:?}", services);

and I get Services: [] no matter what I do.

I validated that systemctl is in /usr/bin/systemctl and when I run the actual commands locally I do not have any problems. Am I missing something obvious here?

gwbres commented 1 year ago

Hello @RoastBeefer00,

I missing something obvious here?

does not look like it,

Can you show us one or two status being reported by systemctl list-unit-files ? It looks like the parser is in failure, but I doubt that would be the case for 100% of the system services

RoastBeefer00 commented 1 year ago

Here is an example of output from systemctl list-unit-files:

UNIT FILE                                  STATE           PRESET  
proc-sys-fs-binfmt_misc.automount          static          -       
-.mount                                    generated       -       
dev-hugepages.mount                        static          -       
dev-mqueue.mount                           static          -       
efi.mount                                  generated       -       
proc-fs-nfsd.mount                         static          -       
proc-sys-fs-binfmt_misc.mount              disabled        disabled
sys-fs-fuse-connections.mount              static          -       
sys-kernel-config.mount                    static          -       
sys-kernel-debug.mount                     static          -       
sys-kernel-tracing.mount                   static          -       
tmp.mount                                  generated       -       
var-lib-machines.mount                     static          -       
var-lib-nfs-rpc_pipefs.mount               static          -       
gpm.path                                   static          -       
systemd-ask-password-console.path          static          -       
systemd-ask-password-wall.path             static          -       
session-1.scope                            transient       -       
accounts-daemon.service                    disabled        disabled
alsa-restore.service                       static          -       
alsa-state.service                         static          -       
archlinux-keyring-wkd-sync.service         static          -       
arptables.service                          disabled        disabled
atop-rotate.service                        static          -       
atop.service                               disabled        disabled
atopacct.service                           disabled        disabled
atopgpu.service                            disabled        disabled
auditd.service                             disabled        disabled
auth-rpcgss-module.service                 static          -       
autovt@.service                            alias           -       
avahi-daemon.service                       enabled         disabled
avahi-dnsconfd.service                     disabled        disabled
blk-availability.service                   disabled        disabled
bluetooth-mesh.service                     disabled        disabled
bluetooth.service                          disabled        disabled
btrfs-scrub@.service                       static          -       
canberra-system-bootup.service             disabled        disabled
canberra-system-shutdown-reboot.service    disabled        disabled
canberra-system-shutdown.service           disabled        disabled
console-getty.service                      disabled        disabled
container-getty@.service                   static          -       
containerd.service                         disabled        disabled
dbus-org.fedoraproject.FirewallD1.service  alias           -       
dbus-org.freedesktop.Avahi.service         alias           -       
dbus-org.freedesktop.hostname1.service     alias           -       
dbus-org.freedesktop.import1.service       alias           -       
dbus-org.freedesktop.locale1.service       alias           -       
dbus-org.freedesktop.login1.service        alias           -       
dbus-org.freedesktop.machine1.service      alias           -       
dbus-org.freedesktop.nm-dispatcher.service alias           -       
dbus-org.freedesktop.portable1.service     alias           -       
dbus-org.freedesktop.timedate1.service     alias           -       
dbus-org.freedesktop.timesync1.service     alias           -       
alexkunde commented 1 year ago

@RoastBeefer00, I had the same problem on ubuntu, but its fixed for me with the newest commit in main. Can you retry?