RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2032365 - libvirt-daemon scriptlet fails to disable units and close sockets during package removal
Summary: libvirt-daemon scriptlet fails to disable units and close sockets during pack...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.0
Hardware: All
OS: Unspecified
unspecified
low
Target Milestone: rc
: ---
Assignee: Daniel Berrangé
QA Contact: yafu
URL:
Whiteboard:
: 2041626 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-12-14 12:07 UTC by smitterl
Modified: 2022-05-17 13:06 UTC (History)
8 users (show)

Fixed In Version: libvirt-8.0.0-0rc1.1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-17 12:45:52 UTC
Type: Bug
Target Upstream Version: 8.0.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github autotest tp-libvirt pull 4136 0 None Merged Add test for checking daemons are removed after removing libvirtd pkgs 2022-05-10 06:40:05 UTC
Red Hat Issue Tracker RHELPLAN-105739 0 None None None 2021-12-14 12:13:54 UTC
Red Hat Product Errata RHBA-2022:2390 0 None None None 2022-05-17 12:46:20 UTC

Description smitterl 2021-12-14 12:07:53 UTC
Description of problem:
When removing all libvirt\* packages, log and lock sockets are not cleaned up.

Version-Release number of selected component (if applicable):
libvirt-7.10.0-1.el9.s390x

How reproducible:
100%

Steps to Reproduce:
1. yum install -y libvirt qemu-kvm
2. reboot
3. start and destroy a vm
4.
 a. yum remove -y libvirt\*
 b. systemctl list-units --type=socket |grep virt

Actual results:
Ad a.
-----
...
  Running scriptlet: libvirt-daemon-7.10.0-1.el9.s390x                                                                  19/20 
Removed /etc/systemd/system/sockets.target.wants/virtproxyd.socket.
Failed to disable unit: Unit file virtlogd-ro.socket does not exist.
Failed to disable unit: Unit file virtlockdd.service does not exist.

  Erasing          : libvirt-daemon-7.10.0-1.el9.s390x                                                                  19/20 
...

Ad b.
-----
● virtlockd-admin.socket          not-found active listening virtlockd-admin.socket
● virtlockd.socket                not-found active listening virtlockd.socket
● virtlogd-admin.socket           not-found active running   virtlogd-admin.socket
● virtlogd.socket                 not-found active running   virtlogd.socket

Expected results:
Sockets are closed/removed.

Additional notes:
1. After re-installation a vm can be started if all sockets are started for the primary and secondary drivers (qemu network nodedev nwfilter secret storage interface).
2. During package update, the "Failed to disable unit" doesn't reproduce. A vm can be started without issues.

