你的swap不够
Not enough swap space for hibernation
8G内存,设置了12G的SWAPfile,怎么不够呢?
按ctrl + alt + esc打开系统监视器看看交换分区用上了没?
设置了12G,没有使用
控制中心里电源管理貌似有点小问题,不久前我设关闭显示器、电脑进入待机模式和自动锁屏都是30分钟,结果5分钟就息屏了,不知道现在怎么样了。
P.S. 测试可以休眠,但是再开机只能进桌面看到之前的窗口进程,系统实际卡死,过了一会儿自动重启了。感觉没啥用,缓解没有休眠按钮的强迫症 XD
我这里遇到一样的问题,之前手贱换了 btrfs 文件系统,设置了 swapfile 之后还是没有休眠按钮。
今天查了下谷歌找到原因了:grub 启动参数缺少 resume 和 resume_offset,休眠的时候找不到 swap header
https://bbs.archlinux.org/viewtopic.php?id=211144
-
执行
systemctl hibernate
,和你结果一样Failed to hibernate system via logind: Not enough swap space for hibernation
-
以 root 身份执行
echo disk > /sys/power/state
看看能不能休眠,我这里休眠后自动唤醒了。执行sudo tail -100f /var/log/kern.log
查看内核日志,发现错误PM: Swap header not found!
-
根据 ArchLinux 论坛的帖子,以 root 身份执行
filefrag -v /swapfile绝对路径 | awk '{if($1=="0:"){print $4}}'
获取到 swapfile 的偏移量;执行blkid
获取根目录分区的 UUID -
修改
/etc/default/grub
,在$GRUB_CMDLINE_LINUX_DEFAULT
中添加以下内容:resume=UUID=上面获取的根目录分区UUID resume_offset=上面获取的swapfile偏移量
-
执行
sudo update-grub
更新 grub 启动菜单,重启之后我这里就能显示休眠按钮了
Popular Ranking
ChangePopular Events
More
Tasks: 193 total, 2 running, 190 sleeping, 0 stopped, 1 zombie
%Cpu(s): 16.2 us, 5.9 sy, 0.0 ni, 77.7 id, 0.2 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 7701.0 total, 4796.5 free, 1112.3 used, 1792.2 buff/cache
MiB Swap: 12288.0 total, 12288.0 free, 0.0 used. 6171.4 avail Mem
sunny@SUNNY-DEEP:~$ sudo systemctl hibernate
Failed to hibernate system via logind: Not enough swap space for hibernation
ystem: Host: SUNNY-DEEP Kernel: 5.18.17-amd64-desktop-community-hwe x86_64 bits: 64 Desktop: Deepin 20.8
Distro: Deepin 20.8
Machine: Type: Laptop System: Apple product: Macmini3,1 v: 1.0 serial:
Mobo: Apple model: Mac-F22C86C8 serial: UEFI: Apple v: MM31.88Z.00AD.B00.0907171535 date: 07/17/09
CPU: Topology: Dual Core model: Intel Core2 Duo P7550 bits: 64 type: MCP L2 cache: 3072 KiB
Speed: 1592 MHz min/max: 1596/2261 MHz Core speeds (MHz): 1: 1592 2: 1592
Graphics: Device-1: NVIDIA C79 [GeForce 9400] driver: N/A
Display: x11 server: X.Org 1.20.11 driver: fbdev,nouveau unloaded: modesetting,vesa resolution: 1920x1080~77Hz
OpenGL: renderer: llvmpipe (LLVM 13.0.1 128 bits) v: 4.5 Mesa 21.3.8
Audio: Device-1: NVIDIA MCP79 High Definition Audio driver: snd_hda_intel
Sound Server: ALSA v: k5.18.17-amd64-desktop-community-hwe
Network: Device-1: NVIDIA MCP79 Ethernet driver: forcedeth
IF: enp0s10 state: up speed: 100 Mbps duplex: full mac: d4:9a:20:ef:1d:be
Device-2: Broadcom and subsidiaries BCM4321 802.11a/b/g/n driver: wl
IF: wlp3s0 state: dormant mac: 90:84:0d:f2:d4:e4
IF-ID-1: uengine0 state: down mac: d6💿0d:91:6d:5b
Drives: Local Storage: total: 119.24 GiB used: 95.23 GiB (79.9%)
ID-1: /dev/sda vendor: Samsung model: MZ7PD128HAFV-000H7 size: 119.24 GiB
Partition: ID-1: / size: 58.10 GiB used: 27.11 GiB (46.7%) fs: ext4 dev: /dev/sda3
Sensors: System Temperatures: cpu: 54.0 C mobo: N/A
Fan Speeds (RPM): N/A
Info: Processes: 196 Uptime: 24m Memory: 7.52 GiB used: 1.10 GiB (14.7%) Shell: bash inxi: 3.0.32