4

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! ~
~

dalaeck
  • 41

2 Answers2

5

Same issue (USB rewaking) on my Lenovo Yoga 910. solved with the solution of mike-g2 (mikeg-utk):

  1. Create file: /etc/systemd/system/toggle.XHC.to.fix.suspend.issue.service with following content:

    [Unit]
    Description="Make suspend ignore USB wake up."
    
    [Service]
    ExecStart=/bin/bash -c "echo XHC >> /proc/acpi/wakeup"
    
    [Install]
    WantedBy=multi-user.target
    
  2. Create symbolic link to above script in /etc/systemd/system/multi-user.target.wants/

    ln -s /etc/systemd/system/toggle.XHC.to.fix.suspend.issue.service /etc/systemd/system/multi-user.target.wants/
    
  3. Start service

    sudo systemctl daemon-reload
    sudo systemctl start toggle.XHC.to.fix.suspend.issue.service
    
  4. Check if service was started

    sudo systemctl status toggle.XHC.to.fix.suspend.issue.service
    
  5. Enable it on boot

    sudo systemctl enable toggle.XHC.to.fix.suspend.issue.service
    
0

I had the same problem with a Ryzen 2600 and Ubuntu 18.04.

Your script was very helpful. To execute it on startup I added your lines

echo AS43 > /proc/acpi/wakeup
echo PTXH > /proc/acpi/wakeup

to a /etc/rc.local file.

Then I added a systemd service to start this script. I followed this tutorial.

Thanks for finding the wakeup triggers!

abu_bua
  • 10,783