Differences between revisions 7 and 8
Revision 7 as of 2013-04-23 06:00:53
Size: 2821
Editor: ?MichaelStapelberg
Comment:
Revision 8 as of 2014-02-25 16:09:49
Size: 36
Editor: DavidFarning
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
We want to make systemd, sysvinit and upstart work well in Debian. In the current state (as of 2013-04-21), when you install Debian and decide to switch to systemd, your system may not boot correctly because some systemd units are not enabled, whereas the corresponding sysvinit scripts are enabled.

With systemd, service files have to be enabled. This effectively means creating a symlink:

{{{
# systemctl enable ntp.service
ln -s '/lib/systemd/system/ntp.service' '/etc/systemd/system/multi-user.target.wants/ntp.service'
}}}

Currently, when you install e.g. the `ntp` package, the `postinst` maintscript runs `update-rc.d ntp defaults`, which will only create the sysvinit symlinks. We therefore need to modify Debian so that the systemd symlinks are also enabled.

The obvious naive idea is to modify `update-rc.d` so that it creates systemd symlinks as well. However, this does not always work.

The problem here is, that we do not always have a strict one-to-one relationship (i.e. one SysV init script corresponds to exactly one systemd service file with the corresponding name). Systemd typically is more fine-grained, i.e. there is one .service per daemon, which allows for better service monitoring, contrary to SysV, where one init script can start several different daemons.

Also, systemd provides mechanisms for D-Bus and socket activated services, which have no SysV counterpart. Services which are activated via D-Bus system activation typically do not have SysV init script. So it's unclear how `update-rc.d` should handle such a case, especially since `dh_installinit` will not generate any maintainer scripts code in that case.


Here are some examples:

== samba ==

For systemd, it makes more sense to have smbd.service and nmbd.service instead of a single samba.service. `update-rc.d` cannot possibly be modified to contain a mapping from samba to smbd/nmbd for every such service.

Here is the dh_installinit snippet that currently lives in samba’s postinst maintscript:

{{{
# Automatically added by dh_installinit
if [ -x "/etc/init.d/samba" ]; then
        update-rc.d samba defaults 20 19 >/dev/null
        invoke-rc.d samba start || exit $?
fi
# End automatically added section
}}}

As soon as the samba package gains nmbd.service and smbd.service, this should read:

{{{
# Automatically added by dh_installinit
if [ -x "/etc/init.d/samba" ]; then
        update-rc.d samba defaults 20 19 >/dev/null
        invoke-rc.d samba start || exit $?
fi

# Enable the service on initial installation.
if [ -z "$2" ]; then
        systemctl-enable enable smbd.service
        systemctl-enable enable nmbd.service
fi
# End automatically added section
}}}

Note that systemctl-enable does not depend on systemd (neither running nor installed).
#redirect systemd/EnableDiscussion