BIOSを使用してTPM 2.0を有効にしました。
$ [ -c /dev/tpmrm0 ] && echo "TPM 2.0"
TPM 2.0
をインストールしようとすると、tpm-tools
次のエラーが発生します。
% sudo apt install tpm-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
tpm-tools is already the newest version (1.3.9.1-0.2ubuntu3).
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up trousers (0.3.14+fixed1-1build1) ...
Job for trousers.service failed because the control process exited with error code.
See "systemctl status trousers.service" and "journalctl -xe" for details.
invoke-rc.d: initscript trousers, action "start" failed.
● trousers.service - LSB: starts tcsd
Loaded: loaded (/etc/init.d/trousers; generated)
Active: failed (Result: exit-code) since Wed 2021-02-10 03:59:26 AEST; 3ms ago
Docs: man:systemd-sysv-generator(8)
Process: 7414 ExecStart=/etc/init.d/trousers start (code=exited, status=30)
Feb 10 03:59:26 blueray-i5 systemd[1]: Starting LSB: starts tcsd...
Feb 10 03:59:26 blueray-i5 trousers[7414]: * Starting Trusted Computing daemon tcsd
Feb 10 03:59:26 blueray-i5 trousers[7414]: /etc/init.d/trousers: 32: [: /dev/tpm0: unexpected operator
Feb 10 03:59:26 blueray-i5 tcsd[7420]: TCSD TDDL[7420]: TrouSerS ioctl: (25) Inappropriate ioctl for device
Feb 10 03:59:26 blueray-i5 tcsd[7420]: TCSD TDDL[7420]: TrouSerS Falling back to Read/Write device support.
Feb 10 03:59:26 blueray-i5 tcsd[7420]: TCSD TCS[7420]: TrouSerS ERROR: TCS GetCapability failed with result = 0x1e
Feb 10 03:59:26 blueray-i5 trousers[7414]: ...fail!
Feb 10 03:59:26 blueray-i5 systemd[1]: trousers.service: Control process exited, code=exited, status=30/n/a
Feb 10 03:59:26 blueray-i5 systemd[1]: trousers.service: Failed with result 'exit-code'.
Feb 10 03:59:26 blueray-i5 systemd[1]: Failed to start LSB: starts tcsd.
dpkg: error processing package trousers (--configure):
installed trousers package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of tpm-tools:
tpm-tools depends on trousers; however:
Package trousers is not configured yet.
dpkg: error processing package tpm-tools (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
trousers
tpm-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
だからズボンサービスを始めようとしました。次の情報を提供します。
% systemctl start trousers.service
Job for trousers.service failed because the control process exited with error code.
See "systemctl status trousers.service" and "journalctl -xe" for details.
% systemctl status trousers.service
● trousers.service - LSB: starts tcsd
Loaded: loaded (/etc/init.d/trousers; generated)
Active: failed (Result: exit-code) since Wed 2021-02-10 04:04:56 AEST; 23s ago
Docs: man:systemd-sysv-generator(8)
Process: 9114 ExecStart=/etc/init.d/trousers start (code=exited, status=30)
Feb 10 04:04:56 blueray-i5 systemd[1]: Starting LSB: starts tcsd...
Feb 10 04:04:56 blueray-i5 trousers[9114]: * Starting Trusted Computing daemon tcsd
Feb 10 04:04:56 blueray-i5 trousers[9114]: /etc/init.d/trousers: 32: [: /dev/tpm0: unexpected operator
Feb 10 04:04:56 blueray-i5 tcsd[9120]: TCSD TDDL[9120]: TrouSerS ioctl: (25) Inappropriate ioctl for device
Feb 10 04:04:56 blueray-i5 tcsd[9120]: TCSD TDDL[9120]: TrouSerS Falling back to Read/Write device support.
Feb 10 04:04:56 blueray-i5 tcsd[9120]: TCSD TCS[9120]: TrouSerS ERROR: TCS GetCapability failed with result = 0x1e
Feb 10 04:04:56 blueray-i5 trousers[9114]: ...fail!
Feb 10 04:04:56 blueray-i5 systemd[1]: trousers.service: Control process exited, code=exited, status=30/n/a
Feb 10 04:04:56 blueray-i5 systemd[1]: trousers.service: Failed with result 'exit-code'.
Feb 10 04:04:56 blueray-i5 systemd[1]: Failed to start LSB: starts tcsd.
どうですか?
答え1
OPのコメントここ、コードを受けたい場所ここそしてもう少し簡潔な形で書き直してください。
外部サイトからコードが消える場合に備えて、ここでコードを繰り返します。
if [ ! -e /dev/tpmrm ]
then
log_warning_msg "device driver not loaded, skipping."
exit 0
fi
for tpm_dev in /dev/tpmrm; do
TPM_OWNER=$(stat -c %U $tpm_dev)
if [ "x$TPM_OWNER" != "xtss" ]
then
log_warning_msg "TPM device owner for $tpm_dev is not 'tss', this can cause problems."
fi
done
if [ ! -e /dev/tpm0 ]
then
log_warning_msg "device driver not loaded, skipping."
exit 0
fi
for tpm_dev in /dev/tpm0; do
TPM_OWNER=$(stat -c %U $tpm_dev)
if [ "x$TPM_OWNER" != "xtss" ]
then
log_warning_msg "TPM device owner for $tpm_dev is not 'tss', this can cause problems."
fi
done
書式を並べ替え、単一ループで書き換えます。
for tpm_dev in /dev/tpmrm /dev/tpm0; do
if [ ! -e "$tpm_dev" ]; then
log_warning_msg "device driver not loaded, skipping."
continue
fi
TPM_OWNER=$(stat -c %U "$tpm_dev")
if [ "$TPM_OWNER" != "tss" ]; then
log_warning_msg "TPM device owner for $tpm_dev is not 'tss', this can cause problems."
fi
done
exit 0
デバイスファイルが存在しない場合は、元のインクルードスクリプトを実行し続ける必要があるかどうかはわかりません。次のデバイスパスにスキップを使用することを選択しましたcontinue
(メッセージに「スキップ」とマークされているため)。
私が変更した唯一のことは、2番目のテストで未使用のガードを削除し、欠落している二重引用符のx
セットを追加したことです。
または以下なしcontinue
:
for tpm_dev in /dev/tpmrm /dev/tpm0; do
if [ -e "$tpm_dev" ]; then
TPM_OWNER=$(stat -c %U "$tpm_dev")
if [ "$TPM_OWNER" != "tss" ]; then
log_warning_msg "TPM device owner for $tpm_dev is not 'tss', this can cause problems."
fi
else
log_warning_msg "device driver not loaded, skipping."
fi
done
答え2
ユーザーが答えた内容です。ミニクス存在するスタックオーバーフロー:
この特定のエラーメッセージに対する答えは、そのスクリプトが切断されたことです/etc/init.d/trousers
。
問題のある32行目:
31:
32: if [ ! -e /dev/tpm* ]
33: then
次に拡張:
if [ ! -e /dev/tpm /dev/tpm0 ]
エラーが発生します。この行を次に変更します。
31:
32: if [ ! -e /dev/tpm ] && [ ! -e /dev/tpm0 ]
33: then
少なくともスクリプトが機能するようにしてください。
答え3
if [ ! -e /dev/tpmrm ]
then
log_warning_msg "device driver not loaded, skipping."
exit 0
fi
for tpm_dev in /dev/tpmrm; do
TPM_OWNER=$(stat -c %U $tpm_dev)
if [ "x$TPM_OWNER" != "xtss" ]
then
log_warning_msg "TPM device owner for $tpm_dev is not 'tss', this can cause problems."
fi
done