For what it’s worth, it looks like a patch to automatically flip this flag made it into the kernel recently ish. If I understand correct, you can check if your kernel is already doing this with
cat /sys/module/rtc_cmos/parameters/use_acpi_alarm
Y
Could there be a similar kernel issue where the lock screen freezes, and you have to force shut down the device by holding down the power button? (Admin, if this needs to be on another thread, please move it.)
I’m having the same problem with waking up from suspend after a few seconds. I tried the workaround above, but it didn’t make a difference for me. I have the same issue on ubuntu 24.04, 22.04, fedora 40, and linux mint. I tried running the script if that helps.
Thank you, that worked for me. I am on EndeavourOS with systemd-boot so I had to edit /etc/kernel/cmdline and add the rtc_cmos.use_acpi_alarm=1 there.
Then remember to run sudo reinstall-kernels to apply the change to all entries.
I’m on Ubuntu 24.04 (Linux 6.8.0) and my laptop wakes up randomly, sometimes in my backpack. This could be dangerous.
Before I try random solutions, is there a way to configure the laptop so that it only wakes up by pressing the power button? That would solve all problems, as it can never be unintentional. I don’t want it to wake up by USB events, lid events, keyboard events, or anything else.
I am on NixOS Unstable and I am also having this problem, it existed on 24.05 and after changing to Unstable. But it was fine in a 23.11 live ISO. I have tried 2 workarounds in my kernel params with no change in result. Currently I have to press hibernate, wait for it to save to disk, then hold down the power button until it actually shuts down. It will then restore like normal next boot. If it is important I am on an encrypted file system with my swap being a logical volume under the encrypted LVM on LUKS partition.
@tobiac
There are various ways to make the FW16 AMD laptop only wake up on the power button, using udev or scripts.
The following disables: Keyboard, Touchpad and lid opening from waking up the laptop.
I use a script on Ubuntu:
#!/bin/sh
# This file should be placed in directory: /usr/lib/systemd/system-sleep
PATH=/sbin:/usr/sbin:/bin:/usr/bin
case "$1" in
pre) echo disabled > /sys/devices/pci0000:00/0000:00:08.1/0000:c1:00.3/usb1/1-4/1-4.3/power/wakeup
echo disabled > /sys/devices/platform/AMDI0010:03/i2c-1/i2c-PIXA3854:00/power/wakeup
echo disabled >/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:4b/PNP0C09:00/PNP0C0D:00/power/wakeup
exit 0
;;
post) exit 0
;;
*) exit 1
;;
esac
Not that I am aware of, or I would have tried that.
To get a list of everything that could possibly wake up the laptop you can do: find /sys -iname "wakeup" | grep "\/power\/wakeup"
As you can see, there are lots of different things that can wakeup.
If you have a number-pad in addition to the keyboard, you will probably need to add an extra line in for that.
Thank you for your help, James!
I ended up with the following script, that disables every wakeup device except for the power button, which is perfect for my use case.
#!/bin/sh
# This file should be placed in directory: /usr/lib/systemd/system-sleep
PATH=/sbin:/usr/sbin:/bin:/usr/bin
case "$1" in
pre)
# Disable all wakeup devices except for the power button
find /sys/devices -path '*/power/wakeup' ! -path '*/LNXSYSTM:00/*' |
while read wakeup; do echo disabled > $wakeup; done
exit 0
;;
post)
exit 0
;;
*)
exit 1
;;
esac
Sleep and wake use cases are complex.
One use case you might want to consider is the battery wake up. This should wakeup the laptop when the battery is low. Purpose then is to hibernate, (suspend-to-disk) so you don’t loose work.
At least on Linux the choice of what wakes is user selectable so each user can choose.
#!/bin/sh
# This file should be placed in directory: /usr/lib/systemd/system-sleep
PATH=/sbin:/usr/sbin:/bin:/usr/bin
case "$1" in
pre)
# Disable all wakeup devices except for the power button
find /sys/devices -path '*/power/wakeup' \
! -path '*/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/*' |
while read wakeup; do echo disabled > $wakeup; done
exit 0
;;
post)
exit 0
;;
*)
exit 1
;;
esac
Wrote a script based on @James3 and @tobiac 's conversation to find the paths which you want to disable, since I am nervous about disabling everything.
#!/bin/sh
to_disable_names=("Touchpad" "Mouse" "Keyboard")
wakeups=$(find /sys/devices -path '*/power/wakeup')
to_disable_devices=()
for wakeup in $wakeups; do
device=$(echo "$wakeup" | xargs dirname | xargs dirname)
names=$(echo "$device" | xargs -I{} find {} -path '*/name' | xargs cat)
# # Uncomment to print all devices and names:
# echo "$wakeup vvvvvvvvvvvvvvvvvvvvvvvvvvvv"
# echo "$names"
# echo ""
# # ---end
# Uncomment to find wakeup paths:
for to_disable_name in "${to_disable_names[@]}"; do
if echo "$names" | grep -q "$to_disable_name"; then
printf '%-80s # %s\n' "$wakeup" "$to_disable_name"
fi
done
# ---end
done