You are not logged in.
I have a Legion 7 gen 7 (Ryzen 7 6800H + Radeon RX 6700m). Everything works great, but there's an annoying issue: if the laptop goes to sleep (after 5 minutes of inactivity) and then the lid is closed, it wakes up again. I can tell it wakes up again because the glowing "Legion" logo on the lid stops glowing.
Some info:
$ uname -a
Linux l7 6.7.3-arch1-2 #1 SMP PREEMPT_DYNAMIC Fri, 02 Feb 2024 17:03:55 +0000 x86_64 GNU/Linux
$ sudo dmesg | grep 'ACPI.*supports S'
[ 2.437629] ACPI: PM: (supports S0 S4 S5)
$ cat /sys/power/mem_sleep
[s2idle]
$ cat /proc/acpi/wakeup
Device S-state Status Sysfs node
GPP0 S0 *enabled pci:0000:00:01.1
SWUS S4 *enabled pci:0000:01:00.0
SWDS S4 *enabled pci:0000:02:00.0
GPP1 S4 *enabled pci:0000:00:01.2
GPP2 S4 *disabled
GPP5 S0 *disabled
GPP6 S4 *enabled pci:0000:00:02.2
GPP7 S4 *enabled pci:0000:00:02.3
SWUS S3 *disabled
SWUS S3 *disabled
XHC0 S3 *enabled pci:0000:37:00.3
XHC1 S3 *enabled pci:0000:37:00.4
XHC2 S3 *enabled pci:0000:38:00.0
NHI0 S3 *enabled pci:0000:38:00.5
XHC3 S3 *enabled pci:0000:38:00.3
NHI1 S4 *disabled
XHC4 S3 *enabled pci:0000:38:00.4
From journalctl:
Feb 07 01:29:59 l7 kernel: OOM killer enabled.
Feb 07 01:29:59 l7 kernel: Restarting tasks ... done.
Feb 07 01:29:59 l7 kernel: random: crng reseeded on system resumption
Feb 07 01:29:59 l7 systemd-logind[1509]: Lid closed.
Feb 07 01:29:59 l7 rtkit-daemon[1887]: The canary thread is apparently starving. Taking action.
Feb 07 01:29:59 l7 rtkit-daemon[1887]: Demoting known real-time threads.
Feb 07 01:29:59 l7 rtkit-daemon[1887]: Demoted 0 threads.
Feb 07 01:29:59 l7 systemd-sleep[10032]: System returned from sleep operation 'suspend'.
Feb 07 01:29:59 l7 bluetoothd[1506]: Controller resume with wake event 0x0
Feb 07 01:29:59 l7 kernel: PM: suspend exit
Feb 07 01:29:59 l7 systemd[1]: systemd-suspend.service: Deactivated successfully.
Feb 07 01:29:59 l7 systemd[1]: Finished System Suspend.
Feb 07 01:29:59 l7 systemd[1]: Stopped target Sleep.
Feb 07 01:29:59 l7 systemd[1]: Reached target Suspend.
Feb 07 01:29:59 l7 systemd[1]: Stopped target Suspend.
Feb 07 01:29:59 l7 systemd-logind[1509]: Operation 'suspend' finished.
Feb 07 01:29:59 l7 NetworkManager[1505]: <info> [1707269399.3032] manager: sleep: wake requested (sleeping: yes enabled: yes)
Feb 07 01:29:59 l7 NetworkManager[1505]: <info> [1707269399.3035] device (enp6s0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
Feb 07 01:29:59 l7 kernel: RTL8226B_RTL8221B 2.5Gbps PHY r8169-0-600:00: attached PHY driver (mii_bus:phy_addr=r8169-0-600:00, irq=MAC)
Feb 07 01:29:59 l7 kernel: r8169 0000:06:00.0 enp6s0: Link is Down
Is there a way to prevent a laptop that's already in a sleep state from waking if the lid is closed?
Last edited by andyturfer (2024-02-07 02:06:49)
Offline
There's no obvious LID device in the wakeup table, check whether there's something that suspiciously looks like one still:
lspci -nn
Does the LID typically suspend the system when closing?
You could disable the HoldoffTimeoutSec in /etc/systemd/logind.conf and hope that the system immediately re-sleeps despite the wakeup.
Is there a parallel windows installation?
Offline
Output from lspci -nn:
$ sudo lspci -nn
00:00.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h PCIe Root Complex [1022:14b5] (rev 01)
00:00.2 IOMMU [0806]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h IOMMU [1022:14b6]
00:01.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h PCIe Dummy Host Bridge [1022:14b7] (rev 01)
00:01.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h PCIe GPP Bridge [1022:14b8]
00:01.2 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h PCIe GPP Bridge [1022:14b8]
00:02.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h PCIe Dummy Host Bridge [1022:14b7] (rev 01)
00:02.2 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h PCIe GPP Bridge [1022:14ba]
00:02.3 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h PCIe GPP Bridge [1022:14ba]
00:02.4 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h PCIe GPP Bridge [1022:14ba]
00:03.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h PCIe Dummy Host Bridge [1022:14b7] (rev 01)
00:03.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 19h USB4/Thunderbolt PCIe tunnel [1022:14cd]
00:04.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h PCIe Dummy Host Bridge [1022:14b7] (rev 01)
00:08.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h PCIe Dummy Host Bridge [1022:14b7] (rev 01)
00:08.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h Internal PCIe GPP Bridge [1022:14b9] (rev 10)
00:08.3 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Family 17h-19h Internal PCIe GPP Bridge [1022:14b9] (rev 10)
00:14.0 SMBus [0c05]: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller [1022:790b] (rev 71)
00:14.3 ISA bridge [0601]: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge [1022:790e] (rev 51)
00:18.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Rembrandt Data Fabric: Device 18h; Function 0 [1022:1679]
00:18.1 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Rembrandt Data Fabric: Device 18h; Function 1 [1022:167a]
00:18.2 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Rembrandt Data Fabric: Device 18h; Function 2 [1022:167b]
00:18.3 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Rembrandt Data Fabric: Device 18h; Function 3 [1022:167c]
00:18.4 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Rembrandt Data Fabric: Device 18h; Function 4 [1022:167d]
00:18.5 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Rembrandt Data Fabric: Device 18h; Function 5 [1022:167e]
00:18.6 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Rembrandt Data Fabric: Device 18h; Function 6 [1022:167f]
00:18.7 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Rembrandt Data Fabric: Device 18h; Function 7 [1022:1680]
01:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Upstream Port of PCI Express Switch [1002:1478] (rev cf)
02:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Downstream Port of PCI Express Switch [1002:1479]
03:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 22 [Radeon RX 6700/6700 XT/6750 XT / 6800M/6850M XT] [1002:73df] (rev cf)
03:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 21/23 HDMI/DP Audio Controller [1002:ab28]
04:00.0 Non-Volatile memory controller [0108]: Sandisk Corp WD Blue SN570 NVMe SSD 2TB [15b7:5025] (rev 01)
05:00.0 Network controller [0280]: Intel Corporation Wi-Fi 6E(802.11ax) AX210/AX1675* 2x2 [Typhoon Peak] [8086:2725] (rev 1a)
06:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller [10ec:8125] (rev 05)
07:00.0 Non-Volatile memory controller [0108]: SK hynix Platinum P41/PC801 NVMe Solid State Drive [1c5c:1959]
37:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Rembrandt [Radeon 680M] [1002:1681] (rev c8)
37:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Rembrandt Radeon High Definition Audio Controller [1002:1640]
37:00.2 Encryption controller [1080]: Advanced Micro Devices, Inc. [AMD] Family 19h PSP/CCP [1022:1649]
37:00.3 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Rembrandt USB4 XHCI controller #3 [1022:161d]
37:00.4 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Rembrandt USB4 XHCI controller #4 [1022:161e]
37:00.6 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Family 17h/19h HD Audio Controller [1022:15e3]
38:00.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Rembrandt USB4 XHCI controller #8 [1022:161f]
38:00.3 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Rembrandt USB4 XHCI controller #5 [1022:15d6]
38:00.4 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Rembrandt USB4 XHCI controller #6 [1022:15d7]
38:00.5 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Rembrandt USB4/Thunderbolt NHI controller #1 [1022:162e]
Everything else works as expected:
Closing the lid puts the laptop into a suspended state.
If laptop is suspended with the lid closed, opening the lid wakes the laptop.
If the laptop is inactive for 10 minutes (or whatever it's set to), it will suspend.
If the laptop is suspended with the lid open, moving the mouse or pressing a key will wake the laptop.
So the only thing that doesn't work:
If the laptop is suspended with the lid open, closing the lid wakes the laptop.
I tried setting HoldoffTimeoutSec to different values (0s, 30s, 60s), this did not resolve the issue.
Windows is also installed, but it's on a completely separate m.2 drive (so it's not really "dual boot" in the traditional sense). Most of the time the Windows m.2 drive isn't even installed, but I did install it recently to test this issue - the same issue does not occur on Windows 11.
It's definitely not a big issue for me, but it is annoying. If I want to close the lid and leave the laptop suspended, I just have to remember to press a key first to wake it (before closing the lid). If I forget to do this, the laptop gets hot and the battery drains.
Last edited by andyturfer (2024-02-07 22:02:54)
Offline
so it's not really "dual boot" in the traditional sense
It is in the relevant sense, please make sure that fast-start is disabled, 3rd link below.
Disable it (it's NOT the BIOS setting!) and reboot windows and linux twice for voodo reasons.
Then certainly try to disable SWUS and SWDS
Offline
FastBoot is already disabled in Windows (I did this the moment I purchased the laptop).
Then certainly try to disable SWUS and SWDS
I don't know what SWUS and SWDS are or how to disable them.
Offline
(I did this the moment I purchased the laptop)
Disable it. Again and again and again and again (Mate. Feed. Kill. Repeat. ) ... Sometimes Windows re-enable Fast Start if/when installing its Updates: powercfg /h off.
<49,17,III,I> Fama di loro il mondo esser non lassa;
<50,17,III,I> misericordia e giustizia li sdegna:
<51,17,III,I> non ragioniam di lor, ma guarda e passa.
Offline
I don't know what SWUS and SWDS are or how to disable them.
01:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Upstream Port of PCI Express Switch [1002:1478] (rev cf)
02:00.0 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 XL Downstream Port of PCI Express Switch [1002:1479]
You toggle devices by echo'ing them into the wakeup "file":
grep SWUS /proc/acpi/wakeup
echo SWUS | sudo tee /proc/acpi/wakeup
grep SWUS /proc/acpi/wakeup
wrt windows and nomenclature "fast boot" decribes a feature of your BIOS/UEFI to skip a bunch of selftests.
The windows thing is called "fast start" and is disguised hibernation.
The difference is important, the BIOS fast-boot is irrelevant to this, but indeed check that fast start is (still) disabled - the system is woken by the firmware/ACPI, not the OS and it gets systematically "confused" if you're effectively running two OS at the same time, which is why we'd look there first.
Offline
I double-checked to ensure fast-boot is still definitely switched off in Windows (it is). I have also removed the Windows m.2 drive.
I toggled SWUS, but it did not solve the issue - the laptop still awakens if it's in a suspended state with the lid open, and the lid is then closed.
$ grep SWUS /proc/acpi/wakeup
SWUS S4 *enabled pci:0000:01:00.0
SWUS S3 *disabled
SWUS S3 *disabled
$ echo SWUS | sudo tee /proc/acpi/wakeup
SWUS
$ grep SWUS /proc/acpi/wakeup
SWUS S4 *disabled pci:0000:01:00.0
SWUS S3 *disabled
SWUS S3 *disabled
Offline
Did you also disable SWDS ?
You could also try to just disable all wakeup devices and see whether that does anything for the situation at all.
The LID not being in the wakeup table is odd, though - might be an issue of the thinkpad_acpi(?) module
Offline
Hi Seth - I disabled all wakeup devices, it didn't change anything:
$ cat /proc/acpi/wakeup
Device S-state Status Sysfs node
GPP0 S0 *disabled pci:0000:00:01.1
SWUS S4 *disabled pci:0000:01:00.0
SWDS S4 *disabled pci:0000:02:00.0
GPP1 S4 *disabled pci:0000:00:01.2
GPP2 S4 *disabled
GPP5 S0 *disabled
GPP6 S4 *disabled pci:0000:00:02.2
GPP7 S4 *disabled pci:0000:00:02.3
SWUS S3 *disabled
SWUS S3 *disabled
XHC0 S3 *disabled pci:0000:37:00.3
XHC1 S3 *disabled pci:0000:37:00.4
XHC2 S3 *disabled pci:0000:38:00.0
NHI0 S3 *disabled pci:0000:38:00.5
XHC3 S3 *disabled pci:0000:38:00.3
NHI1 S4 *disabled
XHC4 S3 *disabled pci:0000:38:00.4
I'll try a live-CD for another distro and see if the same issue exists...
Offline
You can also test the install ISO, but those tests are going to be inconclusive as the ACPI behavior might simply change w/ the (external) boot medium and that is especially true if (for whatever reason) this ultimately is an issue w/ a hibernating windows.
Going on, still, if it works from a live distro, would be to compare the modules loaded by the live distro and the installed system ("lsmod | sort") and the /proc/acpi/wakeup devices available there.
Can you configure the lid behavior in the BIOS?
Offline
Tried live CDs for several other distros, same behavior - the laptop wakes if it's in a sleep state and the lid is closed.
Offline
I'm trying to implement a "dirty workaround" for now:
In /usr/lib/systemd/system-sleep I have created onwakeup.sh:
#!/bin/bash
PATH=/sbin:/usr/sbin:/bin:/usr/bin
if [[ "${1}" == "post" ]]; then
# AFTER RESUMING FROM SLEEP
printf "`date +%T` " >> /tmp/wake.log
echo "Have resumed..." >> /tmp/wake.log
sleep 1
grep -q closed /proc/acpi/button/lid/LID0/state
if [ $? = 0 ]
then
printf "`date +%T` " >> /tmp/wake.log
echo "Have resumed and lid is closed, attempting to suspend..." >> /tmp/wake.log
systemctl suspend
fi
fi
The systemctl suspend line doesn't work though. From /tmp/wake.log:
18:39:50 Have resumed...
18:39:51 Have resumed and lid is closed, attempting to suspend...
Any idea why the systemctl suspend line in the script isn't working?
Last edited by andyturfer (2024-02-17 18:57:09)
Offline
Probably because of the HoldoffTimeoutSec in /etc/systemd/logind.conf - you could try "-f" but idk whether that helps here.
Stupid question (and b/c another lenovo user showed up w/ similar-ish behavior):
Could it be that the lid triggers the keyboard and that wakes the system?
Depending on the lid switch you might not have to fully close the lid to trigger it (you could test to sleep the system this way and then whether the switch triggers the wakeup or the physical contact)
Offline
Sorry, should have mentioned in my original post that I have already tried this. The laptop will go to sleep without fully closing the lid. When the laptop is sleeping with the lid open, and I close the lid with a gap (to enure no physical contact is made), it still wakes.
Offline
I managed to get the "dirty workaround" working
Create on-wakeup.sh in /usr/lib/systemd/system-sleep:
#!/bin/bash
PATH=/sbin:/usr/sbin:/bin:/usr/bin
# IF WAKING FROM SUSPEND...
if [[ "${1}" == "post" ]]; then
echo "$(date) Have resumed..." >> /tmp/wake.log
grep -q closed /proc/acpi/button/lid/LID0/state
if [ $? = 0 ]
then
echo "$(date) Have resumed and lid is closed, attempting to suspend..." >> /tmp/wake.log
echo freeze > /sys/power/state
fi
fi
It's not a proper fix, but at least I no longer have to remember to wake my laptop before closing the lid.
Offline