QEMU and swtpm strange problem

Trying setting up a VM with TPM2.

user@localhost:~> swtpm socket -t -d --tpm2 --tpmstate dir="$HOME"/tpm --ctrl type=unixio,path="$HOME"/tpm/swtpm-sock --log level=20
user@localhost:~> qemu-system-x86_64 -accel kvm -m 1024 -boot d -bios /usr/share/qemu/bios-256k.bin -boot menu=on -display gtk -chardev socket,id=chrtpm,path="$HOME"/tpm/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0
qemu-system-x86_64: tpm-emulator: TPM result for CMD_INIT: 0x9 operation failed
user@localhost:~>

However, if building swtpm from source (upstream from Github), any version, it works normally.

Can someone else reproduce this problem? In my case using KDE as desktop.

Thanks.

Someone?

I’d really like a point of view here beforehand before attempting to send a bug report to bugzilla…

Hi
Try deleting the following directory/contents, restart libvirtd and run your command again…


/var/lib/libvirt/swtpm/<uuid of VM>

Directory /var/lib/libvirt/swtpm is empty, and libvirtd is not even running…

I’m using QEMU directly instead of libvirt.

So can anyone else reproduce this?

Tested on another different rig (laptop Acer A315, model from this year), with different DEs (KDE, GNOME, XFCE). Exact same issue. Notice this is Leap 15.4, not SLE.
Come on, it’s just installing qemu/kvm and running a couple of fixed commands. Is anyone else having this issue with Leap’s swtpm?

Thanks.

You can not command people here to do things. Everybody here is spending spare and free time when they like and how they like. Nobody is paid, not even a dime, by anybody (and certainly not you) for helping here.

So stop acting as if people here are ignoring you on purpose. The only result of these posts from you will possibly be that people are going to ignore you.

I have not had any need to try it. Sorry, but no experience with it.

Error 0x9 means there is a problem in swtpm, and swtpm gave up & disconnected the client.

Are you running swtpm in background? If you are, please make sure swtpm is running in another window and observe swtpm log.

swtpm log will tell you the root cause.

Taking my case as example, swtpm said “swtpm: SWTPM_NVRAM_StoreData: Error (fatal) opening ./mytpm/TMP-00.permall for write failed, No such file or directory”. I created ./mytpm directory and it works.