How to disable sleep/suspend at login screen?
I found a solution from here https://askubuntu.com/a/543861/718511, though they wanted to do the reverse so it's slightly modified. Essentially a script is made to disable dpms and lightdm told to run it.
In /etc/lightdm/lightdm.conf.d/ make a file 50-dpms.conf:
sudo nano /etc/lightdm/lightdm.conf.d/50-dpms.conf
Add the lines
[SeatDefaults]
display-setup-script=/usr/local/bin/dpms-stop
Close the file
In /usr/local/bin/ create a file dpms-stop:
sudo nano /usr/local/bin/dpms-stop
Add the lines
#!/bin/sh
sudo xhost +si:localuser:lightdm # grants localuser rights to X session
sudo su lightdm -s /bin/bash <<HERE
/usr/bin/xset -dpms
exit
HERE
Close the file
Make the file executable:
sudo chmod +x /usr/local/bin/dpms-stop
At reboot it worked for me.
I had the same issue and found the solution in this forum thread. Setting the appropriate value using gsettings worked for me. Note that this needs to be set for the lightdm
user, not for your own account or for root
. Maybe this was your problem?
Here are the commands you need to run:
sudo su
su lightdm -s /bin/bash
dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0
exit
exit
Note that this only disables sleep for the machine when on AC power. Since I am using a desktop machine, this was sufficient. If you also want to disable sleeping when on battery power, you also need to set the sleep-inactive-battery-timeout
value to 0
.
After your have run these commands, restart LightDM and you should be good to go.
sudo service lightdm restart