systemd-tmpfiles 无法启动

systemd-tmpfiles 无法启动

上次更新后出现一个问题:systemd-tmpfiles 无法启动(因此没有临时目录并且某些服务无法启动)。

root@myserver:/# journalctl -b 0 -u systemd-tmpfiles-setup.service
-- Logs begin at Ср 2018-11-21 01:00:51 MSK, end at Ср 2018-11-21 11:45:01 MSK. --
ноя 21 01:01:04 myserver systemd[1]: Starting Create Volatile Files and Directories...
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/log, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/lib, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/sendsigs.omit.d, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/lock/subsys, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/lock/lvm, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/lvm, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/cache, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/cache/man, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/php, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/rpcbind, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/rpcbind/rpcbind.xdr, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/rpcbind/portmap.xdr, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/samba, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/run/screen, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/run/sshd, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/run/sudo, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/run/sudo/ts, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/nologin, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/user, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/utmp, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/ask-password, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/seats, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/sessions, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/users, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/machines, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/shutdown, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/netif, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/netif/links, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/systemd/netif/leases, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /run/log, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/lib/systemd, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/lib/systemd/coredump, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/log/wtmp, refusing.
ноя 21 01:01:04 myserver systemd-tmpfiles[1040]: Unsafe symlinks encountered in /var/log/btmp, refusing.
ноя 21 01:01:04 myserver systemd[1]: systemd-tmpfiles-setup.service: Main process exited, code=exited, status=1/FAILURE
ноя 21 01:01:04 myserver systemd[1]: Failed to start Create Volatile Files and Directories.
ноя 21 01:01:04 myserver systemd[1]: systemd-tmpfiles-setup.service: Unit entered failed state.
ноя 21 01:01:04 myserver systemd[1]: systemd-tmpfiles-setup.service: Failed with result 'exit-code'.

我试图运行单独的配置文件

root@myserver:/# systemd-tmpfiles --create /usr/lib/tmpfiles.d/sshd.conf
Unsafe symlinks encountered in /var/run/sshd, refusing.

/var/run/sshd 是空的。根本没有符号链接。

我不知道这是什么意思,也不知道该如何解决。欢迎提出任何建议。

root@myserver:/# uname -a
Linux myserver 4.4.0-139-generic #165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

答案1

我今天在工作站 ubuntu 18.04.1 上遇到了完全相同的问题。最后(搜索 systemd 源代码)我发现,不知何故我的根文件夹 = / 所有权已更改为我 - 唯一的用户。简单chown root.root /解决了问题 :) ... 经过大约 2 小时的搜索。

答案2

也碰到了这个问题。

除了上面的答案之外,您需要确保整个路径属于root,而不仅仅是/。不知何故,我的/var文件夹获得了 (干得好,mysql) 的所有者mysql,而 sshd 试图创建/var/run/sshd,但失败了。

答案3

$ CD /

$ ll (此处如果您看到 ./ 有除 root 以外的任何名称,则执行)

$ sudo chown root.root /

您应该会看到一个正常的提示,没有消息。现在,如果您这样做:

$ sudo apt remove(有问题的包)-然后执行

$ sudo apt install (与上面相同的包或工具)。

该错误应该会消失并且现在一切都应该正常。

答案4

这是一个解决方法。我通过手动创建 /run/sshd 路径解决了这个问题

sudo mkdir /run/ssh
sudo chown root:root /run/ssh

再见

相关内容