I recently had the problem, that suspend would just immediately turn on again. After some trial and error I found the solution myself, but it was quite difficult, since I just transitioned from Windows.
So I thought I would post my solution here, if anyone happens to have the same problem and runs risk to break more things because of lacking experience (like me), instead of actually fixing the problem.
So as I already mentioned, my PC would suspend upon pressing the suspend button (or using
systemctl suspend) but then immediately turn on again.
The problem hid itself inside
/proc/acpi/wakeup. There you can see all the devices which are allowed/disallowed to wake your PC from suspend (as far as I understood it).
It probably looks something like this:
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 PS2K S3 *disabled PS2M S3 *disabled GPP0 S4 *enabled pci:0000:00:01.1 GPP8 S4 *enabled pci:0000:00:03.1 SWUS S4 *enabled pci:0000:05:00.0 SWDS S4 *enabled pci:0000:06:00.0 PTXH S4 *enabled pci:0000:02:00.0 PT20 S4 *disabled PT23 S4 *disabled PT24 S4 *disabled PT26 S4 *disabled PT27 S4 *disabled PT28 S4 *disabled PT29 S4 *enabled pci:0000:03:09.0
Now I disabled the devices one by one (don't need to worry about the already disabled ones) to see which one was causing the problem (could theoretically be multiple ones).
You can do this by using
echo DEVICE > /proc/acpi/wakeup, this will toggle the
Statusfield (needs to be done in a root shell, use
sudo -i beforehand).
If it is a PCI device you can also use
echo disabled > /sys/bus/pci/devices/<port>/power/wakeup (this won't toggle the
Statusfield, which was a problem for me).
Once you found the problematic device(s) you can make disabling it/them persistent over reboots by creating services.
GPP0 caused the problem, and I'll post my services as examples:
[Unit] Description=Local system suspend actions Before=sleep.target [Service] Type=simple ExecStart=/bin/sh -c "echo disabled > /sys/bus/pci/devices/0000:00:01.1/power/wakeup" [Install] WantedBy=sleep.target
[Unit] Description=Local system resume actions After=suspend.target [Service] Type=simple ExecStart=/bin/sh -c "echo disabled > /sys/bus/pci/devices/0000:00:01.1/power/wakeup" [Install] WantedBy=suspend.target
Then you can enable and start the services
sudo systemctl enable root-suspend sudo systemctl enable root-resume sudo systemctl start root-suspend sudo systemctl start root-resume
I hope this can help someone in the future
Also: Would appreciate it if someone experienced could check that this actually makes sence (or if there's a better way).