当我暂停 Dell XPS 13 9379 时,NetworkManager
如果我的蓝牙鼠标未连接,则会立即再次唤醒它:
# journalctl -ex
...
systemd-logind[653]: Operation 'sleep' finished.
NetworkManager[650]: <info> [1541032616.6736] manager: sleep: wake requested (sleeping: yes enabled: yes)
NetworkManager[650]: <info> [1541032616.6739] device (enxa0cec8126450): state change: unavailable -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
NetworkManager[650]: <info> [1541032616.7017] device (enxa0cec8126450): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'managed')
...
如何防止蓝牙唤醒我的机器?
显然,蓝牙要么无关紧要,要么不是问题的唯一根源,因为我的机器在禁用蓝牙的情况下被唤醒(或者说无法进入睡眠状态)。根据我这次找到的日志,我00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
认为是蓝牙的问题:
kernel: PM: suspend entry (s2idle)
kernel: PM: Syncing filesystems ... done.
kernel: Freezing user space processes ... (elapsed 0.004 seconds) done.
kernel: OOM killer disabled.
kernel: Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
kernel: Suspending console(s) (use no_console_suspend to debug)
kernel: pci_pm_suspend(): hcd_pci_suspend+0x0/0x30 returns -16
kernel: dpm_run_callback(): pci_pm_suspend+0x0/0x150 returns -16
kernel: PM: Device 0000:00:14.0 failed to suspend async: error -16
kernel: PM: Some devices failed to suspend, or early wake event detected
kernel: rtc_cmos 00:01: Alarms can be up to one month in the future
kernel: OOM killer enabled.
kernel: Restarting tasks ... done.
kernel: [drm] RC6 on
kernel: thermal thermal_zone8: failed to read out thermal zone (-61)
kernel: PM: suspend exit
kernel: PM: suspend entry (s2idle)
kernel: PM: Syncing filesystems ... done.
kernel: Freezing user space processes ... (elapsed 0.002 seconds) done.
kernel: OOM killer disabled.
kernel: Freezing remaining freezable tasks ... (elapsed 0.056 seconds) done.
kernel: Suspending console(s) (use no_console_suspend to debug)
kernel: pci_pm_suspend(): hcd_pci_suspend+0x0/0x30 returns -16
kernel: dpm_run_callback(): pci_pm_suspend+0x0/0x150 returns -16
kernel: PM: Device 0000:00:14.0 failed to suspend async: error -16
kernel: PM: Some devices failed to suspend, or early wake event detected
kernel: rtc_cmos 00:01: Alarms can be up to one month in the future
kernel: OOM killer enabled.
kernel: Restarting tasks ... done.
kernel: [drm] RC6 on
kernel: thermal thermal_zone8: failed to read out thermal zone (-61)
systemd[1]: systemd-suspend.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: systemd-suspend.service: Failed with result 'exit-code'.
systemd[1]: Failed to start Suspend.
答案1
我的笔记本电脑以前大部分时间都能正常挂起,但上周开始出现问题。可能是因为电缆故障。我创建了一个 bash 脚本,可以比以前更快、更可靠地挂起和恢复。
使用此命令:
sudo -H gedit /lib/systemd/system-sleep/custom-xhci_hcd
将以下内容复制并粘贴到编辑器中:
#!/bin/bash
# Original script was using /bin/sh but shellcheck reporting warnings.
# NAME: custom-xhci_hcd
# PATH: /lib/systemd/system-sleep
# CALL: Called from SystemD automatically
# DESC: Suspend broken for USB3.0 as of Oct 25/2018 various kernels all at once
# DATE: Oct 28 2018.
# NOTE: From comment #61 at: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998
TMPLIST=/tmp/xhci-dev-list
# Original script was: case "${1}" in hibernate|suspend)
case $1/$2 in
pre/*)
echo "$0: Going to $2..."
echo -n '' > $TMPLIST
for i in `ls /sys/bus/pci/drivers/xhci_hcd/ | egrep '[0-9a-z]+\:[0-9a-z]+\:.*$'`; do
# Unbind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
echo "$i" >> $TMPLIST
done
;;
post/*)
echo "$0: Waking up from $2..."
for i in `cat $TMPLIST`; do
# Bind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/bind
done
rm $TMPLIST
;;
esac
然后保存文件并退出gedit
。
使用以下方法将脚本标记为可执行:
sudo chmod a+x /lib/systemd/system-sleep/custom-xhci_hcd
现在您的暂停/恢复问题应该已经解决。如果没有,希望其他人发布他们的解决方案。
答案2
可能是内核错误200039。在这种情况下,删除btusb
模块会有所帮助(rmmod btusb
)。如果是这种情况,您确实可以通过睡眠脚本加载/卸载内核模块,就像这里发布的脚本一样。