Bug 1093169 - qemu guest-agent using systemd service template in pre/preun/post/postun
qemu guest-agent using systemd service template in pre/preun/post/postun
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: KVM
Current
Other Other
: P5 - None : Normal (vote)
: ---
Assigned To: E-mail List
E-mail List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-05-14 15:49 UTC by Ruediger Oertel
Modified: 2020-11-30 15:01 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ruediger Oertel 2018-05-14 15:49:30 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.

%service_add_pre qemu-ga@.service
%service_del_preun qemu-ga@.service
%service_add_post qemu-ga@.service
%service_del_postun qemu-ga@.service

(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.
Comment 1 Bruce Rogers 2018-05-16 21:04:06 UTC
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 || :
fi

This seems to resolve the issue, as far as I can tell.
Comment 2 Swamp Workflow Management 2018-06-05 14:50:12 UTC
This is an autogenerated message for OBS integration:
This bug (1093169) was mentioned in
https://build.opensuse.org/request/show/614311 15.0 / qemu
Comment 3 Swamp Workflow Management 2018-06-09 13:11:51 UTC
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
Sources used:
openSUSE Leap 15.0 (src):    qemu-2.11.1-lp150.7.3.1, qemu-linux-user-2.11.1-lp150.7.3.1, qemu-testsuite-2.11.1-lp150.7.3.1
Comment 4 Antoine Ginies 2020-11-30 15:01:44 UTC
fixed based on last comment