无法暂停:系统在休眠约 40 分钟后因未知原因恢复

无法暂停:系统在休眠约 40 分钟后因未知原因恢复

我买了一台新的 MSI Summit B15,它没有操作系统,我很乐意在上面安装全新的 Ubuntu 21.04。到目前为止,一切都运行良好(除了触摸板的一些问题和没有 FP 扫描仪的驱动程序,但那是另一回事),除了一个非常烦人的问题:当我试图挂起机器时,它会在大约 40-60 分钟后突然唤醒并开始全速运行风扇。它不仅有时会唤醒如果我碰巧在附近睡觉,它会在一夜之间耗尽电池,使挂起功能基本上毫无用处。

我尝试禁用一切(参见这里如何)但电源按钮处于关闭状态/proc/acpi/wakeup,因此它目前看起来像这样:

➜  ~ cat /proc/acpi/wakeup | grep enabled
PWRB      S4    *enabled   platform:PNP0C0C:00

这没用。

这是系统日志的一部分(这里我已将系统设置为在 7:48 挂起,并且它在 8:35 开始扇动,但我稍后才在 10:56 登录):

Sep  5 07:48:00 rb-base tracker-store[6784]: OK
Sep  5 07:48:00 rb-base systemd[3246]: tracker-store.service: Succeeded.
Sep  5 07:48:01 rb-base kernel: [  146.937861] Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
Sep  5 07:48:05 rb-base kernel: [  150.972633] Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
Sep  5 07:48:05 rb-base kernel: [  150.977982] Lockdown: systemd-logind: hibernation is restricted; see man kernel_lockdown.7
Sep  5 07:48:05 rb-base ModemManager[2119]: <info>  [sleep-monitor] system is about to suspend
Sep  5 07:48:05 rb-base kernel: [  150.997219] wlo1: deauthenticating from b0:4e:26:31:82:b8 by local choice (Reason: 3=DEAUTH_LEAVING)
Sep  5 07:48:05 rb-base wpa_supplicant[1978]: wlo1: CTRL-EVENT-DISCONNECTED bssid=b0:4e:26:31:82:b8 reason=3 locally_generated=1
Sep  5 07:48:05 rb-base NetworkManager[1931]: <info>  [1630817285.6861] device (wlo1): state change: deactivating -> disconnected (reason 'sleeping', sys-ifac
e-state: 'managed')
Sep  5 07:48:05 rb-base wpa_supplicant[1978]: wlo1: CTRL-EVENT-SIGNAL-CHANGE above=0 signal=0 noise=9999 txrate=0
Sep  5 07:48:07 rb-base systemd[1]: Reached target Sleep.
Sep  5 07:48:07 rb-base systemd[1]: Starting Suspend...
Sep  5 07:48:07 rb-base kernel: [  152.341436] PM: suspend entry (s2idle)
Sep  5 07:48:07 rb-base systemd-sleep[7072]: Suspending system...
Sep  5 07:48:07 rb-base systemd[1]: zsysd.service: Succeeded.
Sep  5 07:48:07 rb-base kernel: [  152.424613] Filesystems sync: 0.083 seconds
Sep  5 10:56:42 rb-base kernel: [  152.426323] Freezing user space processes ... (elapsed 0.002 seconds) done.
Sep  5 10:56:42 rb-base kernel: [  152.428515] OOM killer disabled.
Sep  5 10:56:42 rb-base kernel: [  152.428516] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Sep  5 10:56:42 rb-base kernel: [  152.429676] printk: Suspending console(s) (use no_console_suspend to debug)
Sep  5 10:56:42 rb-base kernel: [  153.214718] ACPI: EC: interrupt blocked
Sep  5 10:56:42 rb-base kernel: [11468.660690] ACPI: EC: interrupt unblocked
Sep  5 10:56:42 rb-base kernel: [11469.338032] nvme nvme0: 8/0/0 default/read/poll queues
Sep  5 10:56:42 rb-base kernel: [11469.574414] OOM killer enabled.
Sep  5 10:56:42 rb-base kernel: [11469.574416] Restarting tasks ... done.
Sep  5 10:56:42 rb-base kernel: [11469.584884] mei_hdcp 0000:00:16.0-b638ab7e-94e2-4ea2-a552-d1c54b627f04: bound 0000:00:02.0 (ops i915_hdcp_component_ops [i915])
Sep  5 10:56:42 rb-base kernel: [11469.586402] thermal thermal_zone6: failed to read out thermal zone (-61)
Sep  5 10:56:42 rb-base systemd[1]: Condition check resulted in Run anacron jobs being skipped.
Sep  5 10:56:43 rb-base systemd-sleep[7072]: System resumed.
Sep  5 10:56:43 rb-base kernel: [11469.846714] PM: suspend exit
Sep  5 10:56:43 rb-base systemd[1]: systemd-suspend.service: Succeeded.
Sep  5 10:56:43 rb-base systemd[1]: Finished Suspend.
Sep  5 10:56:43 rb-base systemd[1]: Stopped target Sleep.
Sep  5 10:56:43 rb-base systemd[1]: Reached target Suspend.
Sep  5 10:56:43 rb-base systemd[1]: Stopped target Suspend.
Sep  5 10:56:43 rb-base NetworkManager[1931]: <info>  [1630828603.2303] manager: sleep: wake requested (sleeping: yes  enabled: yes)
Sep  5 10:56:43 rb-base ModemManager[2119]: <info>  [sleep-monitor] system is resuming
Sep  5 10:56:43 rb-base NetworkManager[1931]: <warn>  [1630828603.5154] sup-iface[499bce01c63427b3,1,wlo1]: call-p2p-cancel: failed with P2P cancel failed
Sep  5 10:56:45 rb-base ModemManager[2119]: <info>  [base-manager] couldn't check support for device '/sys/devices/pci0000:00/0000:00:14.3': not supported by any plugin
Sep  5 10:56:46 rb-base dbus-daemon[1927]: [system] Activating via systemd: service name='net.reactivated.Fprint' unit='fprintd.service' requested by ':1.90' (uid=1000 pid=3490 comm="/usr/bin/gnome-shell " label="unconfined")
Sep  5 10:56:46 rb-base systemd[1]: Starting Fingerprint Authentication Daemon...
Sep  5 10:56:46 rb-base dbus-daemon[1927]: [system] Successfully activated service 'net.reactivated.Fprint'
Sep  5 10:56:46 rb-base systemd[1]: Started Fingerprint Authentication Daemon.

