Bugzilla – Bug 1093169
qemu guest-agent using systemd service template in pre/preun/post/postun
Last modified: 2020-11-30 15:01:44 UTC
a service template (foo@.service) can only be used with a parameter
on the commandline but will not work in the specfile without the parameter.
(1/1) Removing qemu-guest-agent-2.11.1-4.6.x86_64 ........................[done]
Additional rpm output:
Failed to stop qemu-ga@.service: Unit name qemu-ga@.service is missing the instance name.
See system logs and 'systemctl status qemu-ga@.service' for details.
Failed to get load state of qemu-ga@.service: Unit name qemu-ga@.service is neither a valid invocation ID nor unit name.
I've examined what the systemd macros do in the rpm pre/post scripts, as well as other packages which install service templates, and find that at least one (brltty) doesn't use a %preun, while another that does (vpnc) is similar to our package, in that it generates the same error message at rpm uninstall time.
The error message is generated from the %service_del_preun use of:
/usr/bin/systemctl stop qemu-ga@.service.
To me this indicates that this script should either be smarter, or shouldn't be used for service templates.
I find that after the rpm is removed (and /usr/bin/qemu-ga is unlinked), that the qemu-ga process is still running. Obviously this shouldn't be.
I'm choosing to put the following as the script for %preun
if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then
/usr/bin/systemctl stop qemu-ga@virtio\\x2dports-org.qemu.guest_agent.0.service || :
This seems to resolve the issue, as far as I can tell.
This is an autogenerated message for OBS integration:
This bug (1093169) was mentioned in
https://build.opensuse.org/request/show/614311 15.0 / qemu
openSUSE-SU-2018:1628-1: An update that solves one vulnerability and has one errata is now available.
Category: security (important)
Bug References: 1092885,1093169
CVE References: CVE-2018-3639
openSUSE Leap 15.0 (src): qemu-2.11.1-lp184.108.40.206, qemu-linux-user-2.11.1-lp220.127.116.11, qemu-testsuite-2.11.1-lp18.104.22.168
fixed based on last comment