PureOS wakes up after a few seconds of suspend

I have had the issue recently that when I suspend the Librem 15v3 (either by pressing the suspend button in the taskbar or by closing the lid), it will automatically wake up after 2 to 5 seconds without any keyboard or mouse click. Worse, sometimes it would freeze and I would have to reboot to be able to use the laptop again.

After some research on the internet, the root cause seems to be some components waking up the laptop.
cat /proc/acpi/wakeup
showed that XHCI device was enabled.
Disabling it with
echo XHCI | sudo tee /proc/acpi/wakeup
solved the automatic wake up and potential freezing issues.

Where I am stuck is that after rebooting the laptop, the XHCI device is enabled again. So I have to disable it manually through the command line above after every reboot.

Can someone explain the steps to disable a device permanently?

Thanks in advance

I found the solution in these 2 posts:

https://bbs.archlinux.org/viewtopic.php?pid=1575617#p1575617

https://www.reddit.com/r/archlinux/comments/3zxg65/how_to_permanently_change_procacpiwakeup_or/

I created a file disable-USB-wakeup.service in /etc/systemd/system containing

[Unit]
Description=Disable USB wakeup triggers in /proc/acpi/wakeup

[Service]
Type=oneshot
ExecStart=/bin/sh -c “echo XHCI > /proc/acpi/wakeup”
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Then I did

sudo systemctl daemon-reload

Then

sudo systemctl start disable-USB-wakeup.service

Checked on it with

systemctl status disable-USB-wakeup.service

Then enabled it so it starts after boot with

sudo systemctl enable disable-USB-wakeup.service

3 Likes

Just check on power optimisation quite a few people had trouble with it.

1 Like

Thanks a lot for sharing the solution! It worked nearly. I cut&pasted the unit file content to my unit file, started, reloaded the config, looked at the status as described and found:

Warning: The unit file, source configuration file or drop-ins of disable-USB-wakeup.service changed on disk. Run 'systemctl daemon-reload' to reload units.
â—Ź disable-USB-wakeup.service - Disable USB wakeup triggers in /proc/acpi/wakeup
   Loaded: loaded (/etc/systemd/system/disable-USB-wakeup.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2020-04-29 09:10:21 CEST; 9s ago
  Process: 23430 ExecStart=/bin/sh -c “echo XHCI > /proc/acpi/wakeup” (code=exited, status=127)
 Main PID: 23430 (code=exited, status=127)

The problem is the ” - typographic correct, but technically very different from ". I don’t know, why the wrong character showed up in the original description, but the correct unit file should look like this:

[Unit]
Description=Disable USB wakeup triggers in /proc/acpi/wakeup

[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo XHCI > /proc/acpi/wakeup"
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
2 Likes