Automatic suspend - "Computer will suspend very soon because of inactivity" - how can I disable this?

The solution is to disable automatic suspend:

  1. Open GNOME Control Center, go to Power tab (or simply gnome-control-center power)
  2. In Suspend & Power Button set Automatic suspend, to Off when Plugged In.

<code>gnome-control-center power</code>

This will change settings from

$ dconf dump / | grep -i "suspend\|sleep"
sleep-inactive-ac-timeout=900
sleep-inactive-ac-type='suspend' # <
sleep-inactive-battery-timeout=900

$ gsettings list-recursively | grep -i "suspend\|sleep"
org.gnome.desktop.screensaver ubuntu-lock-on-suspend true
org.gnome.settings-daemon.plugins.power button-power 'suspend'
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 900
org.gnome.settings-daemon.plugins.power power-button-action 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor false
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'suspend' # <
org.gnome.settings-daemon.plugins.power button-suspend 'suspend'
org.gnome.settings-daemon.plugins.power button-sleep 'hibernate'
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 900
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend'

to

$ dconf dump / | grep -i "suspend\|sleep"
sleep-inactive-ac-timeout=900
sleep-inactive-ac-type='nothing' # <
sleep-inactive-battery-timeout=900

$ gsettings list-recursively | grep -i "suspend\|sleep"
org.gnome.desktop.screensaver ubuntu-lock-on-suspend true
org.gnome.settings-daemon.plugins.power button-power 'suspend'
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 900
org.gnome.settings-daemon.plugins.power power-button-action 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor false
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing' # <
org.gnome.settings-daemon.plugins.power button-suspend 'suspend'
org.gnome.settings-daemon.plugins.power button-sleep 'hibernate'
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 900
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend'