[Bug 287326] bhyve: Ubuntu guest doesn't boot with TPM emulation enabled
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 287326] bhyve: Ubuntu guest doesn't boot with TPM emulation enabled"
 - Reply: bugzilla-noreply_a_freebsd.org: "[Bug 287326] bhyve: Ubuntu guest doesn't boot with TPM emulation enabled"
 - Reply: bugzilla-noreply_a_freebsd.org: "[Bug 287326] bhyve: Ubuntu guest doesn't boot with TPM emulation enabled"
 - Go to: [ bottom of page ] [ top of archives ] [ this month ]
 
Date: Thu, 05 Jun 2025 18:49:41 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=287326
            Bug ID: 287326
           Summary: bhyve: Ubuntu guest doesn't boot with TPM emulation
                    enabled
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bhyve
          Assignee: virtualization@FreeBSD.org
          Reporter: novel@FreeBSD.org
As mentioned in https://reviews.freebsd.org/D46373, I run swtpm like that:
sudo swtpm socket --tpmstate backend-uri=file:////var/run/swtpm/tpm.state
--tpm2 --server type=unixio,path=/var/run/swtpm/tpm --log file=/tmp/swtmp.log
--flags not-need-init --daemon
I'm trying to start an Ubuntu guest like that:
bhyve -c 2 -m 4096 -A -I -u -H -P -s 0:0,hostbridge -l
bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd -s 2:0,xhci,tablet -s
1:0,lpc -s 3:0,ahci,hd:/data/img/ubuntu.img -s
4:0,virtio-net,tap2,mac=52:54:00:d2:8b:41 -s 5:0,fbuf,tcp=127.0.0.1:5905 -l
com1,/dev/nmdm1A -l tpm,swtpm,/var/run/swtpm/tpm ubuntu
In stdout I see:
/tmp/bhyve.2Vm0B4f    873:         OperationRegion(TPP1, SystemMemory,
Add(0xfed45000, Arg0), One)
Remark   2173 -                                      ^ Creation of named
objects within a method is highly inefficient, use globals or method local
variables instead (\_SB.TPM.TPFN)
/tmp/bhyve.2Vm0B4f    895:       Method(_DSM, 4, Serialized)
Warning  3115 -                           ^ Not all control paths return a
value (\_SB.TPM._DSM)
/tmp/bhyve.2Vm0B4f    895:       Method(_DSM, 4, Serialized)
Warning  3107 -                           ^ Reserved method must return a value
(Integer/String/Buffer/Package/Reference required for _DSM)
/tmp/bhyve.2Vm0B4f    985:         If(LEqual(Arg0,
ToUUID("376054ED-CC13-4675-901C-4756D7F2D45D"))) /* UUID */
Remark   2184 -    
In the VM console I see it's cycling through:
BdsDxe: loading Boot0001 "UEFI BHYVE SATA DISK BHYVE-3609-D803-384E" from
PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)                                 
                                                                               
                      [0/4935]
BdsDxe: starting Boot0001 "UEFI BHYVE SATA DISK BHYVE-3609-D803-384E" from
PciRoot(0x0)/Pci(0x3,0x0)/Sata(0x0,0xFFFF,0x0)
Reset System
When I start it with:
bhyve -c 2 -m 4096 -A -I -u -H -P -s 0:0,hostbridge -l
bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd -s 2:0,xhci,tablet -s
1:0,lpc -s 3:0,ahci,hd:/data/img/ubuntu.img -s
4:0,virtio-net,tap2,mac=52:54:00:d2:8b:41 -s 5:0,fbuf,tcp=127.0.0.1:5905 -l
com1,/dev/nmdm1A ubuntu
It boots fine.
Also, I've tried FreeBSD guest instead of Ubuntu, and it boots fine with TPM:
bhyve -c 2 -m 4096 -A -I -u -H -P -s 0:0,hostbridge -l
bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd,/var/lib/libvirt/bhyve/nvram/freebsd_VARS.fd
-s 2:0,xhci,tablet -s 1:0,lpc -s 3:0,ahci,hd:/data/img/freebsd.img -s
4:0,virtio-net,tap2,mac=52:54:00:13:fa:59 -s 5:0,fbuf,tcp=127.0.0.1:5920 -l
com1,/dev/nmdm5A -l tpm,swtpm,/var/run/swtpm/tpm freebsd
And a brief check shows that TPM works in this configuration. Is that a bug in
bhyve, firmware, or Ubutnu, or something else?
BTW, running -CURRENT as of May 31th with edk2-bhyve-g202505.
-- 
You are receiving this mail because:
You are the assignee for the bug.