0

On my Lenovo T440p with Ubuntu 20.10 - Regolith-desktop I have the issue, that I can't disable the wakeup on opening the laptop lid.

I already tried the solution presented in most instructions of changing the file in /etc/systemd/logind.conf. This didn't work. I could also not find any setting in the BIOS/UEFI.

Since I figured out the solution and couldn't find it anywhere, I present it here, in case anyone else has the same problem.

  • Although not implemented in an Ubuntu system, you can check and adapt this alternative to the above answer using a systemd service: https://github.com/szaffarano/nix-dotfiles/pull/86/files – Sebastian Feb 17 '24 at 15:10

1 Answers1

0

Call cat /proc/acpi/wakeup. This will look like this:

Device  S-state   Status   Sysfs node

LID S4 enabled platform:PNP0C0D:00 SLPB S3 enabled platform:PNP0C0E:00 IGBE S4 disabled pci:0000:00:19.0 EXP2 S4 enabled pci:0000:00:1c.1 EXP3 S4 disabled XHCI S3 enabled pci:0000:00:14.0 EHC1 S3 enabled pci:0000:00:1d.0 EHC2 S3 enabled pci:0000:00:1a.0

By writing i.e. LID to this file you can change the status:

root@machine # echo 'LID' >> /proc/acpi/wakeup

If you call cat again like before, you will see, that LID is *disabled now. Writing LID again to it, enables it again. The change is immediate.

Unfortunately, this change is not permanent. For this purpose, you can create a shell script, which is executed every time you start up your computer:

Make a new file, i.e.

root@machine # nano disableWakeup.sh

Paste this content into it

result=$(cat /proc/acpi/wakeup | grep 'enabled' | grep -o $1)
if [ "$result" != "" ]
then
echo "$result is enabled"
echo $1 >> /proc/acpi/wakeup 
echo "Disabled $1"
fi

Now, you have to make this file executable

root@machine # chmod 755 disableWakeup.sh

After this you can call the script by ./disableWakeup.sh LID. This disables wakeup by LID-Switch. But you can replace LID by any other trigger, i.e. ./disableWakeup.sh EHC1.

To execute it automatically, there are different ways, described here, here and here, also others. I prefer adding a line at the end of the file /etc/bash.bashrc

/location/of/the/scrip/i.e./opt/loginScript/disableWakeup.sh

This is then called every time, you open a shell. More often than needed, but it works.