How to permanently disable sleep/suspend?
According to the Debian Wiki, you can also disable it via systemd like so:
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
While I have done this on my machine, I can't attest to its effectiveness. Not brave enough to try it out intentionally.
On Ubuntu 16.* try this.
Go to:
- System Settings
Click on:
Brightness & Lock
Turn screen off when inactive
Set it to 'Never'
Hope it helps :)
Run the following command to open the file to edit:
sudo -H gedit /var/lib/polkit-1/localauthority/10-vendor.d/com.ubuntu.desktop.pkla
Scroll to the bottom. Check to see if the following information exists, and if not add them:
[Disable suspend]
Identity=unix-user:*
Action=org.freedesktop.upower.suspend
ResultActive=no
Doing this makes suspend do nothing when you click it; it will disappear from the menu after you restart your computer.
You can run this command also to prevent computer from sleeping:
gsettings set org.gnome.desktop.session idle-delay 0