我使用的是 Gnome 3.22.3
$ gnome-shell --version
GNOME Shell 3.22.3
有时我会遇到无法从挂起状态唤醒的问题。我得到的只是鼠标黑屏。没有什么可以带回登录屏幕,我最终不得不在关闭之前长按电源按钮几秒钟,如果时间准确,我可以唤醒系统并出现登录屏幕。但大多数时候我失败了并且系统被关闭(不正确地)。我尝试重现该情况,然后我去了 dmesg 并发现以下内容:
[ 120.135635] PM: Syncing filesystems ... done.
[ 120.319898] PM: Preparing system for sleep (mem)
[ 120.320047] (NULL device *): firmware: direct-loading firmware rtlwifi/rtl8192cfw.bin
[ 120.320056] Freezing user space processes ...
[ 140.327451] Freezing of tasks failed after 20.006 seconds (1 tasks refusing to freeze, wq_busy=0):
[ 140.327551] single D 0 1722 1058 0x00000104
[ 140.327559] Call Trace:
[ 140.327574] ? __schedule+0x3c8/0x860
[ 140.327580] ? schedule+0x32/0x80
[ 140.327587] ? io_schedule+0x12/0x40
[ 140.327595] ? generic_file_read_iter+0x3ca/0x970
[ 140.327602] ? page_cache_tree_insert+0xf0/0xf0
[ 140.327611] ? new_sync_read+0xe3/0x130
[ 140.327618] ? vfs_read+0x91/0x130
[ 140.327624] ? SyS_read+0x52/0xc0
[ 140.327632] ? do_syscall_64+0x7c/0xf0
[ 140.327640] ? entry_SYSCALL64_slow_path+0x25/0x25
[ 140.327668] OOM killer enabled.
[ 140.327670] Restarting tasks ... done.
[ 140.352997] video LNXVIDEO:00: Restoring backlight state
[ 140.353718] video LNXVIDEO:01: Restoring backlight state
[ 140.354496] PM: Syncing filesystems ... done.
[ 140.502578] PM: Preparing system for sleep (freeze)
[ 140.502718] Freezing user space processes ... (elapsed 0.149 seconds) done.
[ 140.652680] OOM killer disabled.
[ 140.652681] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 140.653866] PM: Suspending system (freeze)
[ 140.653868] Suspending console(s) (use no_console_suspend to debug)
[ 140.865006] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 140.865151] sd 0:0:0:0: [sda] Stopping disk
[ 141.123985] e1000e: EEE TX LPI TIMER: 00000011
[ 141.393832] thinkpad_acpi: EC reports that Thermal Table has changed
[ 141.394222] nouveau 0000:01:00.0: DRM: resuming object tree...
[ 141.563740] nouveau 0000:01:00.0: DRM: resuming fence...
[ 141.563749] nouveau 0000:01:00.0: DRM: resuming display...
[ 141.563777] nouveau 0000:01:00.0: DRM: resuming console...
[ 141.563796] nouveau 0000:01:00.0: DRM: suspending console...
[ 141.563798] nouveau 0000:01:00.0: DRM: suspending display...
[ 141.627471] nouveau 0000:01:00.0: DRM: evicting buffers...
[ 141.627473] nouveau 0000:01:00.0: DRM: waiting for kernel channels to go idle...
[ 141.627504] nouveau 0000:01:00.0: DRM: suspending fence...
[ 141.627997] nouveau 0000:01:00.0: DRM: suspending object tree...
[ 142.579759] PM: suspend of devices complete after 1925.714 msecs
[ 142.599638] PM: late suspend of devices complete after 19.871 msecs
[ 142.651460] PM: noirq suspend of devices complete after 51.800 msecs
[ 142.651462] PM: suspend-to-idle
[ 143.964640] Suspended for 2.566 seconds
[ 179.827113] Suspended for 35.999 seconds
[ 179.851059] sdhci-pci 0000:0d:00.0: MMC controller base frequency changed to 50Mhz.
[ 179.879075] PM: noirq resume of devices complete after 51.777 msecs
[ 179.879148] PM: resume from suspend-to-idle
[ 179.879747] PM: early resume of devices complete after 0.588 msecs
[ 179.880010] nouveau 0000:01:00.0: DRM: resuming object tree...
[ 179.880068] rtlwifi: rtlwifi: wireless switch is on
[ 179.880237] ACPI: button: The lid device is not compliant to SW_LID.
[ 179.890194] sd 0:0:0:0: [sda] Starting disk
[ 179.926925] tpm tpm0: A TPM error (6) occurred attempting to read a pcr value
[ 179.926926] tpm tpm0: TPM is disabled/deactivated (0x6)
[ 179.944247] nouveau 0000:01:00.0: DRM: resuming fence...
[ 179.944259] nouveau 0000:01:00.0: DRM: resuming display...
[ 179.944317] nouveau 0000:01:00.0: DRM: resuming console...
[ 180.237680] ata4: SATA link down (SStatus 0 SControl 300)
[ 180.237719] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[ 180.237760] ata5: SATA link down (SStatus 0 SControl 300)
[ 180.237810] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[ 180.239082] ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (SET FEATURES) succeeded
[ 180.239087] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out
[ 180.239091] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[ 180.240808] ata2.00: ACPI cmd e3/00:1f:00:00:00:a0 (IDLE) succeeded
[ 180.241447] ata2.00: ACPI cmd e3/00:02:00:00:00:a0 (IDLE) succeeded
[ 180.241451] ata2.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[ 180.242161] ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (SET FEATURES) succeeded
[ 180.242165] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out
[ 180.242169] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[ 180.243432] ata1.00: configured for UDMA/133
[ 180.247037] ata2.00: ACPI cmd e3/00:1f:00:00:00:a0 (IDLE) succeeded
[ 180.247668] ata2.00: ACPI cmd e3/00:02:00:00:00:a0 (IDLE) succeeded
[ 180.247673] ata2.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[ 180.249438] ata2.00: configured for UDMA/100
[ 180.446937] firewire_core 0000:0d:00.3: rediscovered device fw0
[ 180.756489] psmouse serio1: synaptics: queried max coordinates: x [..5888], y [..4820]
[ 180.947973] PM: resume of devices complete after 1068.203 msecs
[ 180.948417] PM: Finishing wakeup.
我注意到 [140.327451] 中有一个任务拒绝休眠 20 秒。不太确定这个“单一”任务是什么,当我看到日志时,PID 1722 不再可用。
我认为(不确定)我长按电源按钮的时间是系统抱怨“盖子设备不符合 SW_LID”的时间。
有时这很烦人,因为在挂起时我可能有未保存的工作,如果我无法唤醒系统,我将丢失所有工作。我的猜测是某个进程拒绝睡眠,并且在等待时间内当我尝试唤醒系统时它无法响应。
答案1
我在 Debian 9 中遇到了类似的问题,安装在联想 G40-30 笔记本电脑。我进入休眠/睡眠状态并尝试再次启动,但屏幕没有显示,尽管一切似乎都正常。
解决方案实际上很简单。看来 Linux 操作系统,特别是 Debian 和 Ubuntu 至少需要一个4+GB 交换分区使休眠/睡眠正常工作。如果您使用“默认”配置安装,它将创建一个与实际 RAM 大小相同的交换(实际上要小一些)。因此,如果您的笔记本电脑内存小于或等于 4 Gb 并且安装了“默认”配置,您可能正在尝试解决此问题。
Linux 中的交换分配有两种方式:
1)以硬盘中交换分区的形式。
2) 以交换文件的形式。
您可以SWAP
按如下方式创建文件:
sudo swapon --show
显示您是否启用了交换选项。如果没有,请查找如何执行此操作。
sudo fallocate -l 1G /swapfile
将添加的交换大小设置为 1Gb,更改为您需要的值。
sudo chmod 600 /swapfile # sets the file to be owned by root
sudo mkswap /swapfile # mkswap tool to allocate swap in the file
sudo swapon /swapfile # activate the swap
sudo nano /etc/fstab # open the file to make changes permanent
将行添加/swapfile swap swap defaults 0 0
到文件中/etc/fstab
:
sudo swapon --show # show if its working
sudo free -h # show Memory and Swap
如果您想撤消更改,只需:
sudo swapoff -v /swapfile
从文件中删除该行/etc/fstab
: /swapfile swap swap defaults 0 0
sudo rm /swapfile # remove the swap file
根据 RAM 的交换大小:
SWAP
我可以根据您的 RAM给出一些推荐的大小,如下表所示 。最后 3 列是SWAP
空格:
RAM No hibernation With Hibernation Maximum
1GB 1GB 2GB 2GB
2GB 1GB 3GB 4GB
3GB 2GB 5GB 6GB
4GB 2GB 6GB 8GB
5GB 2GB 7GB 10GB
6GB 2GB 8GB 12GB
8GB 3GB 11GB 16GB
12GB 3GB 15GB 24GB
16GB 4GB 20GB 32GB
24GB 5GB 29GB 48GB
32GB 6GB 38GB 64GB
64GB 8GB 72GB 128GB
128GB 11GB 139GB 256GB
256GB 16GB 272GB 512GB
512GB 23GB 535GB 1TB
1TB 32GB 1056GB 2TB
2TB 46GB 2094GB 4TB
4TB 64GB 4160GB 8TB
8TB 91GB 8283GB 16TB
更多信息:
您可以在以下链接中找到有关根据您的 RAM 推荐的交换大小的完整信息:
我在此处添加的表格应归功于我。