Debian 8 休眠和挂起不起作用

Debian 8 休眠和挂起不起作用

我已经阅读了关于此事的两个官方文件:

我尝试编写这个简单的脚本来查看是否有任何功能:

我已经安装了他们在帖子中提到的所有软件包。

# /etc/pm/sleep.d/suspend.sh
#
# The /etc/pm/sleep.d is the right place to put your custom suspend/resume scripts.
# None of the stuff in /etc/hibernate/ has _any_ effect (OnResume, RestartServices,
# UnloadModules etc). The /etc/init.d/atheros script is just a simple wrapper for
# unloading the ath_pci module.

case "$1" in
        hibernate|suspend)
        logger went to hibernate or suspend!
                ;;
        thaw|resume)
        logger resumed from hibernation or suspend!
                ;;
        *) exit $NA
                ;;
esac

无记录器输出。

然后我编辑了这个文件:/etc/acpi/lid.sh

并添加了这段代码

grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
  rfkill block all && hibernate -k -f
else
  rfkill unblock all
fi

如果我尝试似乎有效的暂停按钮,笔记本电脑会进入睡眠状态,并在按下电源按钮一段时间后唤醒。检查日志我看到这些消息涉及暂停。

Dec 14 00:25:16 host systemd[1]: Configuration file /etc/systemd/system/suspend-sedation.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Dec 14 00:25:16 host systemd[1]: Configuration file /etc/systemd/system/suspend-sedation.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Dec 14 00:25:35 host systemd[1]: Configuration file /etc/systemd/system/suspend-sedation.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Dec 14 00:25:35 host systemd[1]: Configuration file /etc/systemd/system/suspend-sedation.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Dec 14 00:30:22 host systemd[1]: Configuration file /etc/systemd/system/suspend-sedation.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Dec 14 00:30:22 host systemd[1]: Configuration file /etc/systemd/system/suspend-sedation.service is marked world-writable. Please remove world writability permission bits. Proceeding anyway.
Dec 14 00:30:22 host systemd[1]: Configuration file /etc/systemd/system/suspend-sedation.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Dec 14 00:30:22 host systemd[1]: Configuration file /etc/systemd/system/suspend-sedation.service is marked world-writable. Please remove world writability permission bits. Proceeding anyway.
Dec 14 00:31:43 host systemd[1]: [/etc/systemd/system/suspend-sedation.service:1] Missing '='.
Dec 14 00:31:48 host systemd[1]: [/etc/systemd/system/suspend-sedation.service:1] Missing '='.
Dec 14 00:32:11 host systemd[1]: [/etc/systemd/system/suspend-sedation.service:1] Unknown section 'unit'. Ignoring.
Dec 14 00:33:07 host systemd[1]: [/etc/systemd/system/suspend-sedation.service:1] Unknown section 'unit'. Ignoring.
Dec 14 00:36:26 host swapon[571]: swapon: /dev/sda4: software suspend data detected. Rewriting the swap signature.
Dec 14 00:36:26 host rsyslogd-2007: action 'action 17' suspended, next retry is Mon Dec 14 00:36:56 2015 [try http://www.rsyslog.com/e/2007 ]
Dec 14 00:41:38 host swapon[588]: swapon: /dev/sda4: software suspend data detected. Rewriting the swap signature.
Dec 14 00:41:38 host rsyslogd-2007: action 'action 17' suspended, next retry is Mon Dec 14 00:42:08 2015 [try http://www.rsyslog.com/e/2007 ]
Dec 14 00:54:53 host swapon[561]: swapon: /dev/sda4: software suspend data detected. Rewriting the swap signature.
Dec 14 00:54:53 host rsyslogd-2007: action 'action 17' suspended, next retry is Mon Dec 14 00:55:23 2015 [try http://www.rsyslog.com/e/2007 ]
Dec 14 01:05:22 host swapon[527]: swapon: /dev/sda4: software suspend data detected. Rewriting the swap signature.
Dec 14 01:05:22 host rsyslogd-2007: action 'action 17' suspended, next retry is Mon Dec 14 01:05:52 2015 [try http://www.rsyslog.com/e/2007 ]
Dec 14 01:09:21 host kernel: [  186.002598] Suspending console(s) (use no_console_suspend to debug)
Dec 14 01:09:21 host kernel: [  186.046622] wl_suspend: PCI Suspend handler
Dec 14 01:09:21 host kernel: [  186.046631] wl_suspend: Not WOWL capable
Dec 14 01:09:21 host kernel: [  186.641662] PM: suspend of devices complete after 639.250 msecs
Dec 14 01:09:21 host kernel: [  186.642043] PM: late suspend of devices complete after 0.379 msecs
Dec 14 01:09:21 host kernel: [  186.657547] PM: noirq suspend of devices complete after 15.511 msecs


[  186.046622] wl_suspend: PCI Suspend handler
[  186.046631] wl_suspend: Not WOWL capable
[  186.641662] PM: suspend of devices complete after 639.250 msecs
[  186.642043] PM: late suspend of devices complete after 0.379 msecs
[  186.657547] PM: noirq suspend of devices complete after 15.511 msecs

现在进入冬眠状态,那似乎就直接死了。它不会保存状态,并且我收到的所有内容都会一路发送回 EFI 菜单选择器。

blubee@host:~$ sudo cat /var/log/syslog | grep "hiber"
Dec 14 00:36:26 host kernel: [    4.213177] PM: Looking for hibernation image.
Dec 14 00:41:38 host kernel: [    4.231179] PM: Looking for hibernation image.
Dec 14 00:54:53 host kernel: [    4.219918] PM: Looking for hibernation image.
Dec 14 01:05:22 host kernel: [    4.213743] PM: Looking for hibernation image.

dmesg 的输出

[    4.213743] PM: Looking for hibernation image.

顺便说一句,这台笔记本电脑有 16GB 内存,我有 32GB 交换空间,只是为了确定一下。我听说 32GB 太大了,但我只是想测试一下。

我还能做些什么来解决这个问题并使休眠功能按预期工作?

答案1

设置休眠文件

如上提到的帖子,设置休眠文件可以帮助......

  1. 查找交换分区的 uuid。假设分区是sdb3,那么

    $ ls -l /dev/disk/by-uuid/ | grep sdb3
    lrwxrwxrwx 1 root root 10 окт.   9 08:59 1dd7e123-1f82-45f0-a202-0ff3ea6f081a -> ../../sdb3
    
  2. 打开/etc/default/grub,找到以 开头的行GRUB_CMDLINE_LINUX_DEFAULT="。在引号之间添加resume=/dev/disk/by-uuid/your-swap-uuid。举个例子:

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=/dev/disk/by-uuid/1dd7e123-1f82-45f0-a202-0ff3ea6f081a"
    
  3. 以 root 身份运行update-grub

BIOS设置

我遇到的另一个问题是一些 BIOS 设置。我重新加载了BIOS默认值终于成功了

答案2

/etc/default/grub您可以通过如下方式指定图像在您的路径中的位置:

GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/sda4"

相关内容