tpm2-software / tpm2-tss

OSS implementation of the TCG TPM2 Software Stack (TSS2)
https://tpm2-software.github.io
BSD 2-Clause "Simplified" License
753 stars 365 forks source link

make install fails #2016

Closed kgold2 closed 3 years ago

kgold2 commented 3 years ago

Ubuntu 16 xenial.

After doing the m4 workaround and ignoring warnings, make install fails with this. Is there a dependency missing?

/usr/bin/install -c -m 644 dist/tpm-udev.rules '/usr/local/lib/udev/rules.d' make install-data-hook make[2]: Entering directory '/home/kgold/tpm2-tss' (systemd-sysusers && systemd-tmpfiles --create) || \ ( (id -g tss || groupadd -r tss) && (id -u tss || useradd -r -g tss tss) && ( ( if [ ! -d /usr/local/var/run/tpm2-tss/eventlog/ ]; then mkdir -p /usr/local/var/run/tpm2-tss/eventlog/; fi) || true) && ( ( if [ ! -d /usr/local/var/lib/tpm2-tss/system/keystore/ ]; then mkdir -p /usr/local/var/lib/tpm2-tss/system/keystore/; fi)) && (all set_fapi_permissions)) || true /bin/bash: systemd-sysusers: command not found 998 998 /bin/bash: line 1: all: command not found if [ ! -d "/usr/local/var/run/tpm2-tss/eventlog/" ]; then echo " WARNING Directory /usr/local/var/run/tpm2-tss/eventlog/ could not be created"; fi if [ ! -d "/usr/local/var/lib/tpm2-tss/system/keystore/" ]; then echo " WARNING Directory /usr/local/var/lib/tpm2-tss/system/keystore/ could not be created"; fi if [ ! -z "" ]; then \ mv /usr/local/lib/udev/rules.d/tpm-udev.rules /usr/local/lib/udev/rules.d/tpm-udev.rules; \ fi

williamcroberts commented 3 years ago

I wonder if this is the crux of your issue, the dependencies in the install file don't list systemd. Which if you see the error:

/bin/bash: systemd-sysusers: command not found

That command is part of the systemd package:

$ apt-file search systemd-sysusers
systemd: /bin/systemd-sysusers

Perhaps the Ubuntu 16.04 WSL is missing this dependency? Almost all distros come with this by default, but the docs should have this in place and the configure.ac should be checking.

williamcroberts commented 3 years ago

Ha funny, I thought this was for tpm2-abrmd, but I see tpm2-tss uses the same command. @tstruk should we check and error for this in configure like I did in tpm2-abrmd, or can we work around this limitation for non-systemd devices? I see we have it hardcoded on the OS, if it's linux it has systemd. Which, most things do, but it's not always true.

tstruk commented 3 years ago

We also need to support systems without systemd. We have a fallback mechanism https://github.com/tpm2-software/tpm2-tss/blob/master/Makefile.am#L693 If systemd-sysusers or systemd-tmpfiles fail it should use adduser and mkdir and so on. See: https://github.com/tpm2-software/tpm2-tss/issues/1611

williamcroberts commented 3 years ago

We also need to support systems without systemd. We have a fallback mechanism https://github.com/tpm2-software/tpm2-tss/blob/master/Makefile.am#L693 If systemd-sysusers or systemd-tmpfiles fail it should use adduser and mkdir and so on. See: #1611

Ahh I notice the || (or) now. However, that logic can lead to a bunch of error output and confuse folks. I think we should test for the right approach to avoid extra error messages.

kgold2 commented 3 years ago

Perhaps the Ubuntu 16.04 WSL is missing this dependency? Almost all distros come with this by default, but the docs should have this in place and the configure.ac should be checking.

No. The Ubuntu 16 is native. No WSL2, plain ol' bare metal x86.

kgold2 commented 3 years ago
$ apt-file search systemd-sysusers
systemd: /bin/systemd-sysusers

On my Ubuntu 16 x86 native, I get

apt-file search systemd-sysusers manpages-de: /usr/share/man/de/man8/systemd-sysusers.8.gz systemd: /usr/share/man/man8/systemd-sysusers.8.gz systemd: /usr/share/man/man8/systemd-sysusers.service.8.gz

Where do I go from there?

williamcroberts commented 3 years ago
$ apt-file search systemd-sysusers
systemd: /bin/systemd-sysusers

On my Ubuntu 16 x86 native, I get

apt-file search systemd-sysusers manpages-de: /usr/share/man/de/man8/systemd-sysusers.8.gz systemd: /usr/share/man/man8/systemd-sysusers.8.gz systemd: /usr/share/man/man8/systemd-sysusers.service.8.gz

Where do I go from there?

is systemd installed?If not install it, sudo apt-get install systemd. Are you running the server edition or something? The desktop should just have it installed.

williamcroberts commented 3 years ago

But you don't need systemd-sysusers, it will use groupadd and useradd to perform the task. You need systemd and/or dbus for tpm2-abrmd. systemd is the init system, so if you want the tpm2-abrmd started as a service you need it. However, you likely don't want that since you're going to mssim, is that right? You need dbus however for the IPC from client to tpm2-abrmd.

tstruk commented 3 years ago

That's right, we check if the systemd tools are installed and use them if they are, and if not we install everything in the old way. It should be seamless to the user.

kgoldman commented 3 years ago

I don't understand the design, but I thought a TSS is just a library linked to the user's application.

williamcroberts commented 3 years ago

I don't understand the design, but I thought a TSS is just a library linked to the user's application.

That's just one very small part of it. Make install also provides other things. Part of it is configuring the device node permissions and permissions for the FAPI keystore.