Something is waking up my laptop

Some time ago, I posted on Fedora Discussion because my Fedora system (MSI Summit e16 flip running Fedora 38) started having problems with sleep mode after a kernel update (actually, starting from kernel 6.3.x and with all later versions).

Unfortunately I didn’t receive that many replies there, so I tried to troubleshoot by myself and I found out that what’s causing this problem is probably an internal device of the laptop that is supposed to be used to wake up the laptop from sleep (like the touchpad or the fingerprint reader? idk) and that instead is misfunctioning and waking it up immediately after it reached the sleep state.
I’m saying so because I tried to temporarily disable all the lines in /proc/acpi/wakeup using this simple script that I found somewhere online and, after doing that until the next time I reboot, the laptop stays asleep as expected.

So now my question is: how do I isolate which device is causing the problem? And how can I permanently fix this issue?
I suspect that the problematic device could be the fingerprint reader since it was unsupported up until Fedora 38 and doesn’t still work properly since it keeps forgetting the fingerprints I add… is there a way for me to disable it completely and try to see if it fixes the issue?

(I’m not sure about if this is the proper place to ask questions like this, or if I should report this issue somewhere else, since it’s more a kernel issue rather than a Fedora issue. Recommendations about better place to ask it are welcomed :upside_down_face:)

EDIT1: typo

If the device’s driver is being loaded from a module (as opposed to being compiled into the main kernel binary), the common way to “completely disable” devices is by creating a file under /etc/modprobe.d containing a line like blacklist <the-kernel-module-name>. You can see a list of devices and their corresponding driver/module names by running the command lspci -v.

Edit: If the driver is one that loads early in the system boot process (e.g. a device driver for a RAID card that is needed before the system root partition can be mounted), it may be necessary to regenerate your initramfs with sudo dracut -f so that your new configuration file will be added to the initramfs and it will be seen/available before the kernel tries to load the driver.

1 Like

I wonder if it could be due to this patch?:

Edit: Or maybe not. If I’m reading it right, it looks like that change was “reverted” soon afterwards.

The SuspendState setting in /etc/systemd/sleep.conf might be something worth experimenting with in any case.

1 Like

After some more testing, with the lscpi command and disableing devices one by one in /proc/acpi/wakeup I understood that the problem seems to be with 4 PCIE devices that send this wakeup signal to the system, even if I didn’t understood why.
Waiting for this to be fixed in future kernel updates (also, where should I report this issue so that kernel mantainers can at least be aware of that?) I created a script that disables this 4 lines of the file and a service that runs this script every time I turn on my laptop.

I’ll leave here the two files I used so that if someone else encounters the same problem can use this temporary fix as well

/etc/systemd/system/disable-PCIE-wakeup.service:

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/local/bin/disable-PCIE-wakeup.sh

[Install]
WantedBy=multi-user.target

/usr/local/bin/disable-PCIE-wakeup.sh:

#!/bin/sh
for i in $(cat /proc/acpi/wakeup | grep RP | grep enabled | grep S4 | awk '{print $1}'); 
  do 
    echo $i > /proc/acpi/wakeup; 
  done

(and after creating those files, I enabled the new service with sudo systemctl enable disable-PCIE-wakeup.service)

Are you sure it is all four devices and not just one?

Also, it might help if you can provide the device information with commands similar to the following.

# cat /proc/acpi/wakeup | grep enabled
PEG0	  S4	*enabled   pci:0000:00:01.0
...
# cat /proc/acpi/wakeup | grep enabled | awk '{print substr($4, 5)}' | xargs -n 1 lspci -v -s
00:01.0 PCI bridge: Intel Corporation ...
	Subsystem: Dell Device 092f
...
	Kernel driver in use: pcieport
...
PEG0	  S4	*enabled   pci:0000:00:06.0
LID0	  S3	*enabled   platform:PNP0C0D:00
XHCI	  S3	*enabled   pci:0000:00:14.0
TXHC	  S3	*enabled   pci:0000:00:0d.0
TDM0	  S4	*enabled   pci:0000:00:0d.2
TRP0	  S3	*enabled   pci:0000:00:07.0
TRP1	  S3	*enabled   pci:0000:00:07.1
AWAC	  S4	*enabled   platform:ACPI000E:00
PWRB	  S4	*enabled   platform:PNP0C0C:00

00:06.0 PCI bridge: Intel Corporation 11th Gen Core Processor PCIe Controller (rev 02) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0, IRQ 124, IOMMU group 5
	Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
	I/O behind bridge: [disabled] [16-bit]
	Memory behind bridge: 86400000-864fffff [size=1M] [32-bit]
	Prefetchable memory behind bridge: [disabled] [64-bit]
	Capabilities: <access denied>
	Kernel driver in use: pcieport

lspci: -s: Invalid domain number
00:14.0 USB controller: Intel Corporation Tiger Lake-LP USB 3.2 Gen 2x1 xHCI Host Controller (rev 30) (prog-if 30 [XHCI])
	DeviceName: Onboard - Other
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device 1300
	Flags: bus master, medium devsel, latency 0, IRQ 132, IOMMU group 10
	Memory at 614d160000 (64-bit, non-prefetchable) [size=64K]
	Capabilities: <access denied>
	Kernel driver in use: xhci_hcd

00:0d.0 USB controller: Intel Corporation Tiger Lake-LP Thunderbolt 4 USB Controller (rev 02) (prog-if 30 [XHCI])
	DeviceName: Onboard - Other
	Flags: bus master, medium devsel, latency 0, IRQ 131, IOMMU group 8
	Memory at 614d180000 (64-bit, non-prefetchable) [size=64K]
	Capabilities: <access denied>
	Kernel driver in use: xhci_hcd

00:0d.2 USB controller: Intel Corporation Tiger Lake-LP Thunderbolt 4 NHI #0 (rev 02) (prog-if 40 [USB4 Host Interface])
	DeviceName: Onboard - Other
	Subsystem: Device 2222:1111
	Flags: bus master, fast devsel, latency 0, IRQ 16, IOMMU group 8
	Memory at 614d100000 (64-bit, non-prefetchable) [size=256K]
	Memory at 614d1a4000 (64-bit, non-prefetchable) [size=4K]
	Capabilities: <access denied>
	Kernel driver in use: thunderbolt
	Kernel modules: thunderbolt

00:07.0 PCI bridge: Intel Corporation Tiger Lake-LP Thunderbolt 4 PCI Express Root Port #0 (rev 02) (prog-if 00 [Normal decode])
	Subsystem: Micro-Star International Co., Ltd. [MSI] Device 1300
	Flags: bus master, fast devsel, latency 0, IRQ 125, IOMMU group 1
	Bus: primary=00, secondary=02, subordinate=2c, sec-latency=0
	I/O behind bridge: 5000-5fff [size=4K] [16-bit]
	Memory behind bridge: 78000000-841fffff [size=194M] [32-bit]
	Prefetchable memory behind bridge: 6130000000-614bffffff [size=448M] [32-bit]
	Capabilities: <access denied>
	Kernel driver in use: pcieport

00:07.1 PCI bridge: Intel Corporation Tiger Lake-LP Thunderbolt 4 PCI Express Root Port #1 (rev 02) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0, IRQ 126, IOMMU group 0
	Bus: primary=00, secondary=2d, subordinate=57, sec-latency=0
	I/O behind bridge: 6000-6fff [size=4K] [16-bit]
	Memory behind bridge: 6a000000-761fffff [size=194M] [32-bit]
	Prefetchable memory behind bridge: 6110000000-612bffffff [size=448M] [32-bit]
	Capabilities: <access denied>
	Kernel driver in use: pcieport

lspci: -s: Invalid domain number
lspci: -s: Invalid domain number