Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TPM support #111

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add TPM support #111

wants to merge 1 commit into from

Conversation

5aaee9
Copy link
Contributor

@5aaee9 5aaee9 commented Dec 28, 2024

pvedaemon call swtpm_setup to setup TPM support for vm.

This patch add swtpm support and Windows 11 vm is require TPM.

@JulienMalka
Copy link
Member

Thank you ! Can you explain what the rationale was for producing swtpm_setup.conf so I know how to maintain it in the future ?

@5aaee9
Copy link
Contributor Author

5aaee9 commented Dec 31, 2024

@JulienMalka

Proxmox hard-code path in there code https://github.com/proxmox/qemu-server/blob/master/PVE/QemuServer.pm#L3248

And the config file is from swtpm-tools https://github.com/stefanberger/swtpm/blob/v0.8.0/samples/swtpm_setup.conf.in

@mjm
Copy link

mjm commented Jan 1, 2025

I found I still had some issues with swtpm with this PR as is. When migrating VMs, I needed to add swtpm to environment.systemPackages to make it available to (I think) other hosts calling it directly via SSH. And then I also needed to add it to the pve-guests service path to be able to start VMs with a TPM automatically on boot.

@mjm
Copy link

mjm commented Jan 3, 2025

Seems like maybe qmeventsd needs it too? I get an error about swtpm_setup not being found in the start task when I reboot a VM, but starting it manually after that works fine. Maybe swtpm should just be in the wrapper for the pve-manager binaries, rather than on individual services?

@eljojo eljojo mentioned this pull request Jan 9, 2025
@eljojo
Copy link

eljojo commented Jan 10, 2025

Hey I was trying to setup a windows VM, opened main...eljojo:proxmox-nixos:swtpm and only afterwards I saw this existed, your solution here is better.

In my case I think I got things to work by providing an empty swtmp config, you could try it:

environment.etc."swtpm_setup.conf" = {
        text = '' '';
      };

edit: no, it still breaks :(

swtpm: Formatting 'file:///dev/zvol/one_tera/vm-120-disk-1' as new linear NVRAM store
Failed to open file �/tmp/swtpm_setup.certs.1WJ8Z2/ek.cert�: No such file or directory
An error occurred. Authoring the TPM state failed.

running the command on the console to initialize TPM allows it to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants