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.
配置休眠与恢复
配置 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 文件。
睡眠与键盘(及触摸板)
向 GRUB_CMDLINE_LINUX
添加一个或多个以下内核参数可能会有所帮助(添加方法同上):
|
|
关于 i8042.nomux
与 i8042.reset
的说明,可参考 StackExchange 上的这个问题。完整内核参数及说明参考回答中提到的这篇文档。