Bug#985787: init-system-helpers: deb-systemd-helper - incoherent enable after WantedBy change

Marcin Szewczyk debian.bugreport at wodny.org
Tue Mar 23 14:32:53 GMT 2021

Package: init-system-helpers
Version: 1.56+nmu1
Severity: normal


I use debhelper to install and enable systemd user units. I noticed that
after changing the `WantedBy` value from default.target to
graphical.target the new symlink was not created.

I attach a GraphViz .dot graph which visualizes a troubling number of
states caused by `dpkg -i`. Even more troubling are the facts that:
- reinstallation of the same version changes the state,
- purging the package (`dpkg -P`) can leave dead symlinks.

What do you think about that?

About the graph:
- version 4.0 has `WantedBy=default.target`,
- version 4.3 has `WantedBy=graphical.target`,
- `link` is the state of symlinks in /etc/systemd/user/*.target.wants,
- `dsh` is the state of the .dsh-also file.

At the same time systemctl:
- `enable` would add the second link leaving the first one,
- `disable` would remove both symlinks even if one of them is no longer
  referenced by the unit file,
- `reenable` would leave only the symlink pointing to the currently
  selected target.

I have some additional questions:

Why is `no_link_installed(…)` taken into account when setting
$create_links in `enable(…)`[1]?

[1]: https://salsa.debian.org/debian/init-system-helpers/-/blob/master/script/deb-systemd-helper

Is there a reason not to just use `reenable` in postinst scripts?

An old discussion in #717603 suggests[2] that it was intended to take
changes in the [Install] section into account.

[2]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=717603

-- System Information:
Debian Release: 10.8
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

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

Versions of packages init-system-helpers depends on:
ii  perl-base  5.28.1-6+deb10u1

init-system-helpers recommends no packages.

init-system-helpers suggests no packages.

Versions of packages init-system-helpers is related to:
pn  insserv  <none>

-- no debconf information

Marcin Szewczyk
-------------- next part --------------
digraph g {
    none [ label = "link: (removed)\ndsh: (removed)" ]
    none -> def_def [ label = "-i 4.0\nwas-enabled" ]
    def_def [ label = "link: default\ndsh: default" ]
    def_def -> none [ label = "-P" ]
    def_def -> def_def [ label = "-i 4.0\nwas-enabled" ]
    def_def -> def_def_graph [ label = "-i 4.3\nwas-enabled" ]
    def_def_graph [ label = "link: default\ndsh: default, graphical" ]
    def_def_graph -> def_graph [ label = "-i 4.3\nwas-disabled" ]
    def_def_graph -> none [ label = "-P" ]
    def_graph [ label = "link: default\ndsh: graphical" ]
    def_graph -> def_graph [ label = "-i 4.3\nwas-disabled" ]
    def_graph -> def_dead [ label = "-P" ]
    def_dead [ label = "link: default (dead)\ndsh: (removed)" ]
    none -> graph_graph [ label = "-i 4.3\nwas-enabled" ]
    graph_graph [ label = "link: graph\ndsh: graph" ]
    graph_graph -> none [ label = "-P"]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dsh.svg
Type: image/svg+xml
Size: 9329 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20210323/4f4ecab0/attachment.svg>

More information about the Pkg-systemd-maintainers mailing list