【问题标题】:Automatic reboot on systemd emergency mode?在 systemd 紧急模式下自动重启?
【发布时间】:2020-05-29 10:23:46
【问题描述】:

是否有可能,当systemd进入紧急模式时,不是提示:

You are in emergency mode. After logging in, type "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, "systemctl default" or "exit"
to boot into default mode.
Press Enter for maintenance
(or press Control-D to continue): 

等待用户输入,延迟后自动重启?

这在我的情况下是必需的,因为我正在努力将操作系统回滚到以前的状态,以防启动失败。

无论当前操作系统尝试启动时出现什么问题,都会发生这种情况。我还没有找到任何关于此的信息,所以任何建议都会有所帮助!

谢谢

【问题讨论】:

    标签: updates systemd boot reboot systemctl


    【解决方案1】:

    嗯,我找到了一种方法来做我想做的事。我已经用systemctl edit emergency.service 覆盖了紧急服务并添加了:

    [Service]
    ExecStartPre=/bin/sh -c "read -t 30 || /bin/systemctl reboot"
    

    它将等待用户输入进入紧急模式。否则,系统会重新启动。

    这也适用于救援模式,通过 systemctl edit rescue.service

    【讨论】:

      猜你喜欢
      • 2015-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-04
      • 1970-01-01
      • 2021-12-17
      • 2018-07-07
      • 2012-08-14
      相关资源
      最近更新 更多