无法重新启动 motd-news.service

无法重新启动 motd-news.service

我在 vagrant box(Homestead)上启动 ubuntu 16.04.6 时收到一条消息说,无法重新启动 motd-news.service。

尝试让消息消失,但不知道该怎么做。也找不到任何与 motd(每日消息)相关的软件包。

希望得到一些指导

答案1

失败的原因通常是因为采取了强化系统的措施。它会因为缺少权限而失败。

root@foobar-sys01:/home/mike# systemctl status motd-news.service
● motd-news.service - Message of the Day
     Loaded: loaded (/lib/systemd/system/motd-news.service; static; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2024-03-29 04:05:29 UTC; 26min ago
TriggeredBy: ● motd-news.timer
       Docs: man:update-motd(8)
   Main PID: 2387022 (code=exited, status=203/EXEC)

Mar 29 04:05:29 foobar-sys01 systemd[1]: Starting Message of the Day...
Mar 29 04:05:29 foobar-sys01 systemd[2387022]: motd-news.service: Failed to execute command: Permission denied
Mar 29 04:05:29 foobar-sys01 systemd[2387022]: motd-news.service: Failed at step EXEC spawning /etc/update-motd.d/50-motd-news: Permission denied
Mar 29 04:05:29 foobar-sys01 systemd[1]: motd-news.service: Main process exited, code=exited, status=203/EXEC
Mar 29 04:05:29 foobar-sys01 systemd[1]: motd-news.service: Failed with result 'exit-code'.
Mar 29 04:05:29 foobar-sys01 systemd[1]: Failed to start Message of the Day.

如果您只是禁用 motd 服务,systemd 计时器仍将尝试执行其操作,并且该单元将失败。

如果您想要更高级的功能,您可以这样做。该--now标志指示systemctl停止服务的所有当前正在运行的实例。

systemctl disable --now motd-news.service motd-news.timer && systemctl daemon-reload

或者直接这样做:

systemctl disable motd-news.service
systemctl disable motd-news.timer
systemctl daemon-reload

然后运行这些:

systemctl reset-failed
systemctl status

相关内容