PRE
root@debian-stretch:~# systemctl status virtlogd.service virtlogd.socket virtlogd-admin.socket virtlockd.service virtlockd.socket virtlockd-admin.socket --no-pager --lines 2
● virtlogd.service - Virtual machine log manager
Loaded: loaded (/lib/systemd/system/virtlogd.service; indirect; vendor preset: enabled)
Active: active (running) since Thu 2018-08-09 09:28:33 UTC; 7s ago
Docs: man:virtlogd(8)
http://libvirt.org
Main PID: 7080 (virtlogd)
Tasks: 2 (limit: 4915)
CGroup: /system.slice/virtlogd.service
└─7080 /usr/sbin/virtlogd
Aug 09 09:28:35 debian-stretch systemd[1]: virtlogd.service: Failed to reset devices.list: Operation not permitted
Aug 09 09:28:37 debian-stretch systemd[1]: virtlogd.service: Failed to reset devices.list: Operation not permitted
● virtlogd.socket - Virtual machine log manager socket
Loaded: loaded (/lib/systemd/system/virtlogd.socket; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-08-09 09:28:33 UTC; 7s ago
Listen: /var/run/libvirt/virtlogd-sock (Stream)
Aug 09 09:28:33 debian-stretch systemd[1]: Listening on Virtual machine log manager socket.
Unit virtlogd-admin.socket could not be found.
● virtlockd.service - Virtual machine lock manager
Loaded: loaded (/lib/systemd/system/virtlockd.service; indirect; vendor preset: enabled)
Active: inactive (dead)
Docs: man:virtlockd(8)
http://libvirt.org
● virtlockd.socket - Virtual machine lock manager socket
Loaded: loaded (/lib/systemd/system/virtlockd.socket; enabled; vendor preset: enabled)
Active: active (listening) since Thu 2018-08-09 09:28:34 UTC; 7s ago
Listen: /var/run/libvirt/virtlockd-sock (Stream)
Aug 09 09:28:34 debian-stretch systemd[1]: Listening on Virtual machine lock manager socket.
Unit virtlockd-admin.socket could not be found.
Upgrade just libvirt and dependencies - stretch to testing.
# apt install libvirt-daemon-system
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libboost-iostreams1.62.0 libboost-random1.62.0 libboost-system1.62.0 libboost-thread1.62.0 librados2 librbd1
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
ca-certificates libcap-ng0 libcom-err2 libcomerr2 libcurl3-gnutls libidn2-0 libnghttp2-14 libpsl5 librtmp1 libunistring2 libvirt-clients
libvirt-daemon libvirt0 openssl publicsuffix
Suggested packages:
libvirt-daemon-driver-storage-gluster libvirt-daemon-driver-storage-rbd libvirt-daemon-driver-storage-sheepdog
libvirt-daemon-driver-storage-zfs numad apparmor auditd nfs-common open-iscsi pm-utils radvd systemtap zfsutils
The following NEW packages will be installed:
ca-certificates libcom-err2 libcurl3-gnutls libidn2-0 libnghttp2-14 libpsl5 librtmp1 libunistring2 openssl publicsuffix
The following packages will be upgraded:
libcap-ng0 libcomerr2 libvirt-clients libvirt-daemon libvirt-daemon-system libvirt0
6 upgraded, 10 newly installed, 0 to remove and 248 not upgraded.
Need to get 9437 kB of archives.
After this operation, 5147 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
[...]
Setting up libvirt-daemon-system (4.5.0-1) ...
Installing new version of config file /etc/apparmor.d/abstractions/libvirt-qemu ...
Installing new version of config file /etc/apparmor.d/libvirt/TEMPLATE.lxc ...
Installing new version of config file /etc/apparmor.d/libvirt/TEMPLATE.qemu ...
Installing new version of config file /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper ...
Installing new version of config file /etc/apparmor.d/usr.sbin.libvirtd ...
Installing new version of config file /etc/default/libvirt-guests ...
Installing new version of config file /etc/init.d/libvirt-guests ...
Installing new version of config file /etc/libvirt/libvirtd.conf ...
Installing new version of config file /etc/libvirt/libxl.conf ...
Installing new version of config file /etc/libvirt/qemu.conf ...
Installing new version of config file /etc/libvirt/virtlockd.conf ...
Installing new version of config file /etc/libvirt/virtlogd.conf ...
Installing new version of config file /etc/logrotate.d/libvirtd.libxl ...
Installing new version of config file /etc/logrotate.d/libvirtd.lxc ...
Installing new version of config file /etc/logrotate.d/libvirtd.qemu ...
Installing new version of config file /etc/logrotate.d/libvirtd.uml ...
Installing new version of config file /etc/sasl2/libvirt.conf ...
Created symlink /etc/systemd/system/sockets.target.wants/virtlockd-admin.socket → /lib/systemd/system/virtlockd-admin.socket.
Created symlink /etc/systemd/system/sockets.target.wants/virtlogd-admin.socket → /lib/systemd/system/virtlogd-admin.socket.
virtlockd.service is a disabled or a static unit, not starting it.
Job for virtlogd-admin.socket failed.
See "systemctl status virtlogd-admin.socket" and "journalctl -xe" for details.
virtlogd-admin.socket couldn't start.
A dependency job for virtlogd.service failed. See 'journalctl -xe' for details.
invoke-rc.d: initscript virtlogd, action "start" failed.
● virtlogd.service - Virtual machine log manager
Loaded: loaded (/lib/systemd/system/virtlogd.service; indirect; vendor preset: enabled)
Active: active (running) since Thu 2018-08-09 09:35:36 UTC; 50s ago
Docs: man:virtlogd(8)
https://libvirt.org
Main PID: 6774 (virtlogd)
CGroup: /system.slice/virtlogd.service
└─6774 /usr/sbin/virtlogd
Aug 09 09:35:38 debian-stretch systemd[1]: virtlogd.service: Failed to reset devices.list: Operation not permitted
Aug 09 09:35:41 debian-stretch systemd[1]: virtlogd.service: Failed to reset devices.list: Operation not permitted
Aug 09 09:36:21 debian-stretch systemd[1]: virtlogd.service: Failed to reset devices.list: Operation not permitted
Aug 09 09:36:25 debian-stretch systemd[1]: virtlogd.service: Failed to reset devices.list: Operation not permitted
Aug 09 09:36:25 debian-stretch systemd[1]: Reloading Virtual machine log manager.
Aug 09 09:36:25 debian-stretch systemd[1]: Reloaded Virtual machine log manager.
Aug 09 09:36:26 debian-stretch systemd[1]: virtlogd.service: Failed to reset devices.list: Operation not permitted
Aug 09 09:36:26 debian-stretch systemd[1]: virtlogd.service: Failed to reset devices.list: Operation not permitted
Aug 09 09:36:27 debian-stretch systemd[1]: Dependency failed for Virtual machine log manager.
Aug 09 09:36:27 debian-stretch systemd[1]: virtlogd.service: Job virtlogd.service/start failed with result 'dependency'.
dpkg: error processing package libvirt-daemon-system (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for ca-certificates (20170717) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Processing triggers for systemd (232-25+deb9u4) ...
Errors were encountered while processing:
libvirt-daemon-system
E: Sub-process /usr/bin/dpkg returned an error code (1)
Status after install:
# systemctl status virtlogd.service virtlogd.socket virtlogd-admin.socket virtlockd.service virtlockd.socket virtlockd-admin.socket --no-pager --lines 2
● virtlogd.service - Virtual machine log manager
Loaded: loaded (/lib/systemd/system/virtlogd.service; indirect; vendor preset: enabled)
Active: active (running) since Thu 2018-08-09 09:35:36 UTC; 1min 11s ago
Docs: man:virtlogd(8)
https://libvirt.org
Main PID: 6774 (virtlogd)
Tasks: 2 (limit: 4915)
CGroup: /system.slice/virtlogd.service
└─6774 /usr/sbin/virtlogd
Aug 09 09:36:27 debian-stretch systemd[1]: virtlogd.service: Job virtlogd.service/start failed with result 'dependency'.
Aug 09 09:36:31 debian-stretch systemd[1]: virtlogd.service: Failed to reset devices.list: Operation not permitted
● virtlogd.socket - Virtual machine log manager socket
Loaded: loaded (/lib/systemd/system/virtlogd.socket; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-08-09 09:35:36 UTC; 1min 11s ago
Listen: /var/run/libvirt/virtlogd-sock (Stream)
Aug 09 09:35:36 debian-stretch systemd[1]: Listening on Virtual machine log manager socket.
● virtlogd-admin.socket - Virtual machine log manager socket
Loaded: loaded (/lib/systemd/system/virtlogd-admin.socket; enabled; vendor preset: enabled)
Active: inactive (dead)
Listen: /var/run/libvirt/virtlogd-admin-sock (Stream)
Aug 09 09:36:27 debian-stretch systemd[1]: virtlogd-admin.socket: Socket service virtlogd.service already active, refusing.
Aug 09 09:36:27 debian-stretch systemd[1]: Failed to listen on Virtual machine log manager socket.
● virtlockd.service - Virtual machine lock manager
Loaded: loaded (/lib/systemd/system/virtlockd.service; indirect; vendor preset: enabled)
Active: inactive (dead)
Docs: man:virtlockd(8)
https://libvirt.org
● virtlockd.socket - Virtual machine lock manager socket
Loaded: loaded (/lib/systemd/system/virtlockd.socket; enabled; vendor preset: enabled)
Active: active (listening) since Thu 2018-08-09 09:36:26 UTC; 21s ago
Listen: /var/run/libvirt/virtlockd-sock (Stream)
Aug 09 09:36:26 debian-stretch systemd[1]: Stopping Virtual machine lock manager socket.
Aug 09 09:36:26 debian-stretch systemd[1]: Listening on Virtual machine lock manager socket.
● virtlockd-admin.socket - Virtual machine lock manager admin socket
Loaded: loaded (/lib/systemd/system/virtlockd-admin.socket; enabled; vendor preset: enabled)
Active: active (listening) since Thu 2018-08-09 09:36:26 UTC; 21s ago
Listen: /var/run/libvirt/virtlockd-admin-sock (Stream)
Aug 09 09:36:26 debian-stretch systemd[1]: Listening on Virtual machine lock manager admin socket.
This is confusing enough - re-summarize the approaches I had so far.
Remember:
- when there is a sysV script it will call invoke.rc
- without sysV script it will call deb-systemd-invoke
Original Issue:
- invoke.rc on virtlogd
- this will realize the new dependency to virtlogd-admin.socket
- virtlogd-admin.socket can't be started because
virtlogd-admin.socket: Socket service virtlogd.service already active, refusing.
- virtlogd.service is running fine, but the start returns RC!=0
- that makes the upgrade fail
Fix I:
- drop both sysV scripts (virtlogd/libvirtd)
- virtlogd will be started via deb-systemd-invoke
This ignores errors in the postinst and is fine on upgrade
- but libvirtd being taken over by deb-systemd-invoke is bad
- the dh_systemd_start checks the service file and adds dependencies to the line
deb-systemd-invoke restart 'libvirtd.service' 'virtlockd.socket' 'virtlogd.socket'
- it knows that to restart a socket the service has to be stopped and started
- so virtlogd is restarted ignoring the --no-restart-on-upgrade of the actual virtlogd
service
Fix II:
- drop only virtlogd sysV script
- virtlogd will be started via deb-systemd-invoke
This ignores errors in the postinst and is fine on upgrade
- libvirtd will continue to be started by invoke.rc which will restart "just" libvirtd
(from dh_installinit)
- but dh_systemd_start will have added a restart section
deb-systemd-invoke $_dh_action 'virtlockd.socket' 'virtlogd.socket' >/dev/null || true
- this will still restart the virtlogd service which has originally
dh_installinit -p libvirt-daemon-system --name=virtlogd --no-restart-on-upgrade
- We have two dh-systemd_start calls in d/rules, assuming retain order
dh_systemd_start -p libvirt-daemon-system --restart-after-upgrade libvirtd.service
is the one which makes it generate the restart on the sockets.
It seems to realize that libvirtd will be started by invoke.rc, so it leaves that out, but
will trigger the two dependencies.
Fix III:
- drop virtlogd sysV script and change the dh_systemds_start order
- hope is that the dh_systemd_start of libvirtd considers the .socket
files already handled and would no more add them with restart due to dependencies.
- It changed the order in the generated maintainer script
- But the section triggered by libvirtd.service still adds the sockets to the restart action
deb-systemd-invoke $_dh_action 'virtlockd.socket' 'virtlogd.socket' >/dev/null || true
- Please do mind, as in other cases here libvirtd itself is not here
as it is taken over by the sysV start via invoke.rc
Fix IV:
- a try to convert to compat 11 and onyl dh_installsystemd but failed
at too many compat-11 implications
Fix V:
- drop virtlogd sysV script (to fix the original issue) and drop the dh_systemd__start call to
libvirtd (to avoid the secondary issue)
- Intention: libvirtd (re)start is taken care of by dh_installinit anyway, avoid the bad restarts
on virtlogd with this tweak
- with that it seems to work, but it might have other implications that I missed
- the new virtlogd-admin.socket is down (as it would need to restart the service)
- service itself is up and still has the old PID so all is good
- installation works, no more breaking the upgrade.
I'm not so sure if "Fix V" has other bad implications that I miss.
But currently that seems to work as needed - so feel free to consider [1] which is the code for it.
I think I'd want/need a "dh_systemd_start --no-dependent-services/sockets" option to intentionally have it generate "just" for libvirt.service and not the sockets it depends on.
Am 10.08.2018 um 13:32 schrieb Christian Ehrhardt:
> I think I'd want/need a "dh_systemd_start --no-dependent-services/sockets"
> option to intentionally have it generate "just" for libvirt.service and not
> the sockets it depends on.
> As mentioned, for all of the complexity pulling in the systemd people might
> help as well.
> So I'm eager to see what they will reply here as well.
I guess the complication arises from the fact that
dh_installinit/invoke-rc.d directly handles systemd service files if the
SysV init script and service file name match.
dh_installsystemd only handles those unit files for which no
corresponding SysV init script exists.
I think the solutions for this could be, to let dh_installsystemd handle
all systemd unit files.
dh_installinit/invoke-rc.d on the other hand would be updated to only
handle SysV init scripts.
In the long run I guess this will be less confusing at is clearer which
tool is responsible for which task and it makes it easier to override
the behaviour in debian/rules.
Felipe has been doing some initial work for enable that kind of
behaviour at
https://salsa.debian.org/debian/init-system-helpers/merge_requests/4
virtlogd.service - Virtual machine log manager
Loaded: loaded (/lib/systemd/system/virtlogd.service; indirect; vendor preset: enabled)
Active: active (running) since Thu 2018-08-09 05:26:07 UTC; 3h 45min ago
Docs: man:virtlogd(8)
https://libvirt.org
Main PID: 4059 (virtlogd)
Tasks: 2 (limit: 4915)
CGroup: /system.slice/virtlogd.service
└─4059 /usr/sbin/virtlogd
Aug 09 09:10:37 c2 systemd[1]: Dependency failed for Virtual machine log manager.
Aug 09 09:10:37 c2 systemd[1]: virtlogd.service: Job virtlogd.service/start failed with result 'dependency'.
--
Saludos,
Felipe Sateler
I'd still need to drop virtlogd sysV script as the "invoke.rc virtlogd" will complain about missing dependencies (the new .socket for it can't be started since the service is already running).The dh_systemd_start generated code triggers "start" and ignores the retval, the dh_installinit code through invoke.rc calls start but fails since systemd replied "I'm running but there are dependency issues".Because virtlogd.service has Requires virtlogd.socket and virtlogd-admin.socket.
Am 10.08.2018 um 15:54 schrieb Felipe Sateler:
> I'm still not sure why we parse Also= for starting. Michael, do you
> remember the rationale?
I think this is simply a mistake and should be corrected.
Parsing Also= for dh_systemd_enable was done, so the tools behave
similar to how "systemctl enable foo" would behave.
I can't come up (or remember) a good idea why Also= would make sense for
the start case.