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 2111301 - swtpm.pid still exists after destroying the guest
Summary: swtpm.pid still exists after destroying the guest
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.1
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: Yanqiu Zhang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-07-27 02:38 UTC by yafu
Modified: 2023-05-09 08:09 UTC (History)
5 users (show)

Fixed In Version: libvirt-8.7.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-09 07:26:34 UTC
Type: Bug
Target Upstream Version: 8.7.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-129167 0 None None None 2022-07-27 02:39:50 UTC
Red Hat Product Errata RHBA-2023:2171 0 None None None 2023-05-09 07:27:25 UTC

Description yafu 2022-07-27 02:38:45 UTC
Description of problem:
The pid file of swtpm process still exists after destroying the guest

Version-Release number of selected component (if applicable):
libvirt-8.5.0-2.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Prepare a running guest with with tpm device:
#virsh dumpxml avocado-vt-vm1
...
 <tpm model='tpm-crb'>
      <backend type='emulator' version='2.0'/>
      <alias name='tpm0'/>
    </tpm>
...  

2.Check the pid file of swtpm process:
# ll /run/libvirt/qemu/swtpm/
...
-rw-r--r--. 1 root root 6 Jul 26 04:52 100-avocado-vt-vm1-swtpm.pid


3.Destroy the guest:
#virsh destroy avocado-vt-vm1

4.Check the pid file of swtpm process again, the pid file still exists:
ll /run/libvirt/qemu/swtpm/
...
-rw-r--r--. 1 root root 6 Jul 26 04:52 100-avocado-vt-vm1-swtpm.pid

5.Start and destroy the guest 1000 times, libvirt will left 1000 swtpm.pid files;

Actual results:
swtpm.pid still exists after destroying the guest

Expected results:
swtpm.pid file should be removed after guest destroyed and the swtpm process exit.

Additional info:

Comment 2 Yanqiu Zhang 2022-09-16 11:46:26 UTC
Tested with:
libvirt-8.7.0-1.el9.x86_64
qemu-kvm-7.1.0-1.el9.x86_64

Steps:
# virsh start avocado-vt-vm1 
Domain 'avocado-vt-vm1' started

# ll /run/libvirt/qemu/swtpm/
total 4
-rw-r--r--. 1 root root 5 Sep 16 07:37 4-avocado-vt-vm1-swtpm.pid
srw-------. 1 qemu qemu 0 Sep 16 07:37 4-avocado-vt-vm1-swtpm.sock

# virsh destroy avocado-vt-vm1 
Domain 'avocado-vt-vm1' destroyed

# ll /run/libvirt/qemu/swtpm/
total 0

Comment 5 Yanqiu Zhang 2022-09-28 07:59:53 UTC
Additional tests on same version:
1. for session mode:
$ ll /home/test/.cache/libvirt/qemu/run/swtpm/
total 4
-rw-r--r--. 1 test test 6 Sep 28 02:58 3-vm-session-swtpm.pid
srw-------. 1 test test 0 Sep 28 02:58 3-vm-session-swtpm.sock

$ virsh destroy vm-session
Domain 'vm-session' destroyed

$ ll /home/test/.cache/libvirt/qemu/run/swtpm/
total 0

2.Kill swtpm process:
# kill -9 `pidof swtpm`
# ll /run/libvirt/qemu/swtpm/
total 4
-rw-r--r--. 1 root root 4 Sep 28 03:12 2-avocado-vt-vm1-swtpm.pid
srw-------. 1 qemu qemu 0 Sep 28 03:12 2-avocado-vt-vm1-swtpm.sock

# virsh destroy avocado-vt-vm1 
Domain 'avocado-vt-vm1' destroyed

# ll /run/libvirt/qemu/swtpm/
total 0

3. Auto regression test passed for vtpm function:
https://libvirt-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/libvirt-RHEL-9.2-runtest-x86_64-function-tpm_emulator/6/testReport/


Combined with comment 2 results, mark bug as verified.

Comment 8 errata-xmlrpc 2023-05-09 07:26:34 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 (libvirt bug fix and enhancement update), 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-2023:2171


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