17

How do I stop my laptop from suspending when closing the lid under lightdm - the power management settings in xfce or gnome 3 does not seem to apply when the window manager is not running.

Braiam
  • 67,791
  • 32
  • 179
  • 269
jonasl
  • 330

4 Answers4

10

At the bottom of /etc/UPower/UPower.conf, set IgnoreLid=true.

jokerdino
  • 41,320
Will
  • 116
  • Thanks a bunch, this works! Tested to set it and unset it again on 12.04 – jonasl Sep 06 '12 at 18:13
  • doesn't the: "At the bottom of /etc/UPower/UPower.conf, set IgnoreLid=true." prevents any action when the lid is closed for all users? – Jo Rijo Oct 30 '12 at 21:17
  • 2
    This worked for me after a restart. – Allen Nov 18 '14 at 20:34
  • I had to undo this change: lightdm was not starting anymore after I set IgnoredLid=true. I'm on Ubuntu 14.04. – Kurt Bourbaki Mar 09 '16 at 09:32
  • 1
    This does not work (currently). I have this option set in UPower.conf, and lightdm still suspends the machine when the lid is closed. – alex.forencich Mar 16 '18 at 19:44
  • @alex.forencich Can confirm, this doesn't work. However, this answer does: https://askubuntu.com/a/1140362/1011478 – A S Nov 01 '19 at 05:42
4

Run

sudo vim /usr/share/polkit-1/actions/org.freedesktop.upower.policy

and replace the yes to no in the allow_active tags and replace from "yes" to "no" for inactive tags.

either

  • reboot
  • exit your X session, alt+ctrl+f1, and run sudo /etc/init.d/lightdm restart

Note: I just tested it, and restoring the values back to yes did not restore the previous functionality... no clue why.

Also, lightdm will still try to sleep, but will be denied. So every time you open the lid, you will get a message box telling the sleep/suspend failed.

this will also prohibit active suspend/sleep

...yet another annoyance that gnome3 brings us

Javier Rivera
  • 35,153
gcb
  • 255
  • Thanks for the research, looks like it cant be completly sovled without the hickups you mention – jonasl Aug 17 '12 at 12:29
3

Run

gksudo gedit /etc/systemd/logind.conf

Uncomment

HandleLidSwitch=suspend

And change suspend to ignore.

Worked for me in 16.04.

Melebius
  • 11,431
  • 9
  • 52
  • 78
  • This is perfect! I was starting my laptop with lid closed, external monitor hooked on and ac power, and seconds after I got to the login page it would go in suspend right away. (I used variant HandleLidSwitchExternalPower) – bksunday Sep 12 '20 at 20:41
1

Changing allow_active to no disable suspend for everything. I can't find better way to solve this but to switch to another console by pressing CTRL+ALT+F1 and then close the lid.

Peachy
  • 7,117
  • 10
  • 38
  • 46