The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 1,390     Votes:  2 
Tags: 18.04   power-management  
Link: 🔍 See Original Answer on Ask Ubuntu ⧉ 🔗

URL: https://askubuntu.com/q/1176031
Title: Ubuntu 18.04 does not suspend using physical power button of the computer when screen is locked
ID: /2019/09/23/Ubuntu-18.04-does-not-suspend-using-physical-power-button-of-the-computer-when-screen-is-locked
Created: September 23, 2019
Upload: September 15, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


I found a superuser answer that applies to your situation:

Someone pointed me to the file /etc/systemd/logind.conf. I was able to set parms that allowed the suspend key to work in any situation regardless what the system requests. Here is an example of my settings.

[Login]
# NAutoVTs=6
# ReserveVT=6
# KillUserProcesses=no
# KillOnlyUsers=
# KillExcludeUsers=root
# InhibitDelayMaxSec=5
# HandlePowerKey=poweroff
HandleSuspendKey=suspend
# HandleHibernateKey=hibernate
HandleLidSwitch=lock
# PowerKeyIgnoreInhibited=no
SuspendKeyIgnoreInhibited=yes
# HibernateKeyIgnoreInhibited=no
LidSwitchIgnoreInhibited=yes
# IdleAction=ignore
# IdleActionSec=30min

For some reason a restart was not applying the changes, so I had to run the following command:

sudo systemctl restart systemd-logind
⇧ How to set intel_idle.max_cstate=1 I cannot open gnome-terminal on Ubuntu 18.04  ⇩