Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.bugs.dist > #1261118
| From | MichaIng <micha@dietpi.com> |
|---|---|
| Newsgroups | linux.debian.bugs.dist |
| Subject | Bug#1091519: deb-systemd-helper: Fails when non-existing unit is listed in Also= line |
| Date | 2025-09-12 16:40 +0200 |
| Message-ID | <Lud6p-eMGR-1@gated-at.bofh.it> (permalink) |
| References | <JYqQx-3j0X-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
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
Back to linux.debian.bugs.dist | Previous | Next | Find similar | Unroll thread
Bug#1091519: deb-systemd-helper: Fails when non-existing unit is listed in Also= line MichaIng <micha@dietpi.com> - 2025-09-12 16:40 +0200
csiph-web