从休眠状态唤醒后 grub-common 不可用

从休眠状态唤醒后 grub-common 不可用

我看到,正常启动后,grub-common 取消设置 recordfail 并进入退出状态(我不再看到该进程在运行)。

在我休眠并唤醒系统(系统正确唤醒)后,由于 grub-common 没有运行,所以 recordfail 一直存在。我认为 grub-common 应该作为守护进程运行,并且不应该退出。

有没有办法通过改变 grub-common.service 参数来实现这一点?

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/grub-common
Description=LSB: Record successful boot for GRUB
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/grub-common start
ExecStop=/etc/init.d/grub-common stop

由于 recordfail 未取消设置,因此下一次唤醒将在 grub 处停止。我的解决方法是在 grub.cfg 中设置 recordfail_timeout=0,但我希望有一个可以正常工作(不处于退出状态)的 grub-common,它可以取消设置 grubenv 中的 recordfail,就像它应该做的那样。

进程详情:Grub 始终设置 recordfail(从休眠状态唤醒时也是如此)grub-common 在启动(或唤醒)正确结束后取消设置。如果 grub-common 在唤醒后未运行,则 recordfail 会继续退出(我在 grub-editenv 列表中看到它)。这意味着下次从休眠状态唤醒时,GRUB 会在 grubenv 中找到 recordfail 并在菜单中停止(除非您设置 recordfail_tim.eout=0。但...这不是问题。问题是 grub-common.service 为何退出。如果服务继续运行,他会取消 grubenv 中的 recordfail。
(我已经测试过:手动停止并启动 grub-common,grubenv 中的 recordfail 条目消失)。

作为简历:有人知道如何用守护进程角色启动服务吗?(不是退出而是保持活力和活力)

答案1

这与我的想法不同。原因是在 Ubuntu 15.04 之后,init 进程与 systemd 一起工作,后者使用系统单元进行启动进程。在https://ubuntuforums.org/showthread.php?t=2333934您可能会找到一个教程,介绍如何设置系统单元,以便在成功恢复休眠状态后取消设置记录失败。我还看到规范团队正在将旧服务迁移到 systemd,所以我希望在不久的将来他们会提供“官方”解决方案

相关内容