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

Mantas Mikulėnas grawity at gmail.com
Fri May 10 15:41:13 UTC 2019


On Fri, May 10, 2019 at 6:27 PM Roger Pack <rogerdpack2 at gmail.com> wrote:

> Hello, I'm trying to answer this question:
>
>
> https://unix.stackexchange.com/questions/517872/systemctl-list-all-possible-including-disabled-services
>
> Basically, I have a my_service.service that is disabled, I wish I
> could "see that it is an option to start" by running systemctl, but it
> doesn't seem to show up in any incantation of queries.  The reason
> being I wanted to check that some /etc/init.d/XX scripts "had an
> autogenerated service equivalent or not" and some were showing up in
> the systemctl lists and some weren't (the disabled ones weren't, even
> though still controllable by systemctl).  It was some newbie confusion
> but still...confusing.
>
> My hunch is that since it isn't auto started it is never "loaded" and
> then doesn't appear in any query (if this is the case I really wish a
> new command could be created to "list all units installed on the
> system").


Such a command would be `systemctl list-unit-files`. As the name implies,
it doesn't show truly virtual units (.device), but it *does* show generated
units as they have actual files in /run/systemd -- and they're shown
whether they've been enabled to start on boot or not.

If the unit doesn't show up there either (and presumably isn't in
/{etc,run,lib,usr/lib}/systemd, then it could just be that
systemd-sysv-generator completely skipped it for some reason.

As for the more common `systemctl list-units`, yes, it only shows in-memory
units (including virtual ones), and units only stay loaded in systemd's
memory if they're active/activating/failed or otherwise "interesting".

-- 
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190510/36d17243/attachment.html>


More information about the systemd-devel mailing list