Can systemctl list all enabled services, including legacy services

init-scriptlsbstartupsystemdsysvinit

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?

Best Answer

I believe the command you want is:

systemctl list-units --type service --all

This from my test lists all service even those from legacy boot services.

Source:

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-services