Packaging issue: .service files are no conffiles (due to /lib) while init scripts are conffiles and hence remain longer on the system upon package removal without purging
Michael Biebl
biebl at debian.org
Wed Jun 10 11:50:02 BST 2015
Am 10.06.2015 um 12:22 schrieb Axel Beckert:
> Hi,
>
> there seem to be a general issue with how .service files should be
> packaged (in /lib/systemd/system/ and not in /etc/systemd/system/):
>
> If a package is shipping a init script as well as a service file (as
> currently strongly recommend), it's usually the case that the init
> script is left on the system upon package removal without also purging
> its conffiles.
>
> While this is no issue at all with sysvinit, it seems to cause issues
> with systemd's sysvinit compatibility mode because the init
> script is still there but the overriding .service file is already
> removed. :-/
>
> Example case where this causes ordering cycle issues:
> https://bugs.launchpad.net/ubuntu/+source/screen/+bug/1462692
>
> The bug report above contains two suggested solutions:
>
> 1) Ship the .service file in /etc/systemd/system/ instead of
> /lib/systemd/system/ so that it's removed at the same time as the
> init script and override the according lintian warning.
>
> Example implementation:
> https://anonscm.debian.org/cgit/collab-maint/screen.git/commit/?id=f7d8704dc
>
> Advantage: dead-simple and fail-safe
>
> Disadvantage: Overriding a lintian warning.
>
> Additionally, in this specific case (a symlink to /dev/null to make
> systemd ignore the init script), a file which better should not be
> changed by the local admin would be put under /etc/. Then again,
> there's not much which the local admin could change, so it
> shouldn't really hurt.
Please don't do this. /etc/systemd is strictly admin territory.
> 2) Don't ship the /lib/systemd/system/screen-cleanup.service link
> (possibly a less general solution) in the .deb, but create it in
> postinst and remove it in the postrm on purge.
>
> Advantage: No lintian warning, no file under /etc/.
>
> Disadvantage: Error-prone due to more complexity in the
> maintainer scripts -- which I'd like to avoid.
This one doesn't look ok either.
>
> Is there any simpler or maybe even already supported way to solve or
> avoid such issues? I'd expect that screen is not the only package
> where users run into such issues.
>
The underlying problem, as you noticed, is that sysv init scripts are
treated as conffiles. Imho this is arguably a bug, but it's too late to
fix that.
To address this, we added code do dh_systemd, to mask the service on
remove. So even if the package is only removed, but not purged, be
remaining sysv init script will not be considered by systemd.
This mask is removed on purge.
If you use dh_systemd, you'll get that integration for free, and I'd
suggest you use that, otherwise, you'll have to do the mask/unmask steps
manually.
--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20150610/c27242a8/attachment-0002.sig>
More information about the Pkg-systemd-maintainers
mailing list