libvirt swtpm pid files duplicating in /run/libvirt/qemu/swtpm/
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libvirt (Ubuntu) |
Fix Released
|
Undecided
|
Lena Voytek | ||
Kinetic |
Fix Released
|
Undecided
|
Lena Voytek | ||
Lunar |
Fix Released
|
Undecided
|
Lena Voytek |
Bug Description
[Impact]
When a user shuts down a qemu vm that uses swtpm, the swtpm pid file will be left behind.
This fix should be backported to Kinetic to stop ongoing clutter from dead pid files.
The issue is fixed using a patch commit from upstream that clears out the existing swtpm pid file when the vm shuts down.
[Test Plan]
To test, install virt-manager and swtpm then create a vm:
# sudo apt install virt-manager swtpm
Create a vm in virt-manager and on the last page
> Select "Customize configuration before install"
> Click Finish
> Click Add Hardware
> Select TPM with Model "TIS" and version 2.0
> Click "Begin Installation"
Turn the vm off and on a few times then check /run/libvirt/
# sudo ls -la /run/libvirt/
In the original version multiple pid files will show up, e.g.
drwxrwx--- 2 libvirt-qemu swtpm 80 Nov 17 13:34 .
drwxr-xr-x 5 root root 180 Nov 17 13:34 ..
-rw-r--r-- 1 root root 5 Nov 17 12:57 1-win11-swtpm.pid
-rw-r--r-- 1 root root 5 Nov 17 13:34 2-win11-swtpm.pid
With the fix only one pid file will show up per running TPM virtual machine and the folder will be empty if there are none.
[Where problems could occur]
This fix modifies the qemu_tpm stop function, which is triggered when a vm completes shutdown. So any issues that arise from this fix would happen at this point. Most likely, when an issue shows up it would be related to file system manipulation in the /run/libvirt/
[Other Info]
Fix added to lunar in version 8.6.0-0ubuntu4
[Original Description]
As a spinoff of LP: #1989100, we found that swtpm pid files were not being removed after shutting down a vm in Kinetic. Listing the directory /run/libvirt/
$ sudo ls -la /run/libvirt/
drwxrwx--- 2 libvirt-qemu swtpm 80 Nov 17 13:34 .
drwxr-xr-x 5 root root 180 Nov 17 13:34 ..
-rw-r--r-- 1 root root 5 Nov 17 12:57 1-win11-swtpm.pid
-rw-r--r-- 1 root root 5 Nov 17 13:34 2-win11-swtpm.pid
...
srw------- 1 libvirt-qemu kvm 0 Nov 17 16:20 5-win11-swtpm.sock
Related branches
- git-ubuntu bot: Approve
- Lena Voytek (community): Approve
- Canonical Server packageset reviewers: Pending requested
- Canonical Server Reporter: Pending requested
-
Diff: 218 lines (+177/-0)5 files modifieddebian/changelog (+15/-0)
debian/patches/series (+3/-0)
debian/patches/ubuntu/lp-1993304-apparmor-allow-getattr-on-usb-devices.patch (+49/-0)
debian/patches/ubuntu/lp-1996176-nodedev-ignore-EINVAL-from-libudev-in-udevEventHandl.patch (+58/-0)
debian/patches/ubuntu/lp-1997269-fix-swtpm-pid-duplication.patch (+52/-0)
- Christian Ehrhardt (community): Approve
- Canonical Server Reporter: Pending requested
- git-ubuntu import: Pending requested
-
Diff: 218 lines (+177/-0)5 files modifieddebian/changelog (+15/-0)
debian/patches/series (+3/-0)
debian/patches/ubuntu/lp-1993304-apparmor-allow-getattr-on-usb-devices.patch (+49/-0)
debian/patches/ubuntu/lp-1996176-nodedev-ignore-EINVAL-from-libudev-in-udevEventHandl.patch (+58/-0)
debian/patches/ubuntu/lp-1997269-fix-swtpm-pid-duplication.patch (+52/-0)
- git-ubuntu bot: Approve
- Christian Ehrhardt (community): Approve
- Canonical Server Reporter: Pending requested
-
Diff: 85 lines (+60/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu/lp-1997269-fix-swtpm-pid-duplication.patch (+52/-0)
Changed in libvirt (Ubuntu Kinetic): | |
status: | New → In Progress |
assignee: | nobody → Lena Voytek (lvoytek) |
description: | updated |
tags: | added: server-todo |
Already uploaded to Lunar-proposed.
Now tests and review is complete for SRUs as well so I uploaded it to K -unapproved too.