Skip to content

Instantly share code, notes, and snippets.

@bzerangue
Last active January 8, 2021 11:19
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save bzerangue/e64c7122129b628302046fa8702dddd2 to your computer and use it in GitHub Desktop.
Save bzerangue/e64c7122129b628302046fa8702dddd2 to your computer and use it in GitHub Desktop.
Disable Sleep/Suspend and WiFi in Ubuntu 16.04 LTS

On Ubuntu 16.04 LTS, I successfully used the following to disable suspend:

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

And this to re-enable it:

sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

The command-line equivalent in ubuntu 16.04 to disable WiFi

nmcli radio wifi off

To re-enable, use

nmcli radio wifi on

To help

nmcli radio help nmcli radio wifi help

@tomreyn
Copy link

tomreyn commented Oct 26, 2018

Regarding disable-suspend.md:

Masking all these targets can have side effects, such as dbus-daemon getting stuck in a loop trying to trigger the suspend target (causing a high CPU load).

A better approach is to configure the system to not go to sleep when it's idle, and to ignore ACPI events which would normally trigger sleep / suspend. logind.conf(5) discusses the following options - which could be set in e.g. /etc/systemd/logind.conf.d/ignore-acpi-events.conf:

IdleAction=
HandlePowerKey=
HandleSuspendKey=
HandleHibernateKey=
HandleLidSwitch=
HandleLidSwitchDocked=

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment