I think false conclusions are drawn here:Also= lines for non-existing units are not a problem, but skipped silently. The problem here is, there multiple units of libvirt packages have an Also= loop:
libvirtd-admin.socket: ``` Also=libvirtd.socket Also=libvirtd-ro.socket ``` libvirtd-ro.socket: ``` Also=libvirtd.socket Also=libvirtd-admin.socket ``` libvirtd.socket: ``` Also=libvirtd-ro.socket Also=libvirtd-admin.socket ```libvirt-daemon.postrm or on distro upgrades the previous libvirt-daemon-system.postrm call "deb-systemd-helper purge" for each of those, and perl even warns about the resulting recursion:
```recursion on subroutine "main::remove_links" at /usr/bin/deb-systemd-helper line 488, <$fh> line 14.
```
The function contains this code block:
```
sub update_state {
...
# Read $service_path, recurse for all Also= units.
# This might not work when $service_path was already deleted,
# i.e. after apt-get remove. In this case we just return
# silently in order to not confuse the user about whether
# disabling actually worked or not — the case is handled by
# dh_installsystemd generating an appropriate disable
# command by parsing the service file at debhelper-time.
open(my $fh, '<', "$dpkg_root$service_path") or return;
while (my $line = <$fh>) {
chomp($line);
my $service_link;
if ($line =~ /^\s*Also=(.+)$/i) {
remove_links(find_unit($1));
}
}
close($fh);
```
So using deb-systemd-helper on libvirtd.socket repeats the function on
libvirtd-ro.socket which repeats it on libvirtd.socket again and so on
and so forth.
As can be seen and as the comment explains, missing units are gracefully handled, and they would even break the endless loop in this case.
Generally, for all such kind of dependencies and ordering, there must never be loops in systemd units, but they must have a clear single-direction parent/child or before/after structure. Choose one of those units as the primary one which is enabled on install and disabled on uninstall, and add Also= lines only to this one, but remove them from the other two. That should fix the hanging issue.
Best regards, Micha
OpenPGP_0x0442B9ADE65643FE.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature

