바지 서비스를 시작할 수 없습니다. - 오류 "TrouSerS ioctl: (25) 장치에 부적절한 ioctl이 있습니다."

바지 서비스를 시작할 수 없습니다. - 오류 "TrouSerS ioctl: (25) 장치에 부적절한 ioctl이 있습니다."

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(메시지에 "건너뛰기"라고 표시되어 있기 때문).

내가 변경한 유일한 다른 사항은 두 번째 테스트에서 사용되지 않는 경비원을 제거 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

관련 정보