[systemd-devel] systemctl list all possible (including unloaded) services

Lennart Poettering lennart at poettering.net
Mon May 13 08:02:46 UTC 2019


On Fr, 10.05.19 13:27, Roger Pack (rogerdpack2 at gmail.com) wrote:

> > Seems to work here. I have just one sysvinit script:
> > $ ls /etc/init.d/
> > functions  network  README
> > $ systemctl list-unit-files 'network*'
> > UNIT FILE             STATE
> > network.service       generated
> > ...
> > $ systemctl cat network.service
> > # /run/systemd/generator.late/network.service
> > # Automatically generated by systemd-sysv-generator
> > ...
> > $ systemctl start network<TAB> # autocompletes to network.service
> >
> > $ systemctl --version
> > systemd 241 (v241-7.gita2eaa1c.fc30)
>
> Interesting.  I tried the following on a Debian 8 box, where
> /etc/init.d/sysstat exists
>
> # systemctl --version
> systemd 215
> # systemctl enable sysstat
> Synchronizing state for sysstat.service with sysvinit using update-rc.d...
> Executing /usr/sbin/update-rc.d sysstat defaults
> Executing /usr/sbin/update-rc.d sysstat enable
> # systemctl list-unit-files | grep sysstat
> (empty, even if it's enabled)
> # systemctl
> However on a Debian 9 box:
> # systemctl --version
> systemd 232
> # systemctl list-unit-files | grep sysstat
> sysstat.service                        generated
>
> It's always listed even if it's disabled.
>
> Unfortunately I can't easily test a CentOS box with a newer systemctl
> since its version of libmount seems stuck at "old" version 2.32.  But
> for now hoping it was just a bug fixed in later versions.  Also of
> note is that with older versions of systemctl, as expected, if it
> "attempted" to autostart an init.d but failed, it would still show up
> in the output of `systemctl list-units`, but never in the output of
> list-unit-files, which is what gave me the initial impression it
> wasn't available at all if it didn't autostart.
> Thanks all for the feedback and help!

In really old systemd versions "systemctl list-unit-files" only showed
native unit files. In newer versions we also display generated unit
files, to make them more discoverable.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list