읽기 전용 파일 시스템에서 "systemd-tmpfiles-setup.service" 속도가 느림

읽기 전용 파일 시스템에서 "systemd-tmpfiles-setup.service" 속도가 느림

헤드리스 임베디드 컴퓨터(읽기 전용파일 시스템), 이 속도가 상당히 느리고 다른 서비스가 일찍 시작되지 않는 것으로 나타났습니다 systemd-tmpfiles-setup.service(확인했습니다 systemctl list-dependencies myservice.service).

읽기 전용 파일 시스템에서 속도를 높이는 방법은 무엇입니까?

journalctl -u systemd-tmpfiles-setup.service또한 거의 4초가 걸리는 것으로 확인되었습니다.

-- Logs begin at Sat 2021-12-11 01:55:43 GMT, end at Sat 2021-12-11 01:58:03 GMT. --
Dec 11 01:55:**43** foo systemd[1]: Starting Create Volatile Files and Directories...
Dec 11 01:55:**47** foo systemd-tmpfiles[149]: **rm_rf(/tmp): Read-only file system**
Dec 11 01:55:47 foo systemd-tmpfiles[149]: symlink(/etc/machine-id, /var/lib/dbus/machine-id) failed: Read-only file system
Dec 11 01:55:47 foo systemd-tmpfiles[149]: symlink(../proc/self/mounts, /etc/mtab) failed: Read-only file system
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory 'coredump': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory 'private': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory 'private': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory 'private': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory '.X11-unix': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory '.ICE-unix': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory '.XIM-unix': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory '.font-unix': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory '.Test-unix': No such file or directory
Dec 11 01:55:47 foo systemd[1]: Started Create Volatile Files and Directories.

결과는 다음과 같습니다 systemd-analyze plot.

여기에 이미지 설명을 입력하세요.

답변1

systemd-tmpfiles-setup.service의 정의 때문에 /usr/lib/systemd/...기사의 "마스킹" 기술을 사용했습니다."레벨 3":

서비스 파일을 /dev/null에 심볼릭 링크하면 systemd에 문제의 서비스를 시작하지 않고 실행을 완전히 방지하도록 지시할 수 있습니다. /etc/systemd/system에 저장된 유닛 파일은 /lib/systemd/system에 있는 동일한 이름의 유닛 파일을 덮어씁니다. 전자의 디렉터리는 관리자 영역이고 후자의 디렉터리는 패키지 관리자 영역입니다. /etc/systemd/system/ntpd.service에 심볼릭 링크를 설치하면 systemd가 업스트림에 제공된 서비스 파일 /lib/systemd/system/ntpd.service를 읽지 않도록 할 수 있습니다.

내가 해냈어

ln -s /dev/null /etc/systemd/system/systemd-tmpfiles-setup.service

systemd-tmpfiles-setup.service4초를 기다리지 않고도 읽기 전용 시스템에서도 작동하는 "더 스마트한 솔루션"이 있다면 여전히 관심이 있습니다 . 댓글이나 다른 답변에 대한 아이디어를 환영합니다!

관련 정보