1

systemd units are stored in /lib/systemd/system such as:

rsync.service
avahi-daemon.socket
bluetooth.service
cups.service

When you use the following command:

systemctl enable name

Replace name with the name of the service unit you want to enable (for example, apache2). This command reads the [Install] section of the selected service unit and creates appropriate symbolic links to the /lib/systemd/system/name.service file in the /etc/systemd/system/ directory and its subdirectories.

But some packages don't have *.service files in /lib/systemd/system. Examples are mysql and apache2. Using systemctl to enable them works fine:

# systemctl enable apache2
Synchronizing state for apache2.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d apache2 defaults
Executing /usr/sbin/update-rc.d apache2 enable

Or

# systemctl enable mysql
Synchronizing state for mysql.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d mysql defaults
Executing /usr/sbin/update-rc.d mysql enable

I don't get any result when looking for files related to these services:

# find /etc/systemd/system/ -iname "*apache2*"
# find /etc/systemd/system/ -iname "*mysql*"

How does systemd find out apache2 or mysql is to be enabled?

muru
  • 72,889
PersianGulf
  • 10,850

1 Answers1

1

Synchronizing state for apache2.service with sysvinit using update-rc.d...

And there's your answer, right there. systemd doesn't have service units for these dæmons. But there are System 5 rc scripts in /etc/init.d/ for them. So it is processing those scripts, indirectly via update-rc.d which is reading their LSB headers, to enable/disable the dæmons.

JdeBP
  • 68,745