Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 05 Jun 2025 18:49:41 +0000
From:      bugzilla-noreply@freebsd.org
To:        virtualization@FreeBSD.org
Subject:   [Bug 287326] bhyve: Ubuntu guest doesn't boot with TPM emulation enabled
Message-ID:  <bug-287326-27103@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D287326

            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=3Dfile:////var/run/swtpm/tpm.state
--tpm2 --server type=3Dunixio,path=3D/var/run/swtpm/tpm --log file=3D/tmp/s=
wtmp.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=3D52:54:00:d2:8b:41 -s 5:0,fbuf,tcp=3D127.0.0.1:590=
5 -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 v=
alue
(Integer/String/Buffer/Package/Reference required for _DSM)

/tmp/bhyve.2Vm0B4f    985:         If(LEqual(Arg0,
ToUUID("376054ED-CC13-4675-901C-4756D7F2D45D"))) /* UUID */
Remark   2184 -=20=20=20=20

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)=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20
                      [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=3D52:54:00:d2:8b:41 -s 5:0,fbuf,tcp=3D127.0.0.1:590=
5 -l
com1,/dev/nmdm1A ubuntu

It boots fine.

Also, I've tried FreeBSD guest instead of Ubuntu, and it boots fine with TP=
M:

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=3D52:54:00:13:fa:59 -s 5:0,fbuf,tcp=3D127.0.0.1:592=
0 -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.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-287326-27103>