I feel like I am missing something simple with sleep ( Sleep issues )

I had a similar issue on my Desktop Lenevo Legion T5 26AMR5.
I am posting here in case it helps someone.
My PC has an AMD B550 Motherboard which has a known issue with the GPP Bridge waking up the PC from suspend prematurely. I was able to fix it by following https://wiki.archlinux.org/title/Power_management/Wakeup_triggers#GPP_bridge. That page also contains fixes for other Hardware.

First I executed the following as root (sudo didn’t work for me, so I became root with sudo su -):

echo GPP0 > /proc/acpi/wakeup

This is only a temporary change that will revert on reboot. So this command is perfect to try out if this fix works without having to worry about breaking your system.
After running this command you can try to suspend (aka. sleep) your system and see if it works.
The command actually toggles the enabled/disabled state, so you can just run it again to reenable GPP0. You can check the status with:

cat /proc/acpi/wakeup

Which for me gives this output (after disabling GPP0):

Device  S-state   Status   Sysfs node
GP12      S4    *enabled   pci:0000:00:07.1
GP13      S4    *enabled   pci:0000:00:08.1
XHC0      S4    *enabled   pci:0000:09:00.3
GP30      S4    *disabled
GP31      S4    *disabled
SIO1      S3    *disabled
GPP0      S4    *disabled  pci:0000:00:01.1
GPP8      S4    *enabled   pci:0000:00:03.1
PTXH      S4    *enabled   pci:0000:02:00.0
PT20      S4    *disabled
PT24      S4    *enabled   pci:0000:03:04.0
PT26      S4    *disabled
PT27      S4    *disabled
PT28      S4    *enabled   pci:0000:03:08.0
PT29      S4    *enabled   pci:0000:03:09.0

For me disabling GPP0 worked the first time and I was happy, but then later it randomly stopped working, which really confused me. In my case the reason was my Logitech MX Keys S which sometimes triggered a wakeup as well.
I figured this out by setting everything in /proc/acpi/wakeup to disabled (which resulted in a successful sleep that I could only resume by pressing the power button on my PC) and then reenabling each PCIe device one by one.
In my case the keyboard was waking up the PC through PTXH which on my motherboard is the USB controller. Now that I know that, I simply turn off my keyboard before suspending (it’s a wireless keyboard, so I want to turn it off anyways). If I ever want to stop turning off my keyboard in the future and still want a reliable sleep without random wakeup I’ll have to disable PTXH in addition to GPP0, but then I’ll no longer be able to wake the PC using my keyboard and will have to use the power button (my wired mouse never wakes up the PC for some reason). Or maybe I’ll read what Power management/Wakeup triggers - ArchWiki suggests as a fix for my Logi Bolt.

If you are interested, you can see which device is which by running lspci and looking for the last seven characters of the Sysfs node from /proc/acpi/wakeup. For example to find out what PTXH is I ran:

❯ lspci | grep 02:00.0
02:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] 500 Series Chipset USB 3.1 XHCI Controller

To make the fix persist (after reboot) the Arch-Wiki suggests adding a udev rule similar to what you did.
The suggest creating the file /etc/udev/rules.d/90-gigabyte.rules with this content:

ACTION=="add", SUBSYSTEM=="pci", KERNEL=="0000:00:01.1", ATTR{power/wakeup}="disabled"

And to quote the wiki:

The value for KERNEL is the Sysfs node column, without the pci: prefix, from /proc/acpi/wakeup.

So for PTXH instead of GPP0 it would have to be 0000:02:00.0 instead of 0000:00:01.1.

@jzjones22 Thank you for your detailed posts. It was very nice to also read what didn’t work to help me prioritize which steps to try first. I am very new to linux just like you, but maybe some of what I wrote clarifies some things for you or at least gives you confidence, that your udev rule is the correct approach. The Arch-Wiki is very reliable from my limited experience, so it suggesting a udev rule is a good sign :slight_smile: