Bug#869354: systemd: Overwrites local config without warning
Michael Biebl
biebl at debian.org
Sun Dec 17 21:58:01 GMT 2017
On Sat, 22 Jul 2017 16:39:26 +0100 Nick <debianbug at acrasis.net> wrote:
> The upgrade today appears to have overwritten the target of the symlink
> /etc/systemd/system/getty.target.wants/getty at tty1.service
> from my local target under /etc (which does autologin)
> to the package-provided file /lib/systemd/system/getty at .service (which
> doesn't).
The code responsible for that is systemd.preinst:
>
> # When the [Install] section of an enabled unit changes `systemctl enable` has
> # to be re-run in postinst. As systemctl is-enabled will use the new unit files
> # in postinst we must run it before unpacking it and remember the results.
> save_is_enabled() {
> if [ "$(systemctl is-enabled $1 2>/dev/null)" = "enabled" ] ; then
> echo $1 >>/run/systemd/was-enabled
> fi
> }
>
> if [ "$1" = upgrade ]; then
> [ -d /run/systemd ] || mkdir /run/systemd
> rm -f /run/systemd/was-enabled
>
> save_is_enabled console-getty.service
> save_is_enabled debug-shell.service
> save_is_enabled getty at tty1.service
> save_is_enabled remote-fs.target
> save_is_enabled rescue.target
> save_is_enabled tmp.mount
> save_is_enabled systemd-networkd.service
> save_is_enabled systemd-networkd-wait-online.service
> save_is_enabled systemd-resolved.service
> save_is_enabled systemd-timesyncd.service
> fi
systemd.postinst:
> # Re-run systemctl enable for any service that was enabled when preinst was run.
> if [ -e /run/systemd/was-enabled ]; then
> while read UNIT ; do
> # 220-6 stopped shipping tmp.mount, transition it on machines which had
> # it enabled
> if [ "$UNIT" = tmp.mount ] && dpkg --compare-versions "$2" lt-nl "220-6~"; then
> if [ ! -e /etc/systemd/system/tmp.mount ]; then
> echo "moving enabled tmp.mount to /etc/systemd/system/..."
> cp /usr/share/systemd/tmp.mount /etc/systemd/system/tmp.mount
> # clean up the symlink, to have it re-created below
> systemctl disable $UNIT
> fi
> fi
> systemctl enable $UNIT || true
> done </run/systemd/was-enabled || true
> fi
In all these years, we didn't have a service file where the [Install]
section changed. So this code does more harm then good apparently. I'm
thus inclined to just drop it.
Thoughts/comments?
Michael
--
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: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-systemd-maintainers/attachments/20171217/c3560016/attachment.sig>
More information about the Pkg-systemd-maintainers
mailing list