tuk*_*tuk 5 init systemd 16.04
在 ubuntu 16.04.6 上尝试屏蔽 systemd 服务。我看到如下错误。
systemctl mask hadoop-hdfs-zkfc.service
Failed to activate service 'org.freedesktop.systemd1': timed out
Run Code Online (Sandbox Code Playgroud)
我使用的是 Ubuntu 16.04.6 附带的默认 systemd 版本。
ubuntu@platform1:~$ systemctl --version
systemd 229
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP
+LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS
+KMOD -IDN
Run Code Online (Sandbox Code Playgroud)
这个问题并不总是出现。但一旦遇到此问题,恢复 systemd 的唯一方法就是进行硬重启。
查看系统日志,系统似乎已中止。
May 18 08:49:24 platform3 systemd[1]: Removed slice User Slice of support.
May 18 08:49:27 platform3 systemd[1]: Assertion 's->type ==
SERVICE_ONESHOT' failed at ../src/core/service.c:1792, function
service_enter_start(). Aborting.
May 18 08:49:27 platform3 systemd[1]: Caught <ABRT>, dumped core as pid 15839.
May 18 08:49:27 platform3 systemd[1]: Freezing execution.
Run Code Online (Sandbox Code Playgroud)
busctl输出如下所示
ubuntu@platform3:~/logs$ busctl
NAME PID PROCESS USER CONNECTION UNIT SESSION DESCRIPTION
:1.1 976 systemd-logind root :1.1 systemd-logind.service - -
:1.3 971 accounts-daemon root :1.3 accounts-daemon.service - -
:1.5434 49174 systemctl root :1.5434 cron.service - -
:1.5435 49223 systemctl root :1.5435 ssh.service - -
:1.5436 49408 busctl ubuntu :1.5436 ssh.service - -
:1.7 1109 unattended-upgr root :1.7 unattended-upgrades.se... - -
com.ubuntu.LanguageSelector - - - (activatable) - -
org.debian.AptXapianIndex - - - (activatable) - -
org.freedesktop.Accounts 971 accounts-daemon root :1.3 accounts-daemon.service - -
org.freedesktop.DBus 936 dbus-daemon messagebus org.freedesktop.DBus dbus.service - -
org.freedesktop.hostname1 - - - (activatable) - -
org.freedesktop.locale1 - - - (activatable) - -
org.freedesktop.login1 976 systemd-logind root :1.1 systemd-logind.service - -
org.freedesktop.network1 - - - (activatable) - -
org.freedesktop.resolve1 - - - (activatable) - -
org.freedesktop.systemd1 - - - (activatable) - -
org.freedesktop.thermald - - - (activatable) - -
org.freedesktop.timedate1 - - - (activatable) - -
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我,如何调试这个吗?
该问题看起来与此处讨论的问题类似。那么这是 Ubuntu 16.04.6 上的一些已知的 systemd 问题吗?
通过查看您上面发布的busctl调用的输出可以清楚地看出,您的org.freedesktop.systemd1守护进程(init.scope单元)实际上并不活动:
org.freedesktop.systemd1 - - - (activatable) - -
Run Code Online (Sandbox Code Playgroud)
但是它可能会像这样被激活:
$ systemctl daemon-reexec
Run Code Online (Sandbox Code Playgroud)
或这个:
$ sudo kill 1
Run Code Online (Sandbox Code Playgroud)
这应该要求 systemd 以更坚定的方式 - 通过向 systemd 发送 SIGTERM 信号,基本上执行相同的操作 - 运行 daemon-reexec。在耗尽所有可用 RAM 而系统上没有交换文件后,我遇到了一个类似的问题。重新执行 systemd 守护进程完全为我解决了这个问题,而无需重新启动机器(尽管在此之前,如果问题是按照与我的情况相同的方式引起的,则需要杀死一些用户进程以释放一些 RAM)。正如 systemd 手册页中所述,daemon-reexec 可以保存使用:
daemon-reexec
Reexecute the systemd manager. This will serialize the manager
state, reexecute the process and deserialize the state again. This
command is of little use except for debugging and package upgrades.
Sometimes, it might be helpful as a heavy-weight daemon-reload.
While the daemon is being reexecuted, all sockets systemd listening
on behalf of user configuration will stay accessible.
Run Code Online (Sandbox Code Playgroud)
这个问题已经在 systemd 邮件列表中得到了解答。交叉发布答案
此错误(https://github.com/systemd/systemd/issues/4444)已在 systemd v236 中修复。
看看是否可以使用较新版本的 systemd。