以下是完整日志,以防我删除了一些相关内容)

如您所见,机器实际被唤醒时没有任何记录。所以我的下一个假设是操作系统之外的某些东西导致了唤醒。但是系统看起来未暂停:例如,当我打开盖子时,显示器亮起并立即显示登录屏幕,当我在睡眠系统上打开盖子时,通常需要一些时间才能启动登录屏幕。

更新1:感谢@David 的评论,虽然 WOL 本身与我的系统无关(MSI Summit 甚至没有以太网卡),但我发现我必须在 BIOS 设置中搜索一些配置。我发现那里有启用的“Thunderbolt™ 设备唤醒”条目。我有 0 个 Thunderbolt™ 设备,但禁用了该条目,以防万一。但这没有帮助。

更新2:它似乎/proc/acpi/wakeup不起作用:正如我之前提到的,我已经禁用了除电源按钮之外的所有功能,但是,当我打开盖子时,计算机仍然会被唤醒。

UPD3电池状态转储脚本,按照@sancho.s ReinstateMonicaCellio 的建议:

#!/bin/bash

TIME="$(date +'%y-%m-%d %H:%M:%S')"
CAPACITY="$(cat /sys/class/power_supply/BAT1/capacity)"
CURRENT="$(cat /sys/class/power_supply/BAT1/current_now)"
VOLTAGE="$(cat /sys/class/power_supply/BAT1/voltage_now)"

echo "$TIME\t$CAPACITY\t\t\t$CURRENT\t$VOLTAGE" >> /home/rb/bat_dump

答案1

我不知道你的情况是否如此,但如果你的系统配置为在合上盖子时进入睡眠状态,并在 40 分钟后进入休眠状态,则风扇可能会在休眠时启动。不过,这无法解释电池耗尽的原因。另一个相关情况是系统配置为在一定电池电量水平下进入休眠状态。因此,首先会耗尽电池电量(我不知道为什么),然后触发休眠状态。或者,系统可能根本没有暂停。

诊断 PC 状态

使用以下方式检查相关事件

$ journalctl --no-pager | cat -n | grep -A 10 -B 3 systemd-logind

您可以在以下行中识别暂停

9818455 sep 08 22:25:57 MyServer systemd-logind[1132]: Lid closed.
...
9818624 sep 09 06:43:47 MyServer systemd-logind[1132]: Lid opened.

或者使用

$ cat -n /var/log/syslog | grep -A 10 -B 3 systemd-logind

您的syslog似乎显示了有效的睡眠,但我不确定。我有PM: suspend entry (deep)(在 Thinkpad 中)而不是您的PM: suspend entry (s2idle)。另请参阅下文。

诊断电池耗电

你可以写一个脚本,dump_bat.sh转储电池状态归档,例如

#!/bin/bash
upower -i /org/freedesktop/UPower/devices/battery_BAT0 > battery_$(date | tr " " "_").txt

你可以 grep 输出的特定部分,如percentagetime to emptyupdatedHistory片段。记住

$ chmod +x dump_bat.sh

每隔 10 分钟设置一个 cron 任务来执行此操作将有助于识别电池消耗模式和笔记本电脑状态(唤醒/睡眠)。 添加

*/10  * * * * <path to dump_bat.sh>

$ crontab -e

避免电池耗尽

尝试使用以下方法禁用 WOL

$ ethtool -s <device> wol d

结合以上诊断。

相关内容