[SOLVED] virt-manager: swtpm problem. CBR TPM 2.0

Hey, I'm using virt-manager via rpm-ostree. I just layered virt-manager and used ujust to add my user to Libvirt. Now every time I want to create a VM (Windows or Linux) and add TPM (CBR and 2.0) I get this Error:
Unable to complete install: 'internal error: Could not run '/usr/bin/swtpm_setup'. exitstatus: 1; Check error log '/var/log/swtpm/libvirt/qemu/ubuntu24.04-swtpm.log' for details.'

Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 71, in cb_wrapper
callback(asyncjob, *args, **kwargs)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/virt-manager/virtManager/createvm.py", line 2008, in _do_async_install
installer.start_install(guest, meter=meter)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/usr/share/virt-manager/virtinst/install/installer.py", line 726, in start_install
domain = self._create_guest(
guest, meter, initial_xml, final_xml,
doboot, transient)
File "/usr/share/virt-manager/virtinst/install/installer.py", line 667, in _create_guest
domain = self.conn.createXML(initial_xml or final_xml, 0)
File "/usr/lib64/python3.13/site-packages/libvirt.py", line 4545, in createXML
raise libvirtError('virDomainCreateXML() failed')
libvirt.libvirtError: internal error: Could not run '/usr/bin/swtpm_setup'. exitstatus: 1; Check error log '/var/log/swtpm/libvirt/qemu/ubuntu24.04-swtpm.log' for details.
Unable to complete install: 'internal error: Could not run '/usr/bin/swtpm_setup'. exitstatus: 1; Check error log '/var/log/swtpm/libvirt/qemu/ubuntu24.04-swtpm.log' for details.'

Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 71, in cb_wrapper
callback(asyncjob, *args, **kwargs)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/virt-manager/virtManager/createvm.py", line 2008, in _do_async_install
installer.start_install(guest, meter=meter)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/usr/share/virt-manager/virtinst/install/installer.py", line 726, in start_install
domain = self._create_guest(
guest, meter, initial_xml, final_xml,
doboot, transient)
File "/usr/share/virt-manager/virtinst/install/installer.py", line 667, in _create_guest
domain = self.conn.createXML(initial_xml or final_xml, 0)
File "/usr/lib64/python3.13/site-packages/libvirt.py", line 4545, in createXML
raise libvirtError('virDomainCreateXML() failed')
libvirt.libvirtError: internal error: Could not run '/usr/bin/swtpm_setup'. exitstatus: 1; Check error log '/var/log/swtpm/libvirt/qemu/ubuntu24.04-swtpm.log' for details.
and this is the log:
sudo tail -n 50 /var/log/swtpm/libvirt/qemu/ubuntu24.04-swtpm.log
swtpm at /usr/bin/swtpm does not support TPM 2
Failed to run swtpm '/usr/bin/swtpm': swtpm: Could not open logfile for writing: Permission denied
sudo tail -n 50 /var/log/swtpm/libvirt/qemu/ubuntu24.04-swtpm.log
swtpm at /usr/bin/swtpm does not support TPM 2
Failed to run swtpm '/usr/bin/swtpm': swtpm: Could not open logfile for writing: Permission denied
I read that swtpm needs at least version 0.7 and mine is:
swtpm --version
TPM emulator version 0.10.0, Copyright (c) 2014-2022 IBM Corp. and others
swtpm --version
TPM emulator version 0.10.0, Copyright (c) 2014-2022 IBM Corp. and others
I tried this on Bazzite 41 & 42
No description
70 Replies
chronically online
chronically onlineOP•6d ago
Tried on both
rpm-ostree status
State: idle
Deployments:
ā— ostree-image-signed:docker://ghcr.io/ublue-os/bazzite-gnome:stable
Digest: sha256:0d98c33a37fa9c32de343a46bb909d31a4e2584e49956dc95e0b707655b83ed2
Version: 42.20250421 (2025-04-21T05:05:09Z)
LayeredPackages: virt-manager

ostree-image-signed:docker://ghcr.io/ublue-os/bazzite-gnome:stable
Digest: sha256:00579cc4ae59dbff0c1e62247efb473f633833958693bfe0a40459e3d8d25771
Version: 41.20250409.1 (2025-04-09T19:04:16Z)
LayeredPackages: virt-manager
rpm-ostree status
State: idle
Deployments:
ā— ostree-image-signed:docker://ghcr.io/ublue-os/bazzite-gnome:stable
Digest: sha256:0d98c33a37fa9c32de343a46bb909d31a4e2584e49956dc95e0b707655b83ed2
Version: 42.20250421 (2025-04-21T05:05:09Z)
LayeredPackages: virt-manager

