两种选择
第一个选项(列出的第二个选项)是检查journalctl
与休眠有关的可能错误消息。如果第一个选项没有产生结果,第二个选项是创建一个包装脚本,该脚本替换pm-hibernate
为“休眠”。
创建包装器脚本
创建包装器脚本可以hibernate
替换pm-hibernate
。
查找目录命令位于
在创建包装器脚本之前,您需要知道hibernate
和pm-hibernate
命令驻留在哪个目录中。使用以下两个命令:
$ locate bin/hibernate
/mnt/c/Program Files (x86)/CyberPower PowerPanel Business Edition/bin/hibernate.dll
$ locate bin/pm-hibernate
/mnt/clone/usr/sbin/pm-hibernate
/mnt/old/usr/sbin/pm-hibernate
/usr/sbin/pm-hibernate
您要创建的包装脚本将为/usr/sbin/pm-hibernate
。我没有hibernate
安装软件包,因此第一次搜索仅找到Windows实用程序。根据软件包文件清单,它应该/usr/sbin/hibernate
与其他几个文件一起显示。
备份原始文件
首先,我们要对原始文件进行在线备份:
sudo cp -a /usr/sbin/pm-hibernate /usr/sbin/pm-hibernate.bak
接下来删除原始文件:
sudo rm -f /usr/sbin/pm-hibernate
创建包装器脚本
注:而不是一个包装脚本很多人觉得它更容易地创建符号链接pm-hibernate
到hibernate
:如何创建一个软或符号链接?
我喜欢gedit
用于编辑,但是您可以将其替换为nano
或vim
或任意一个喜欢的编辑器:
sudo -H gedit /usr/sbin/pm-hibernate
将出现一个空文件。粘贴以下几行
#!/bin/bash
# Wrapper script to replace pm-hibernate with hibernate package
/usr/sbin/hibernate "$@"
将包装器脚本转换为可执行文件
当前,包装脚本是常规文件。我们需要将其转换为可执行对象:
sudo chmod a+x /usr/sbin/pm-hibernate
现在,我们有了一个可操作的包装器脚本,因此每次pm-hibernate
都称为hibernate
运行。如顶部journalctl
所述,在创建包装器脚本之前,您应该先复习一下(随后说明)。
评论 journalctl
您可以grep
在以下休眠消息journalctl
解决可能的问题。
我不使用休眠,但我使用暂停。以下命令使我可以查看与suspend
您将替换为的所有消息hibernate
:
$ journalctl -b | grep -i suspend
Oct 09 22:26:33 alien eyesome[21740]: Lid Open/Close: Wait 3 seconds to see if suspending
Oct 09 22:26:48 alien systemd[1]: Starting TLP suspend/resume...
Oct 09 22:26:48 alien systemd[1]: Started TLP suspend/resume.
Oct 09 22:26:48 alien systemd[1]: Starting Suspend...
Oct 09 22:26:48 alien systemd-sleep[22938]: /lib/systemd/system-sleep/sound: Going to suspend...
Oct 09 22:26:48 alien eyesome[22952]: Wakeup: Going to suspend. Creating: /tmp/eyesome-is-suspending
Oct 09 22:26:49 alien systemd-sleep[22938]: Suspending system...
Oct 10 04:26:38 alien kernel: PM: Suspending system (mem)
Oct 10 04:26:38 alien kernel: Suspending console(s) (use no_console_suspend to debug)
Oct 10 04:26:38 alien kernel: PM: suspend of devices complete after 1142.044 msecs
Oct 10 04:26:38 alien kernel: PM: late suspend of devices complete after 19.766 msecs
Oct 10 04:26:38 alien kernel: PM: noirq suspend of devices complete after 61.505 msecs
Oct 10 04:26:38 alien kernel: Suspended for 21583.011 seconds
Oct 10 04:26:38 alien eyesome[23137]: Lid Open/Close: Wait 3 seconds to see if suspending
Oct 10 04:26:38 alien systemd-sleep[22938]: /lib/systemd/system-sleep/sound: Waking up from suspend...
Oct 10 04:26:38 alien eyesome[23168]: Wakeup: Called from suspend.
Oct 10 04:26:41 alien systemd[1]: Started Suspend.
Oct 10 04:26:41 alien systemd[1]: Stopping TLP suspend/resume...
Oct 10 04:26:41 alien systemd[1]: Reached target Suspend.
Oct 10 04:26:41 alien systemd[1]: suspend.target: Unit is bound to inactive unit systemd-suspend.service. Stopping, too.
Oct 10 04:26:41 alien systemd[1]: Stopped target Suspend.
Oct 10 04:26:42 alien systemd[1]: Stopped TLP suspend/resume.
Oct 10 04:26:52 alien eyesome[24459]: Daemon: Removed file: /tmp/eyesome-is-suspending
Oct 10 05:47:09 alien eyesome[12434]: Lid Open/Close: Wait 3 seconds to see if suspending
Oct 10 05:51:43 alien systemd[1]: Starting TLP suspend/resume...
Oct 10 05:51:44 alien systemd[1]: Started TLP suspend/resume.
Oct 10 05:51:44 alien systemd[1]: Starting Suspend...
Oct 10 05:51:44 alien systemd-sleep[28353]: /lib/systemd/system-sleep/sound: Going to suspend...
Oct 10 05:51:44 alien eyesome[28367]: Wakeup: Suspending. Creating /tmp/eyesome-is-suspending
Oct 10 05:51:45 alien systemd-sleep[28353]: Suspending system...
Oct 10 16:30:59 alien kernel: PM: Suspending system (mem)
Oct 10 16:30:59 alien kernel: Suspending console(s) (use no_console_suspend to debug)
Oct 10 16:30:59 alien kernel: PM: suspend of devices complete after 623.519 msecs
Oct 10 16:30:59 alien kernel: PM: late suspend of devices complete after 19.654 msecs
Oct 10 16:30:59 alien kernel: PM: noirq suspend of devices complete after 61.549 msecs
Oct 10 16:30:59 alien kernel: Suspended for 38348.943 seconds
Oct 10 16:30:59 alien eyesome[28563]: Lid Open/Close: Wait 3 seconds to see if suspending
Oct 10 16:30:59 alien systemd-sleep[28353]: /lib/systemd/system-sleep/sound: Waking up from suspend...
Oct 10 16:30:59 alien eyesome[28599]: Wakeup: Called from suspend.
Oct 10 16:31:02 alien systemd[1]: Started Suspend.
Oct 10 16:31:02 alien systemd[1]: Stopping TLP suspend/resume...
Oct 10 16:31:02 alien systemd[1]: Reached target Suspend.
Oct 10 16:31:02 alien systemd[1]: suspend.target: Unit is bound to inactive unit systemd-suspend.service. Stopping, too.
Oct 10 16:31:02 alien systemd[1]: Stopped target Suspend.
Oct 10 16:31:03 alien systemd[1]: Stopped TLP suspend/resume.
Oct 10 16:31:13 alien eyesome[30020]: Daemon: Removed file: /tmp/eyesome-is-suspending