[debhelper-devel] Bug#885998: debhelper: in compat 11, systemd-tmpfiles is no longer run before invoke-rc.d

Simon McVittie smcv at debian.org
Mon Jan 1 12:06:52 UTC 2018


Package: debhelper
Version: 11
Severity: normal

I tried switching src:dbus to debhelper compat 11, resulting in this
change to dbus' postinst:

│ │ │ │  # Automatically added by dh_installinit/11
│ │ │ │  if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
│ │ │ │ -	# In case this system is running systemd, we need to ensure that all
│ │ │ │ -	# necessary tmpfiles (if any) are created before starting.
│ │ │ │ -	if [ -d /run/systemd/system ] ; then
│ │ │ │ -		systemd-tmpfiles --create /usr/lib/tmpfiles.d/dbus.conf >/dev/null || true
│ │ │ │ +	if [ -x "/etc/init.d/dbus" ]; then
│ │ │ │ +		update-rc.d dbus defaults >/dev/null
│ │ │ │ +		invoke-rc.d dbus start || exit $?
│ │ │ │  	fi
│ │ │ │  fi
│ │ │ │  # End automatically added section
│ │ │ │ -# Automatically added by dh_installinit/11
│ │ │ │ +# Automatically added by dh_installsystemd/11
│ │ │ │  if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
│ │ │ │ -	if [ -x "/etc/init.d/dbus" ]; then
│ │ │ │ -		update-rc.d dbus defaults >/dev/null
│ │ │ │ -		invoke-rc.d dbus start || exit $?
│ │ │ │ +	# In case this system is running systemd, we need to ensure that all
│ │ │ │ +	# necessary tmpfiles (if any) are created before starting.
│ │ │ │ +	if [ -d /run/systemd/system ] ; then
│ │ │ │ +		systemd-tmpfiles --create /usr/lib/tmpfiles.d/dbus.conf >/dev/null || true
│ │ │ │  	fi

Previously, the systemd unit could rely on the tmpfiles snippet
/usr/lib/tmpfiles.d/dbus.conf being run before the systemd unit
runs; but now invoke-rc.d is going to start the dbus-daemon before
/usr/lib/tmpfiles.d/dbus.conf has taken effect. For dbus, this is
currently harmless, but a feature that I'm working on upstream is going
to rely on the tmpfiles snippet to have run, and in general systemd units
(unlike sysvinit scripts) are allowed to assume that tmpfiles snippets
have been processed.

Perhaps the postinst should look more like this, with the
dh_installinit-generated block only responsible for non-systemd init
systems, and dh_installsystemd taking full responsibility for systemd?

	# Automatically added by dh_installinit/11
	if [ etc. ]; then
		if [ -x "/etc/init.d/dbus" ] && ! [ -d /run/systemd/system ]; then
			update-rc.d ...
			invoke-rc.d ...
		fi
	fi

	# Automatically added by dh_installsystemd/11
	if [ etc. ]; then
		if [ -d /run/systemd/system ]; then
			systemd-tmpfiles --create ...
			update-rc.d ...
			invoke-rc.d ...
		fi
	fi

Regards,
    smcv

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.14.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages debhelper depends on:
ii  autotools-dev            20171216.1
ii  binutils                 2.29.1-12
ii  dh-autoreconf            15
ii  dh-strip-nondeterminism  0.040-1
ii  dpkg                     1.19.0.4
ii  dpkg-dev                 1.19.0.4
ii  file                     1:5.32-1
ii  libdpkg-perl             1.19.0.4
ii  man-db                   2.7.6.1-4
ii  perl                     5.26.1-3
ii  po-debconf               1.0.20

debhelper recommends no packages.

Versions of packages debhelper suggests:
pn  dh-make  <none>
pn  dwz      <none>

-- no debconf information




More information about the debhelper-devel mailing list