This question asks: "How to list all enabled services from systemctl?" Answers on that page include:
systemctl list-unit-files | grep enabled
systemctl list-unit-files --state=enabled
At least as of systemd version 229 (on Ubuntu 16.04), systemctl list-unit-files
will not include "LSB" services that are launched via legacy init scripts.
Therefore, the original question seems to remain unanswered: Can systemd display a list of ALL the services (and other unit types) that it will try to start at boot, including legacy services?
Consider:
$ systemctl list-units | grep LSB | grep grub
grub-common.service loaded active exited LSB: Record successful boot for GRUB
$ systemctl list-unit-files | grep enabled | grep grub || echo 'nothing found'
nothing found
$ systemctl is-enabled grub-common
grub-common.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install is-enabled grub-common
enabled
systemctl
knows about grub-common
, and if you ask explicitly systemctl
will tell you it is enabled.
So... is there a way to get systemd to display a list of ALL the services it will attempt to run at boot, including legacy scripts?
systemctl list-units --type service --all
work for you?list-unit-files
. For example, Debian 9 (Stretch) has systemd version 232. However, I only have one LSB service on that system:raspi-config.service
. It isenabled
, but its state isgenerated
. It is listed when I runsystemctl list-unit-files --state=generated
. But now we have a new wrinkle: a service thatis-enabled
but whose state is notenabled
. So it appears there is not a one-to-one mapping between beingenabled
and having a state ofenabled
.