ostree-image-signed:docker://ghcr.io/ublue-os/bazzite-gnome:stable
Digest: sha256:00579cc4ae59dbff0c1e62247efb473f633833958693bfe0a40459e3d8d25771
Version: 41.20250409.1 (2025-04-09T19:04:16Z)
LayeredPackages: virt-manager
river
river•6d ago
couldnt u use hw tpm passthru?
CheckYourFax
CheckYourFax•6d ago
how long ago did you use the ujust for setting up virtualization? this is a very old issue i think it was fixed
chronically online
chronically onlineOP•6d ago
I never tried that and always used emulated. I know it worked before. But yea.. I could try that.
CheckYourFax
CheckYourFax•6d ago
the fix i think was to set SELinux to permissive while making the swtpm try that then put it back on enforced
chronically online
chronically onlineOP•6d ago
I know that the old way was ujust setup virtualization and it installed the whole qemu suite then. But
Spawned on Apr 16 2025
Spawned on Apr 16 2025
My qemu came preinstalled, I just used ujust setup-virtualization to put myself into the libvirt group, not to install qemu this is a fresh install
CheckYourFax
CheckYourFax•6d ago
you didn't actually enable virtualization? for the kargs
chronically online
chronically onlineOP•6d ago
I tried that a couple minitus ago but it said something with kargs and flatpak, but nothing happend
CheckYourFax
CheckYourFax•6d ago
i would still try the selinux thing, maybe the old bug is back for some reason
chronically online
chronically onlineOP•6d ago
ujust setup-virtualization
Virtualization Setup
NOTE: Enabling Virtualization will install the virt-manager flatpak and set kernel args
ujust setup-virtualization
Virtualization Setup
NOTE: Enabling Virtualization will install the virt-manager flatpak and set kernel args
CheckYourFax
CheckYourFax•6d ago
the weird part about the bug was that selinux didn't even complain at all it just wouldn't work with enforced so there was no way to use audit2allow to fix it lmao
chronically online
chronically onlineOP•6d ago
Sorry, I'm a bit lost... I didn't get what I should do now šŸ˜… But before qemu was included in the image - it always worked. When qemu got included into the image - it also worked. Just 9 days ago I did a fresh install and now I get this error ... on 41 and 42
CheckYourFax
CheckYourFax•6d ago
setenforce 0 then try to create VM again if that works we got the old bug back
chronically online
chronically onlineOP•6d ago
Okay I will try that, but I'm on 41 now, because of Gsconnect. when did they fix the bug? roughly?
CheckYourFax
CheckYourFax•6d ago
i can't use tpm passthrough because lenovo doesn't want to update AGESA that fixes the interrupt issue with the tpm causing huge stutter every time the TPM is probed 😭
chronically online
chronically onlineOP•6d ago
I mean I could also try to passthrough, I was just scared that there is any security risk. Just in case I do some dumb stuff xd
CheckYourFax
CheckYourFax•6d ago
nah tpm passthrough actually safer technically lmao
chronically online
chronically onlineOP•6d ago
wtf
CheckYourFax
CheckYourFax•6d ago
swtpm is just a file on your filesystem but for VM it really doesn't matter that much since you're isolated
chronically online
chronically onlineOP•6d ago
I want to share a dir soon :clueless: but thanks for the info, didnt know that and to turn it back on again it's probably 1?
CheckYourFax
CheckYourFax•6d ago
ye but it won't survive a reboot
chronically online
chronically onlineOP•6d ago
. . .
CheckYourFax
CheckYourFax•6d ago
i mean the whole setting is temporary so it goes back to enforced automatically when you reboot
chronically online
chronically onlineOP•6d ago
Ah okay. I mean I want to keep nice RedHat and NSA security on tbh and if it's just temp anyway...
CheckYourFax
CheckYourFax•6d ago
its just for creating the swtpm file once its made it doesn't break anymore so back to enforced is fine
chronically online
chronically onlineOP•6d ago
thx. got you. so turn off. create vm. and after a reboot everything is normal but my swtpm is there āœŒļø right?
CheckYourFax
CheckYourFax•6d ago
yep you can just setenforce 1 to if you want but it doesn't matter if you forget
chronically online
chronically onlineOP•6d ago
good but now that you said this šŸ¤” šŸ˜„
CheckYourFax
CheckYourFax•6d ago
well i mean technically since for a VM it doesn't really matter than much
chronically online
chronically onlineOP•6d ago
alright
CheckYourFax
CheckYourFax•6d ago
i mean i guess if you make passkeys for your accounts in the VM?
chronically online
chronically onlineOP•6d ago
and tbh idk if my mobo (msi) and cpu (amd) support this
CheckYourFax
CheckYourFax•6d ago
i have a 5800H laptop that has this issue, zen 4+ doesn't have this issue
chronically online
chronically onlineOP•6d ago
Oh okay, I'm on 5800x3d
CheckYourFax
CheckYourFax•6d ago
yeah make sure your bios is up to date then they fixed this bug ages ago
chronically online
chronically onlineOP•6d ago
should be šŸ¤ž And no.. no passkeys, I just use some niche windows software in VM's and I want to create a shared dir. Other than that I just use VM"s to try Linux Distros and just for fun. Some bash.. so I don't F up my main machine
CheckYourFax
CheckYourFax•6d ago
yeah matters little if you use swtpm or passthrough then
chronically online
chronically onlineOP•6d ago
Thanks šŸ™‚ Do you think I should close this issue then? But I mean I still can't create swtpm vms without turning selinux off but I will just try passthrough and I don't even need tpm wtf... I'm just weird
CheckYourFax
CheckYourFax•6d ago
When you create VM just go to the big hardware screen Somewhere there u can change the TPM or disable it even If pass thru doesnt work try layering virt manager Oh wait you already have it layered
chronically online
chronically onlineOP•6d ago
No description
chronically online
chronically onlineOP•6d ago
I tried that, but I got this now ... With Passthrough
CheckYourFax
CheckYourFax•6d ago
You'll need to fix swtpm Pass through won't work
chronically online
chronically onlineOP•6d ago
No description
CheckYourFax
CheckYourFax•6d ago
weird i guess setting selinux permissive no longer works on current version 42
chronically online
chronically onlineOP•6d ago
It worked on 41 now. I set it to 0 just for the vm creation
CheckYourFax
CheckYourFax•6d ago
and did it work?:
chronically online
chronically onlineOP•6d ago
yes āœŒļø thanks again
CheckYourFax
CheckYourFax•6d ago
@HikariKnight The problem with swtpm is back on 42 😐 but this time it can't be worked around because setting permissive selinux no longer works
chronically online
chronically onlineOP•6d ago
😐
CheckYourFax
CheckYourFax•6d ago
there's nothing in sealert about swtpm right? i will do some testing
chronically online
chronically onlineOP•6d ago
@CheckYourFax And since yesterday I'm trying to get VirtioFS to work. I did everything clean again. rpm-ostree reset And then I used the ujust command to enable virtualization (now with the virtmanager flatpak) I can passthrough drives via USB yeaaah!! But... every time I try to setup virtiofs, it doesn't work. Linux and Windows can't see the shared folder. Even with virtio drivers on Windows and afaik on linux guests it should work ootb. I mean I'm more than happy, that usb storage works, but a virtiofs would be so much easier. and faster. Sorry, I'm completely new to this and I'm just not sure if the virtiofs problem is on my end, or an issue in general
chronically online
chronically onlineOP•6d ago
chronically online
chronically onlineOP•6d ago
or maby flatpak related. idk...
CheckYourFax
CheckYourFax•6d ago
the swtpm is not made inside the flatpak it uses qemu for that only some virt manager related things could have some sandbox related issues
chronically online
chronically onlineOP•6d ago
and qemu should have permission for that right? but I mean the virtiofs shared dir
CheckYourFax
CheckYourFax•6d ago
that's a classic bug that cannot be fixed easily the tpm passthrough not sure if its fixable at all
chronically online
chronically onlineOP•6d ago
sorry for being a help vampire, ik this is a different problem I'm just a bit frustrated
CheckYourFax
CheckYourFax•6d ago
its that your tpm expects a buffer of exactly 4096 bytes but the host (the os inside the VM) asks for a smaller buffer question: did you type your sudo password another time after enabling virtualization? it asks for it twice the second time it does some relabeling to fix issues because i don't have this swtpm issue at all and my spawn time is about the same as yours
chronically online
chronically onlineOP•6d ago
I'm not 100% sure... I don't want to lie. But I remember the ujust script saying something like: "Making sure ... will work" And I also ran the script again, just to be on the safe side. Followed by a reboot. But I'm happy atm! Because I can use the virt-manager Flatpak, I don't need to layer something and I even managed to do VirtioFS shared folders from on my host and I can passthrough USB Sticks now šŸ™‚ But yeah.. I still can't create emulated tpm or vms with tpm in general. On 41 I just set selinux to permissive, create the vm and done. But iirc you said that wont work on 42 anymore...........
CheckYourFax
CheckYourFax•6d ago
try running the ujust again and enabling virtualization i can't reproduce your issue with the swtpm i know hikari fixed it a whiiiiile ago
chronically online
chronically onlineOP•6d ago
No description
chronically online
chronically onlineOP•6d ago
typed my passwd 2x I will reboot and report back. brb
CheckYourFax
CheckYourFax•6d ago
ok try now yes reboot and try again with swtpm
chronically online
chronically onlineOP•6d ago
It works now.... I'm so sorry :/ it works 🄳 thanks for your time. Sorry..I wasn't sure with the double passwd
CheckYourFax
CheckYourFax•6d ago
@HikariKnight is there a way we can make the ujust only require password once? when you enable virtualization it asks for root password twice, leading to users not finishing the entire script. Cause you don't expect that to happen. Once in a window, and once in the terminal
HikariKnight
HikariKnight•6d ago
no not really it essentially times out the token i guess because things take time and people dont read
CheckYourFax
CheckYourFax•6d ago
i think its because the password/token is not bound to the terminal the first time because its rpm-ostree kargs directly asking for it in a window IIRC
HikariKnight
HikariKnight•6d ago
because rpm-ostree uses pkexec in the background because it has rules for it
CheckYourFax
CheckYourFax•6d ago
yeah pkexec doesn't create a sudo timestamp that's it rip
chronically online
chronically onlineOP•6d ago
!fixed !closed User Error, you don't need need to layer anything, just use the ujust command, it will take care of everything. If you setup virtualization with ujust setup-virtualization make sure to read and type your sudo password twice.

Did you find this page helpful?