问题描述
在电源选项内,点击休眠后所有程序暂停,鼠标卡死。等待两秒钟后无视发生,像没点击一样。
软件版本
- Linux内核:6.16.8+
- 发行版:Debian13.1
- 英伟达驱动:闭源 580.65.06
- 会话:XFCE4 + Xorg
问题解决过程
解决无法进入休眠
异常的日志如下:
░░ Subject: 系统已进入 hibernate 睡眠状态
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ 系统现已进入 hibernate 睡眠状态。
10月 19 17:58:29 moonlight kernel: PM: hibernation: hibernation entry
10月 19 17:58:32 moonlight kernel: Filesystems sync: 0.126 seconds
10月 19 17:58:32 moonlight kernel: Freezing user space processes
10月 19 17:58:32 moonlight kernel: Freezing user space processes completed (elapsed 0.001 seconds)
10月 19 17:58:32 moonlight kernel: OOM killer disabled.
10月 19 17:58:32 moonlight kernel: PM: hibernation: Marking nosave pages: [mem 0x00000000-0x00000fff]
10月 19 17:58:32 moonlight kernel: PM: hibernation: Marking nosave pages: [mem 0x0005e000-0x0005efff]
10月 19 17:58:32 moonlight kernel: PM: hibernation: Marking nosave pages: [mem 0x000a0000-0x000fffff]
10月 19 17:58:32 moonlight kernel: PM: hibernation: Marking nosave pages: [mem 0x43917000-0x43917fff]
10月 19 17:58:32 moonlight kernel: PM: hibernation: Marking nosave pages: [mem 0x47d20000-0x4bffefff]
10月 19 17:58:32 moonlight kernel: PM: hibernation: Marking nosave pages: [mem 0x4c000000-0xffffffff]
10月 19 17:58:32 moonlight kernel: PM: hibernation: Basic memory bitmaps created
10月 19 17:58:32 moonlight kernel: PM: hibernation: Preallocating image memory
10月 19 17:58:32 moonlight kernel: PM: hibernation: Allocated 1552386 pages for snapshot
10月 19 17:58:32 moonlight kernel: PM: hibernation: Allocated 6209544 kbytes in 2.30 seconds (2699.80 MB/s)
10月 19 17:58:32 moonlight kernel: Freezing remaining freezable tasks
10月 19 17:58:32 moonlight kernel: Freezing remaining freezable tasks completed (elapsed 0.045 seconds)
10月 19 17:58:32 moonlight kernel: printk: Suspending console(s) (use no_console_suspend to debug)
10月 19 17:58:32 moonlight kernel: r8169 0000:03:00.0 enp3s0: Link is Down
10月 19 17:58:32 moonlight kernel: NVRM: GPU 0000:01:00.0: PreserveVideoMemoryAllocations module parameter is set. System Power Management attempted without driver procfs suspend interface>
10月 19 17:58:32 moonlight kernel: nvidia 0000:01:00.0: PM: pci_pm_freeze(): nv_pmops_freeze [nvidia] returns -5
10月 19 17:58:32 moonlight kernel: nvidia 0000:01:00.0: PM: dpm_run_callback(): pci_pm_freeze returns -5
10月 19 17:58:32 moonlight kernel: nvidia 0000:01:00.0: PM: failed to freeze async: error -5
10月 19 17:58:32 moonlight kernel: serial 00:03: disabled
10月 19 17:58:32 moonlight kernel: serial 00:03: activated
10月 19 17:58:32 moonlight kernel: nvme nvme1: 8/0/0 default/read/poll queues
10月 19 17:58:32 moonlight kernel: nvme nvme1: Ignoring bogus Namespace Identifiers
10月 19 17:58:32 moonlight kernel: nvme nvme0: 8/0/0 default/read/poll queues
10月 19 17:58:32 moonlight kernel: r8169 0000:03:00.0 enp3s0: Link is Down
10月 19 17:58:32 moonlight kernel: PM: hibernation: Basic memory bitmaps freed
10月 19 17:58:32 moonlight kernel: OOM killer enabled.
10月 19 17:58:32 moonlight kernel: Restarting tasks: Starting
10月 19 17:58:32 moonlight kernel: Restarting tasks: Done
10月 19 17:58:32 moonlight kernel: PM: hibernation: hibernation exit
10月 19 17:58:32 moonlight bluetoothd[736]: Controller resume with wake event 0x0
10月 19 17:58:32 moonlight joycond[908]: epoll_pwait failure
10月 19 17:58:32 moonlight systemd-sleep[19772]: Failed to put system to sleep. System resumed again: Input/output error
░░ Subject: 系统已离开 hibernate 睡眠状态
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ 系统现已离开 hibernate 睡眠状态。
观察日志得知,似乎是英伟达驱动阻止了系统休眠。导致系统恢复了原来的状态。
查阅archwiki,似乎是要设置某些内核参数。
查阅/etc/modprobe.d/nvidia.conf发现英伟达其实已经帮我设置好了。这个不用改。
# You need to run "update-initramfs -u" after editing this file.
# Nouveau must be blacklisted here as well beside from the initrd to avoid a
# delayed loading (for example on Optimus laptops where the Nvidia card is not
# driving the main display).
blacklist nouveau
# Enable complete power management. From:
# file:///usr/share/doc/nvidia-driver/html/powermanagement.html
options nvidia NVreg_TemporaryFilePath=/var/tmp
options nvidia NVreg_EnableS0ixPowerManagement=1
options nvidia NVreg_PreserveVideoMemoryAllocations=1
检查一下英伟达的系统服务,似乎被禁用了鸭。
○ nvidia-hibernate.service - NVIDIA system hibernate actions
Loaded: loaded (/usr/lib/systemd/system/nvidia-hibernate.service; disabled; preset: enabled)
Active: inactive (dead)
我管你这那的,直接全部启用。
systemctl enable nvidia-hibernate.service nvidia-suspend.service nvidia-resume.service
这样瞎整居然就好了,我也不知道为啥英伟达驱动默认要禁用这个。系统能休眠了。
解决无法唤醒
整好了能休眠我还偷着乐呢,结果开机居然直接启动了,我之前开的程序全部丢失,和全新开机一样。
开摆,问ai,ai说要加内核参数,向内核传递swap设备的具体位置。emm… 这个似乎还真得加,我的swap是直接用一块16GB的傲腾加速卡的,随便嗯造
编辑/etc/default/grub,将加速卡的UUID传递给内核,还好我是直接把整个加速卡格式化成swap的。
GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=12345678-1234-4321-1234-1234567890ab"
记得update-grub!整好了以后重启,终于休眠可以正常工作了。 ![]()
以后电脑可以不关机了,反正傲腾随便造。 ![]()