Linux 系统的休眠(Hibernation)与恢复(Resume)可能需要额外的设置才能生效。此外,笔记本上的 Linux 系统从睡眠(Suspend)中恢复后,可能出现键盘(以及触摸板)无法使用的情况。
参考:
- Not restoring after hibernating - Support - Manjaro Linux Forum
- Power management/Suspend and hibernate - ArchWiki
- Laptop/Touchpad not detected at all - ArchWiki
- What does the ‘i8042.nomux=1’ kernel option do during booting of Ubuntu? - StackExchange
睡眠与休眠
- Suspend to RAM (aka suspend, aka sleep)
- The S3 sleeping state as defined by ACPI. Works by cutting off power to most parts of the machine aside from the RAM, which is required to restore the machine’s state. Because of the large power savings, it is advisable for laptops to automatically enter this mode when the computer is running on batteries and the lid is closed (or the user is inactive for some time).
- Suspend to disk (aka hibernate)
- The S4 sleeping state as defined by ACPI. Saves the machine’s state into swap space and completely powers off the machine. When the machine is powered on, the state is restored. Until then, there is zero power consumption.
- Suspend to both
- A hybrid of the aforementioned methods, sometimes called hybrid suspend. Saves the machine’s state into swap space, but does not power off the machine. Instead, it invokes usual suspend to RAM. Therefore, if the battery is not depleted, the system can resume from RAM. If the battery is depleted, the system can be resumed from disk, which is much slower than resuming from RAM, but the machine’s state has not been lost.
配置休眠与恢复
Since systemd v255 and mkinitcpio v38, when the system is running on UEFI, systemd-sleep(8) will automatically pick a suitable swap space to hibernate into, and the information of the used swap space is stored in HibernateLocation EFI variable. Upon next boot, systemd-hibernate-resume(8) reads the location off the EFI variable and the system resumes. This means the following steps are not necessary unless the system is using legacy BIOS or you want to choose a different swap space from the automatically-selected one. 从 systemd v255 和 mkinitcpio v38 开始,当系统在 UEFI 上运行时,systemd-sleep(8) 会自动选择合适的交换空间进入休眠状态,并且已使用的交换空间信息存储在 HibernateLocation EFI 变量中。下次启动时,systemd-hibernate-resume(8) 从 EFI 变量中读取位置,然后系统恢复。这意味着以下步骤不是必需的,除非系统使用的是传统 BIOS,或者您想从自动选择的交换空间中选择不同的交换空间。
|
|
配置 initramfs
编辑 /etc/mkinitcpio.conf
文件,添加 resume
钩子(确保在 udev
后面):
|
|
执行以下命令重新生成 initramfs:
|
|
添加内核参数
向 GRUB_CMDLINE_LINUX
中添加 resume
参数,通过 UUID 指定恢复所使用的交换设备,如:
|
|
交换分区的 UUID 可以通过 lsblk -f
查看。
执行以下命令更新 grub.cfg
文件:
|
|
其他问题
如果 swap 分区/文件不够大,或者想提升恢复速度,可以参考 About swap partition/file size。
如果没有剩余的空间可作为 swap 分区,可考虑 swap 文件。
休眠与键盘(及触摸板)
https://www.reddit.com/r/archlinux/comments/1aofvwz/unresponsive_keyboard_after_wake_from_suspend/
https://askubuntu.com/questions/38797/keyboard-not-working-after-suspend-to-ram-sleep
https://askubuntu.com/questions/38797/keyboard-not-working-after-suspend-to-ram-sleep
其他可能的解决方法
锁屏或从睡眠中恢复后显示空白的黑色界面
鼠标可用,可选中中间不可见的密码框并输入密码解锁。