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

Cannot find /dev/tpm0 in the guest #21

Closed
itsucks opened this issue Jan 5, 2017 · 6 comments
Closed

Cannot find /dev/tpm0 in the guest #21

itsucks opened this issue Jan 5, 2017 · 6 comments

Comments

@itsucks
Copy link

itsucks commented Jan 5, 2017

Hi, I've integrate swtpm and qemu-tpm in to nova-compute on devstack.
First, I create TPM_PATH and vtpm0 manually

# mkdir /tmp/vtpm0
# chown -R tss:root  /tmp/vtpm0
# swtpm_setup --tpm-state /tmp/vtpm0  --createek 
# swtpm_cuse --name vtpm0 --tpmstate dir=/tmp/vtpm0 --log file=/root/out.log

Then, I start the instance, the qemu comand is

/usr/bin/qemu-system-x86_64 -name instance-00000018 -S -machine pc-i440fx-2.4,accel=kvm,usb=off -bios /home/trust/seabios-tpm/out/bios.bin -m 1024 -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -uuid c05f8b6d-f060-4f01-a91f-4c81b3a464b1 -smbios type=1,manufacturer=OpenStack Foundation,product=OpenStack Nova,version=13.1.3,serial=564d145f-6c15-1879-1d25-ca25bdf7a512,uuid=c05f8b6d-f060-4f01-a91f-4c81b3a464b1,family=Virtual Machine -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/instance-00000018.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/opt/stack/data/nova/instances/c05f8b6d-f060-4f01-a91f-4c81b3a464b1/disk,if=none,id=drive-virtio-disk0,format=qcow2,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive file=/opt/stack/data/nova/instances/c05f8b6d-f060-4f01-a91f-4c81b3a464b1/disk.config,if=none,id=drive-ide0-1-1,readonly=on,format=raw,cache=none -device ide-cd,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 -netdev tap,fd=24,id=hostnet0,vhost=on,vhostfd=25 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=fa:16:3e:16:f5:0c,bus=pci.0,addr=0x3 -chardev file,id=charserial0,path=/opt/stack/data/nova/instances/c05f8b6d-f060-4f01-a91f-4c81b3a464b1/console.log -device isa-serial,chardev=charserial0,id=serial0 -chardev pty,id=charserial1 -device isa-serial,chardev=charserial1,id=serial1 -chardev socket,id=charserial2,path=/tmp/virtualsocket/c05f8b6d-f060-4f01-a91f-4c81b3a464b1,server,nowait -device isa-serial,chardev=charserial2,id=serial2 -vnc 192.168.1.238:0 -k en-us -device cirrus-vga,id=video0,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -tpmdev cuse-tpm,id=tpm0,path=/dev/vtpm0 -device tpm-tis,tpmdev=tpm0

The vtpm log

CUSE TPM successfully initialized.
CUSE TPM successfully initialized.

But I can't find tpm0 in the guest...Do you guys have any suggestions on this please?
How did the qemu create /dev/tpm0 with “-tpmdev cuse-tpm,id=tpm0,path=/dev/vtpm0 -device tpm-tis,tpmdev=tpm0”?

@stefanberger
Copy link
Owner

Inside the guest run dmesg | grep -i tpm. Do you see any messages regarding TPM? What about lsmod | grep tpm. Does that show any loaded modules. What about modprobe tpm_tis or modprobe tpm_tis force=1. Does that make /dev/tpm0 appear?

@itsucks
Copy link
Author

itsucks commented Jan 6, 2017

I ran these commands but got nothing.

ubuntu@vtpm:~$ dmesg | grep -i tpm
ubuntu@vtpm:~$ lsmod | grep tpm
ubuntu@vtpm:~$ modprobe tpm_tis
FATAL: Module tpm_tis not found.
ubuntu@vtpm:~$ modprobe tpm_tis force=1
FATAL: Module tpm_tis not found.

Does this mean that qemu failed to create tpm in the guest?

@stefanberger
Copy link
Owner

What about grep tpm_tis /proc/kallsyms ? It's odd that dmesg shows no TPM related output, not even that something related to TPM access failed.

@itsucks
Copy link
Author

itsucks commented Jan 6, 2017

I tried 'grep tpm_tis /proc/kallsyms', got nothing./(ㄒoㄒ)/

@stefanberger
Copy link
Owner

Then your kernel has no TPM support.

@itsucks
Copy link
Author

itsucks commented Jan 12, 2017

Thanks, that's point. I changed to another image and I found /dev/tpm0.

@itsucks itsucks closed this as completed Jan 12, 2017
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

No branches or pull requests

2 participants