This method disables the ‘automatic suspend’, but should still allow you to ‘manually suspend’ the system. This method works for Ubuntu 14.04, 16.04 and 18.04.

General Instructions

##run as root
cd /etc/polkit-1/localauthority/50-local.d/
touch com.ubuntu.disable-suspend.pkla
nano com.ubuntu.disable-suspend.pkla
##insert the following
[Disable suspend (upower)]
Identity=unix-user:*
Action=org.freedesktop.upower.suspend
ResultActive=no
ResultInactive=no
ResultAny=no
[Disable suspend (logind)]
Identity=unix-user:*
Action=org.freedesktop.login1.suspend
ResultActive=yes
ResultInactive=no
ResultAny=yes
[Disable suspend when others are logged in (logind)]
Identity=unix-user:*
Action=org.freedesktop.login1.suspend-multiple-sessions
ResultActive=yes
ResultInactive=no
ResultAny=yes
##save and reboot system

Detailed Instructions

  1. Obtain root permissions by using ‘sudo bash’
  2. Change directory (cd) into ‘/etc/polkit-1/localauthority/50-local.d/
  3. Create the file ‘com.ubuntu.disable-suspend.pkla’ using the touch command; double check file creation and spelling using ‘ls’ in the current directory
  4. Edit the file you just created (I used nano)
  5. Add the following (helps if you have SSH access so you can copy/paste the below entry); then user ‘ctrl-x’, then ‘y’ to confirm save, then ‘enter’ to proceed with saving the change
    [Disable suspend (upower)]
    Identity=unix-user:*
    Action=org.freedesktop.upower.suspend
    ResultActive=no
    ResultInactive=no
    ResultAny=no
    [Disable suspend (logind)]
    Identity=unix-user:*
    Action=org.freedesktop.login1.suspend
    ResultActive=yes
    ResultInactive=no
    ResultAny=yes
    [Disable suspend when others are logged in (logind)]
    Identity=unix-user:*
    Action=org.freedesktop.login1.suspend-multiple-sessions
    ResultActive=yes
    ResultInactive=no
    ResultAny=yes
  6. Double-check the entry saved to the file by re-entering the file either through editing the file or using ‘cat
  7. Reboot system