Comment 1 Daniel Berrangé 2021-12-14 16:26:22 UTC
(In reply to smitterl from comment #0)
>   Running scriptlet: libvirt-daemon-7.10.0-1.el9.s390x                      
> 19/20 
> Removed /etc/systemd/system/sockets.target.wants/virtproxyd.socket.
> Failed to disable unit: Unit file virtlogd-ro.socket does not exist.
> Failed to disable unit: Unit file virtlockdd.service does not exist.

Opps, there's a typo here  'virtlockdd' should 'virtlockd'.

https://listman.redhat.com/archives/libvir-list/2021-December/msg00646.html

Also, there's no -ro.socket for virtlogd / virtlockd so we need
to stop refering to that

https://listman.redhat.com/archives/libvir-list/2021-December/msg00651.html

Comment 2 Daniel Berrangé 2021-12-16 17:55:01 UTC
I've confirmed that those two mistakes in the %preun script are what resulted in the systemd socket units being left active after uninstall. So pulling in the two upstream fixes should address this.

Comment 5 yafu 2021-12-23 07:50:25 UTC
Verified pass with libvirt-8.0.0-1.

Comment 9 Jiri Denemark 2022-01-18 08:26:43 UTC
*** Bug 2041626 has been marked as a duplicate of this bug. ***

Comment 10 yafu 2022-01-20 03:10:14 UTC
Test with libvirt-8.0.0-1.el9.x86_64.

Test steps:
1.Install libvirt pkgs:
#yum -y install libvirt*

2.Start virtqemud:
#systemctl start virtqemud

3.Start a guest:
#virsh start vm1

4.Check virtlogd* status:
# systemctl -a | grep -i virtlogd
  virtlogd.service                                                                                               loaded    active   running   Virtual machine log manager
  virtlogd-admin.socket                                                                                          loaded    active   running   Virtual machine log manager socket
  virtlogd.socket      
                                                                                          loaded    active   running   Virtual machine log manager socket

5.Remove libvirt pkgs:
#yum -y remove libvirt*

6.Check daemons installed by libvirt pkgs:
#systemctl -a | grep -i virt
...
● libvirtd.service                                                                                               not-found inactive dead      libvirtd.service
...
● virtnetworkd.service                                                                                           not-found inactive dead      virtnetworkd.service
...                                                                                              
● virt-guest-shutdown.target                                                                                     not-found inactive dead      virt-guest-shutdown.target
...

7.Install libvirt pkgs again:
#yum -y install libvirt*

8.Start virtqemud service:
#systemctl start virtqemud

9.Start a guest:
#virsh start vm1
Domain 'vm1' started

10.Check virtlogd* service status:
# systemctl -a | grep -i virtlogd
  virtlogd.service                                                                                               loaded    active   running   Virtual machine log manager
  virtlogd-admin.socket                                                                                          loaded    active   running   Virtual machine log manager socket
  virtlogd.socket                                                                                                loaded    active   running   Virtual machine log manager socket


Hi Daniel,
In step4, after removing libvirt pkgs, still show some service info installed by libvirt pkgs. Would you help to check it please?
Thanks.

Comment 11 Daniel Berrangé 2022-01-20 09:05:40 UTC
(In reply to yafu from comment #10)
> Test with libvirt-8.0.0-1.el9.x86_64.
> 
> Test steps:
> 1.Install libvirt pkgs:
> #yum -y install libvirt*
> 
> 2.Start virtqemud:
> #systemctl start virtqemud
> 
> 3.Start a guest:
> #virsh start vm1
> 
> 4.Check virtlogd* status:
> # systemctl -a | grep -i virtlogd
>   virtlogd.service                                                          
> loaded    active   running   Virtual machine log manager
>   virtlogd-admin.socket                                                     
> loaded    active   running   Virtual machine log manager socket
>   virtlogd.socket      
>                                                                             
> loaded    active   running   Virtual machine log manager socket
> 
> 5.Remove libvirt pkgs:
> #yum -y remove libvirt*
> 
> 6.Check daemons installed by libvirt pkgs:
> #systemctl -a | grep -i virt
> ...
> ● libvirtd.service                                                          
> not-found inactive dead      libvirtd.service
> ...
> ● virtnetworkd.service                                                      
> not-found inactive dead      virtnetworkd.service
> ...                                                                         
> 
> ● virt-guest-shutdown.target                                                
> not-found inactive dead      virt-guest-shutdown.target
> ...
> 
> 7.Install libvirt pkgs again:
> #yum -y install libvirt*
> 
> 8.Start virtqemud service:
> #systemctl start virtqemud
> 
> 9.Start a guest:
> #virsh start vm1
> Domain 'vm1' started
> 
> 10.Check virtlogd* service status:
> # systemctl -a | grep -i virtlogd
>   virtlogd.service                                                          
> loaded    active   running   Virtual machine log manager
>   virtlogd-admin.socket                                                     
> loaded    active   running   Virtual machine log manager socket
>   virtlogd.socket                                                           
> loaded    active   running   Virtual machine log manager socket
> 
> 
> Hi Daniel,
> In step4, after removing libvirt pkgs, still show some service info
> installed by libvirt pkgs. Would you help to check it please?
> Thanks.

You started a guest in step (3), but didn't stop it before un-installing libvirt RPMs. It is not a valid scenario to have a guest running while un-installing libvirt. It is possible is is the cause of the behaviour, so could you re-test ensuring any guests and/or virtual networks are stopped before un-installing.

Comment 12 yafu 2022-01-21 08:50:16 UTC
(In reply to Daniel Berrangé from comment #11)
> (In reply to yafu from comment #10)
> > Test with libvirt-8.0.0-1.el9.x86_64.
> > 
> > Test steps:
> > 1.Install libvirt pkgs:
> > #yum -y install libvirt*
> > 
> > 2.Start virtqemud:
> > #systemctl start virtqemud
> > 
> > 3.Start a guest:
> > #virsh start vm1
> > 
> > 4.Check virtlogd* status:
> > # systemctl -a | grep -i virtlogd
> >   virtlogd.service                                                          
> > loaded    active   running   Virtual machine log manager
> >   virtlogd-admin.socket                                                     
> > loaded    active   running   Virtual machine log manager socket
> >   virtlogd.socket      
> >                                                                             
> > loaded    active   running   Virtual machine log manager socket
> > 
> > 5.Remove libvirt pkgs:
> > #yum -y remove libvirt*
> > 
> > 6.Check daemons installed by libvirt pkgs:
> > #systemctl -a | grep -i virt
> > ...
> > ● libvirtd.service                                                          
> > not-found inactive dead      libvirtd.service
> > ...
> > ● virtnetworkd.service                                                      
> > not-found inactive dead      virtnetworkd.service
> > ...                                                                         
> > 
> > ● virt-guest-shutdown.target                                                
> > not-found inactive dead      virt-guest-shutdown.target
> > ...
> > 
> > 7.Install libvirt pkgs again:
> > #yum -y install libvirt*
> > 
> > 8.Start virtqemud service:
> > #systemctl start virtqemud
> > 
> > 9.Start a guest:
> > #virsh start vm1
> > Domain 'vm1' started
> > 
> > 10.Check virtlogd* service status:
> > # systemctl -a | grep -i virtlogd
> >   virtlogd.service                                                          
> > loaded    active   running   Virtual machine log manager
> >   virtlogd-admin.socket                                                     
> > loaded    active   running   Virtual machine log manager socket
> >   virtlogd.socket                                                           
> > loaded    active   running   Virtual machine log manager socket
> > 
> > 
> > Hi Daniel,
> > In step4, after removing libvirt pkgs, still show some service info
> > installed by libvirt pkgs. Would you help to check it please?
> > Thanks.
> 
> You started a guest in step (3), but didn't stop it before un-installing
> libvirt RPMs. It is not a valid scenario to have a guest running while
> un-installing libvirt. It is possible is is the cause of the behaviour, so
> could you re-test ensuring any guests and/or virtual networks are stopped
> before un-installing.

No service left if i removed libvirt pkgs with guests and virtnetworkd service stopped.
Thanks for your clarification.

Comment 13 yafu 2022-01-21 08:51:04 UTC
Move the bug to Verified according to comment 10 - 12.

Comment 15 errata-xmlrpc 2022-05-17 12:45:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: libvirt), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:2390


Note You need to log in before you can comment on or make changes to this bug.