How I stopped my ubuntu from waking up from suspend
My Ubuntu 19.04 Laptop had the annoying property to wake up about 1 sec after being suspended (e.g the lid was closed). It took me some wasted battery charges to fix this problem. So for everyone who has similar problems (and for future me) here is how I fixed it.
Open /proc/acpi/wakeup
in your favorite editor.
sudo vim /proc/acpi/wakeup
Which looked like this:
Device S-state Status Sysfs node
LANC S5 *enabled pci:0000:00:19.0
EHC1 S3 *enabled pci:0000:00:1d.0
EHC2 S3 *enabled pci:0000:00:1a.0
XHC S3 *enabled pci:0000:00:14.0
PCIB S5 *disabled
RP02 S4 *disabled
ECF0 S4 *disabled
RP03 S4 *enabled pci:0000:00:1c.2
RP06 S5 *disabled
NIC S5 *disabled
RP07 S4 *disabled
RP08 S4 *disabled
HST1 S5 *disabled
Chaging EHC1, EHC2 and XHC to *disabled
fixed the problem, but only until the next reboot, since /proc/acpi/wakeup
is not persistent across reboots.
The solution is putting a little script in /etc/rc.local
(taken from here)
#!/bin/sh -e
for device in XHC EHC1 EHC2; do
grep $device /proc/acpi/wakeup | grep enabled > /dev/null && {
echo Disabling wakeup on $device
echo $device > /proc/acpi/wakeup
}
done
exit 0
You may need to enable rc.local
first.
sudo chmod +x /etc/rc.local
sudo systemctl enable rc-local
Hope it helped :)