누락 된 시스템 장치를 제거하는 방법? 여전히 다음 유닛이 남아 있습니다. core@ip-172-16-32-83 ~

더 이상 파일이없는 시스템 장치를 제거하는 방법을 알아내는 데 문제가 있습니다. 그들은 여전히 ​​시스템에 남아있는 것처럼 보입니다.

내가 제거하려고하는 오래된 깨진 단위 :

core@ip-172-16-32-83 ~ $ systemctl list-units --all firehose-router*
  UNIT                       LOAD      ACTIVE SUB    DESCRIPTION
<E2><97><8F> firehose-router@02.service not-found failed failed firehose-router@02.service
<E2><97><8F> firehose-router@03.service not-found failed failed firehose-router@03.service

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

2 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.

파일이 존재하지 않지만 재로드에는 여전히 다음 유닛이 남아 있습니다.

core@ip-172-16-32-83 ~ $ systemctl list-unit-files firehose-router@02.service
core@ip-172-16-32-83 ~ $ sudo systemctl daemon-reload
core@ip-172-16-32-83 ~ $ systemctl list-units --all firehose-router*
  UNIT                       LOAD      ACTIVE SUB    DESCRIPTION
<E2><97><8F> firehose-router@02.service not-found failed failed firehose-router@02.service
<E2><97><8F> firehose-router@03.service not-found failed failed firehose-router@03.service

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

2 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.

찾을 수있는 관련 파일이 없습니다.

core@ip-172-16-32-83 ~ $ sudo find /var/run/systemd -name "*firehose-router*"
core@ip-172-16-32-83 ~ $ find /etc/systemd/ -name "*firehose-router*"
core@ip-172-16-32-83 ~ $ find /usr/lib/systemd/ -name "*firehose-router*"
core@ip-172-16-32-83 ~ $

그렇다면 어떻게 제거합니까?



답변

당신이 따르는 명령은 systemctl reset-failed


답변

systemd는 장치 정의 파일을 분석 할 때 파일에서 호출 된 다른 관련 장치 (기타 장치의 존재 여부)를 기록합니다.

$ systemctl --state=not-found --all
> ( ...prints list of 'not-found' units )

$ grep -r "<missing-unit>" /usr/lib/systemd/system
> ( returns files with references to <missing-unit> )

단위가 “찾을 수 없음”으로 표시 될 때 반드시 오류 일 필요는 없습니다. 지역 단위 정의는 해당 단위와 관계가 있다고 주장합니다. 이 관계는 우리가 신경 쓰지 않을 수도 있습니다. 예를 들어, "Before:"다른 단위 일 수 있지만 다른 단위는 사용하지 않습니다.


답변

systemd는 링크를 유지하지만 장치 파일을 삭제할 때 어떻게해야하는지 알지 못하는 것 같습니다.

수동으로 제거 할 수는 /etc/systemd/system/suspend.target.wants/있지만 systemctl reset-failed이전 답변에서 더 나은 옵션처럼 들립니다.

$ cd /etc/systemd/system
$ sudo mv lock.service /tmp
$ sudo systemctl disable lock.service
Failed to disable unit: No such file or directory
$ sudo mv /tmp/lock.service .
$ sudo systemctl disable lock.service
Removed /etc/systemd/system/suspend.target.wants/lock.service.


답변