在无头嵌入式计算机上(在只读文件系统上启动),我发现这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
:
由于
systemd-tmpfiles-setup.service
在/usr/lib/systemd/...
我使用文章“三级关闭”中的“屏蔽”技术中定义:我做了
systemd-tmpfiles-setup.service
如果有一个“更聪明的解决方案”即使在只读系统上也可以工作,我仍然很感兴趣,而无需等待 4 秒。欢迎在评论或其他答案中提出想法!