My 18.04 Ubuntu Ryzen desktop will wake itself up instantly after it suspends. I've tracked the problem down to /proc/acpi/wakeup In the list of enabled services there are two services (labeled for what it's worth: AS43 and PTXH) which I can disable using the following shell commands:
sudo -s echo AS43 > /proc/acpi/wakeup echo PTXH > /proc/acpi/wakeup
Once this is done - system wakes from sleep only from keyboard input - all is good. However I can't seem to automate this process.
One solution (and I'm open to others) is to make a service, /etc/systemd/system/suspendfix.service such as follows:
[Unit] Description=fix to prevent system from waking immediately after suspend [Service] Type=simple ExecStartPre=/bin/sh -c '/bin/echo GPP2 > /proc/acpi/wakeup' ExecStart=/bin/sh -c '/bin/echo AS43 > /proc/acpi/wakeup' ExecStartPost=/bin/sh -c '/bin/echo PTXH > /proc/acpi/wakeup' RemainAfterExit=yes TimeoutSec=90s [Install] WantedBy=sleep.target WantedBy=multi-user.target
BUT this doesn't seem to work. Either my service script is incorrect or something is flipping the offending AS43 and PTXH back to enabled regardless of this systemd service file. Any help, much obliged!