There is another uncaught exception: If the user is not in the tss
group, then tpm2_ptool dies with

% tpm2_ptool init
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/tpm2_pkcs11/commandlets_store.py", line 
100, in __call__
    pobj_ctx = create_primary(tpm2, hierarchyauth, pobjauth, transient_parent)
  File "/usr/lib/python3/dist-packages/tpm2_pkcs11/utils.py", line 394, in 
create_primary
    return tpm2.createprimary(hierarchyauth, pobjauth, alg=alg, attrs=attrs)
           ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/tpm2_pkcs11/tpm2.py", line 86, in 
createprimary
    raise RuntimeError("Could not execute tpm2_createprimary: %s" %
                       stderr)
RuntimeError: Could not execute tpm2_createprimary: 
b'ERROR:tcti:src/tss2-tcti/tcti-device.c:455:Tss2_Tcti_Device_Init() Failed to 
open specified TCTI device file /dev/tpmrm0: Permission denied 
\nERROR:tcti:src/tss2-tcti/tctildr-dl.c:149:tcti_from_file() Could not 
initialize TCTI file: libtss2-tcti-device.so.0 
\nERROR:tcti:src/tss2-tcti/tcti-device.c:455:Tss2_Tcti_Device_Init() Failed to 
open specified TCTI device file /dev/tpm0: Permission denied 
\nERROR:tcti:src/tss2-tcti/tctildr-dl.c:149:tcti_from_file() Could not 
initialize TCTI file: libtss2-tcti-device.so.0 
\nERROR:tcti:src/tss2-tcti/tcti-device.c:455:Tss2_Tcti_Device_Init() Failed to 
open specified TCTI device file /dev/tcm0: No such file or directory 
\nERROR:tcti:src/tss2-tcti/tctildr-dl.c:149:tcti_from_file() Could not 
initialize TCTI file: libtss2-tcti-device.so.0 
\nWARNING:tcti:src/util-io/io.c:262:socket_connect() Failed to connect to host 
127.0.0.1, port 2321: errno 111: Connection refused 
\nERROR:tcti:src/tss2-tcti/tcti-swtpm.c:617:Tss2_Tcti_Swtpm_Init() Cannot 
connect to swtpm TPM socket 
\nERROR:tcti:src/tss2-tcti/tctildr-dl.c:149:tcti_from_file() Could not 
initialize TCTI file: libtss2-tcti-swtpm.so.0 
\nWARNING:tcti:src/util-io/io.c:262:socket_connect() Failed to connect to host 
127.0.0.1, port 2321: errno 111: Connection refused 
\nERROR:tcti:src/tss2-tcti/tctildr-dl.c:149:tcti_from_file() Could not 
initialize TCTI file: libtss2-tcti-mssim.so.0 
\nERROR:tcti:src/tss2-tcti/tctildr-dl.c:263:tctildr_get_default() No standard 
TCTI could be loaded 
\nERROR:tcti:src/tss2-tcti/tctildr.c:477:tctildr_init_context_data() Failed to 
instantiate TCTI \nERROR: Could not load tcti, got: "(null)"\n'
Could not execute tpm2_createprimary: 
b'ERROR:tcti:src/tss2-tcti/tcti-device.c:455:Tss2_Tcti_Device_Init() Failed to 
open specified TCTI device file /dev/tpmrm0: Permission denied 
\nERROR:tcti:src/tss2-tcti/tctildr-dl.c:149:tcti_from_file() Could not 
initialize TCTI file: libtss2-tcti-device.so.0 
\nERROR:tcti:src/tss2-tcti/tcti-device.c:455:Tss2_Tcti_Device_Init() Failed to 
open specified TCTI device file /dev/tpm0: Permission denied 
\nERROR:tcti:src/tss2-tcti/tctildr-dl.c:149:tcti_from_file() Could not 
initialize TCTI file: libtss2-tcti-device.so.0 
\nERROR:tcti:src/tss2-tcti/tcti-device.c:455:Tss2_Tcti_Device_Init() Failed to 
open specified TCTI device file /dev/tcm0: No such file or directory 
\nERROR:tcti:src/tss2-tcti/tctildr-dl.c:149:tcti_from_file() Could not 
initialize TCTI file: libtss2-tcti-device.so.0 
\nWARNING:tcti:src/util-io/io.c:262:socket_connect() Failed to connect to host 
127.0.0.1, port 2321: errno 111: Connection refused 
\nERROR:tcti:src/tss2-tcti/tcti-swtpm.c:617:Tss2_Tcti_Swtpm_Init() Cannot 
connect to swtpm TPM socket 
\nERROR:tcti:src/tss2-tcti/tctildr-dl.c:149:tcti_from_file() Could not 
initialize TCTI file: libtss2-tcti-swtpm.so.0 
\nWARNING:tcti:src/util-io/io.c:262:socket_connect() Failed to connect to host 
127.0.0.1, port 2321: errno 111: Connection refused 
\nERROR:tcti:src/tss2-tcti/tctildr-dl.c:149:tcti_from_file() Could not 
initialize TCTI file: libtss2-tcti-mssim.so.0 
\nERROR:tcti:src/tss2-tcti/tctildr-dl.c:263:tctildr_get_default() No standard 
TCTI could be loaded 
\nERROR:tcti:src/tss2-tcti/tctildr.c:477:tctildr_init_context_data() Failed to 
instantiate TCTI \nERROR: Could not load tcti, got: "(null)"\n'


This looks scary and gives the tool a bad reputation.


Regards
Harri

Reply via email to