How do I disable all lid close processes? [duplicate]
Solution 1:
For 13.10 - 21.10:
To disable Ubuntu doing anything closing the laptop lid:
-
Open the
/etc/systemd/logind.conf
file in a text editor as root, for example,sudo -H gedit /etc/systemd/logind.conf
-
If
HandleLidSwitch
is not set toignore
then change it:HandleLidSwitch=ignore
Make sure it's not commented out (it is commented out if it is preceded by the symbol
#
) or add it if it is missing. -
Restart the systemd daemon (be aware that this will log you off) with this command:
sudo systemctl restart systemd-logind
or, from 15.04 onwards:
sudo service systemd-logind restart
See also: Ubuntu Server 13.10 now goes to sleep when closing laptop lid
For GNOME Users:
If you are using GNOME (the default in 18.04+), then you can do this easily without changing system settings by using the "Gnome Tweak Tool". It can be installed from the Ubuntu Software Store (It is called GNOME Tweaks). Or if you prefer the console: sudo apt-get install gnome-tweak-tool
Run it after installing, then under Power, Turn off the setting to do nothing when lid is closed. I tested this on Ubuntu 18.04 and it works.
Solution 2:
For 11.04 and earlier:
Do nothing when laptop lid is closed (helpful when an external monitor is connected):
-
Alt + F2 and enter this:
gconf-editor
- apps > gnome-power-manager > buttons
- Set
lid_ac
andlid_battery
tonothing
OR
1.When on AC Power, do nothing when laptop lid is closed: gconftool-2 -t string -s /apps/gnome-power-manager/buttons/lid_ac nothing
2.When on Battery Power, do nothing when laptop lid is closed: gconftool-2 -t string -s /apps/gnome-power-manager/buttons/lid_battery nothing
Blank screen when laptop lid is closed (preferable when no external monitor is connected):
- System > Preferences > Power Management
- On AC Power (On Battery Power) > Actions
- When laptop lid is closed: Blank screen
OR
1.When on AC Power, blank screen when laptop lid is closed: gconftool-2 -t string -s /apps/gnome-power-manager/buttons/lid_ac blank
2.When on Battery Power, blank screen when laptop lid is closed: gconftool-2 -t string -s /apps/gnome-power-manager/buttons/lid_battery blank
Solution 3:
Ubuntu 15.10 - Ubuntu 20.04
TL;DR: Add IgnoreLid=true
to /etc/UPower/UPower.conf
-
Open a terminal and run:
sudoedit /etc/UPower/UPower.conf
-
Change
IgnoreLid
toIgnoreLid=true
-
Save and exit the editor.
-
Restart the UPower service with:
service upower restart