1

I have a fresh install of Ubuntu 16.04.1 with nginx installed, and when dpkg installed nginx, it registered the boot time config in two locations.

Systemd location

systemd config which states to start nginx daemon on boot (or "multi-user target")

% ls -l /etc/systemd/system/multi-user.target.wants/nginx.service                       
/etc/systemd/system/multi-user.target.wants/nginx.service -> /lib/systemd/system/nginx.service

Init V location

initV config which states to start nginx daemon on boot (or "run level 5")

% ls -l /etc/rc5.d/S02nginx
lrwxrwxrwx 1 root root 15 Apr  2 23:27 /etc/rc5.d/S02nginx -> ../init.d/nginx

If I disable nginx, systemd gives some output indicating some kind of backward compatibility actions are occuring

% sudo systemctl disable  nginx.service  
Synchronizing state of nginx.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install disable nginx
insserv: warning: current start runlevel(s) (empty) of script `nginx' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `nginx' overrides LSB defaults (0 1 6).

This will remove BOTH the symlinks from above.
Why is this setup this way? Why isn't there just one or the other - either the new systemd config or the old systemV init?

  • Because Ubuntu inherits this stuff from Debian where alternate init systems are supported. – jordanm Apr 3 '17 at 6:21
  • @jordanm I can understand that alternate init systems need to be supported because many programs in the apt package ecosystem and in the linux/unix ecosystem in general would expect the init scripts to be available during a session, but during boot, shouldnt only one mechanism be necessary to start a daemon? – the_velour_fog Apr 3 '17 at 6:30
2

As jordanm comments, this is inherited from Debian where different init systems are supported. Not only that, but you can change your init system without reinstalling, and expect your configuration to survive — including which services are enabled or disabled. That’s the reason why the systemd and sysvinit setups are kept in sync. (Note that at least some of the features being used are provided by upstream systemd and aren’t Debian- or Ubuntu-specific.)

  • thanks, do you know if Debian have documentation about this? I'm guessing in order to achieve this ability to swap init systems, all the packages on the system (which have init scripts/configs registered) must need to be syncronised in this way - that must add alot more work for the package maintainers? – the_velour_fog Apr 4 '17 at 6:19
  • It doesn’t add much work, it’s handled by dh_systemd. The runtime behaviour is mostly provided by upstream. Debian Policy describes the update-rc.d/invoke-rc.d commands, which cope with all the available init systems in Debian. – Stephen Kitt Apr 4 '17 at 7:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.