I have Ubuntu 11.10 with Gnome 3 (no Unity), gnome-screen-saver has been removed and replaced with xscreensaver. The screensaver stuff all works fine -- no complaints there. When I close my laptop lid, even for a second, the screen locks (and the dialog box asking for my password is xscreensaver's). I'd like for this not to happen...

Things I've tried/looked at already:

  • xscreensaver settings - the "Lock Screen After" checkbox is not checked (though I've also tried it checked and set to 720 minutes)
  • gconf-editor - apps -> gnome-screensaver -> lock_enabled is not checked
  • System Settings -> Power - "When the lid is closed" is set to "Do nothing" for both battery and A/C
  • System Settings -> Screen - Lock is "off"
  • gconf-editor - apps -> gnome-power-manager -> buttons -> lid_ac && lid_battery are both set to "nothing"

  • dconf-editor - apps -> org -> gnome -> desktop -> screensaver -> lock_enabled is not checked

Output from: gsettings list-recursively org.gnome.settings-daemon.plugins.power:

org.gnome.settings-daemon.plugins.power active true
org.gnome.settings-daemon.plugins.power button-hibernate 'hibernate'
org.gnome.settings-daemon.plugins.power button-power 'suspend'
org.gnome.settings-daemon.plugins.power button-sleep 'suspend'
org.gnome.settings-daemon.plugins.power button-suspend 'suspend'
org.gnome.settings-daemon.plugins.power critical-battery-action 'hibernate'
org.gnome.settings-daemon.plugins.power idle-brightness 30
org.gnome.settings-daemon.plugins.power idle-dim-ac false
org.gnome.settings-daemon.plugins.power idle-dim-battery true
org.gnome.settings-daemon.plugins.power idle-dim-time 10
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'nothing'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'nothing'
org.gnome.settings-daemon.plugins.power notify-perhaps-recall true
org.gnome.settings-daemon.plugins.power percentage-action 2
org.gnome.settings-daemon.plugins.power percentage-critical 3
org.gnome.settings-daemon.plugins.power percentage-low 10
org.gnome.settings-daemon.plugins.power priority 1
org.gnome.settings-daemon.plugins.power sleep-display-ac 600
org.gnome.settings-daemon.plugins.power sleep-display-battery 600
org.gnome.settings-daemon.plugins.power sleep-inactive-ac false
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'suspend'
org.gnome.settings-daemon.plugins.power sleep-inactive-battery true
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 0
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'suspend'
org.gnome.settings-daemon.plugins.power time-action 120
org.gnome.settings-daemon.plugins.power time-critical 300
org.gnome.settings-daemon.plugins.power time-low 1200
org.gnome.settings-daemon.plugins.power use-time-for-policy true

gnome-settings-daemon is running:

<~> $ ps -ef | grep gnome-settings-daemon
1000      1719  1645  0 19:37 ?        00:00:01 /usr/lib/gnome-settings-daemon/gnome-settings-daemon
1000      1726     1  0 19:37 ?        00:00:00 /usr/lib/gnome-settings-daemon/gsd-printer
1000      1774  1645  0 19:37 ?        00:00:00 /usr/lib/gnome-settings-daemon/gnome-fallback-mount-helper

Anything else I can check? Thanks!

  • Have a try with dconf-editor to see if there are any options there.
    – Zoke
    Jan 14 '12 at 3:31
  • Looked at dconf-editor, posted gsettings output -- doesn't seem to be anything in either of them... Jan 16 '12 at 20:43
  • is your gnome-settings-daemon running - n.b. this should display two /usr/lib entries ps -ef | grep gnome-settings-daemon
    – fossfreedom
    Jan 16 '12 at 22:57
  • @fossfreedom -- yes, the gnome-settings-daemon is running. Jan 18 '12 at 1:12
  • I have the same problem. Maybe this is a bug? bugs.launchpad.net/ubuntu/+source/xscreensaver/+bug/994754
    – Fern Moss
    May 14 '12 at 15:27

I managed to figure out a workaround, though I imagine there's a better solution out there. I looked at what was happening when my lid was closed and opened in /etc/acpi/lid.sh and found that xscreensaver was being called upon automatically. Not sure if different laptops have different settings and whatnot - I really don't know too much about this stuff.

In any case, I tried to make it simply obey its config file and not lock, but couldn't figure it out, so I ended up simply deleting the lines that involved xscreensaver. Now everything works great: no locking, and if the lid is closed passed the amount of time which you have set for xscreensaver to start, it'll start normally (and not lock).

I'm still not sure why xscreensaver is set up to be called automatically when the lid is closed or why it ignores its settings and locks when the lid is opened. I also don't get why with my older laptop this only happens sporadically (sometimes it locks every time, sometimes not at all), despite having the same lid.sh file.

I should also note that I'm using Ubuntu 12.04 with Unity, though I don't think that'll make any difference.

  • Thank you! Thank you thank you thank you thank you THANK YOU! Jul 1 '12 at 15:12
  • No problem! It was driving me insane too.
    – Fern Moss
    Jul 1 '12 at 22:00
  • Cool solution. I'm having a look in my /etc/acpi/lid.sh at the moment, and I'm not sure which xscreensaver call to comment out - there's an -unthrottle, and a -deactivate. I tried typing 'xscreensaver --help' into command line to see what these do, but it told me that actually 'xscreensaver' is not installed - does that mean I have a different problem? I'm also on Ubuntu 12.04 Unity, but I guess it could be a laptop specific thing: I'm using a lenovo ThinkPad T420s.
    – Alex
    Mar 8 '13 at 0:13
  • Hm, unless you manually installed xscreensaver, you probably don't have it. It is not the default.
    – Fern Moss
    Mar 14 '13 at 20:58
  • 2
    Hey, I'm having the same issue on Ubuntu 14.04 but apparently there is no /etc/acpi/lid.sh file. Is it the same for you? do you have another solution? Sep 6 '14 at 13:47

I'm running Ubuntu 12.04 Classic (meaning Unity, I think), and had the same trouble. Here's what I wanted: When the screen is not locked, closing and reopening the lid should not cause the screen to lock.

This is easily achievable by dconf-editor; simply browse to org > gnome > desktop > screensaver and uncheck the lock-enabled entry.

PS: It seems easy to do, but the answer was hard to find.

  • BTW: This is the same setting that is in Settings->Brightness and Lock->Lock. Confirmed working in Ubuntu 14.04, closing the lid doesn't lock the system anymore. Probably this was a bug in earlier versions of Ubuntu.
    – jmiserez
    Feb 15 '15 at 9:09
  • That solved the problem in Ubuntu MATE, however I had to navigate to org-mate-screensaver to uncheck the entry.
    – Muzaffar
    Mar 18 '16 at 1:36
  • Works for me on Ubuntu 20.04 with Unity.
    – Garrett
    Aug 6 at 21:05

Since GTK3 i have used

gsettings set org.gnome.desktop.lockdown disable-lock-screen 'true'

This will prevent all lock-screens. If you still want to be able to lock the screen you can use 'Switch User Account...' as a substitute. For 11.10, just set up a keyboard shortcut for the command

gdmflexiserver -xnest

For 12.04+ its

dm-tool switch-to-greeter
  • This works with gnome-screen-saver, but unfortunately not xscreensaver.
    – Fern Moss
    May 14 '12 at 15:26
  • The first command alone works in 12.10
    – alfC
    Nov 19 '12 at 0:38
  • Wonderful, works great on 13.04! For those who want to know what theirs is set to just use "gsettings get org.gnome.desktop.lockdown disable-lock-screen", it will most likely say false. Jun 7 '13 at 11:34

I am running Gnome Classic on 12.04, and Aibara Iduas's answer didn't work for me, but lead me to the answer. I had to edit /usr/share/acpi-support/screenblank, removing references in it to xscreensaver.


In order to disable screen locking on resume set LOCK_SCREEN=false in /etc/default/acpi-support

Running (as root or sudo) this command:

sed -i.bak s/'LOCK_SCREEN=true'/'LOCK_SCREEN=false'/ /etc/default/acpi-support

Will create a backup of the file (/etc/default/acpi-support.bak) and change the required LOCK_SCREEN option to false.


I want my screen to be locked when suspending, hibernating, when the screensaver becomes active because of being idle the configured time or when I lock manually.
I don't want the screen to be locked when I close the lid for a short time (while I am transporting my laptop). When closing the lid I want only to switch off the display.
All this can be configured via GUI-utils, except not locking the screen when the lid is closed — this feature seems to be missing in current GNOME :(

Nevertheless, the following script is doing the job for me

=== /etc/acpi/local/lid.sh.pre ===


. /etc/default/acpi-support  ## in this file: LOCK_SCREEN_LID=false

function fail () {
  echo $@ >> /tmp/lid_no_screensaver.log

function screensaver_disable () {
  export DISPLAY=$1
  if sudo -u $USER LANG=C gnome-screensaver-command -q | grep -q 'screensaver is active' ; then
    TIME_ACTIVE=$(DISPLAY=':0' sudo -u joe LANG=C gnome-screensaver-command --time | sed -r -e 's/The screensaver has been active for ([[:digit:]]*) seconds./\1/')
    [ $TIME_ACTIVE -ge 10 ] && return  ## we don't stop the screensaver when he should lock

  sudo -u $USER gnome-screensaver-command --deactivate
  ( sleep 1
    sudo -u $USER LANG=C gnome-screensaver-command -q | grep -q 'screensaver is inactive' || fail 'Unable to deactivate screensaver :('
  ) &

if [ "$LOCK_SCREEN_LID" = false ] ; then
  for DISPLAY in $(ps aux | grep X | grep -v grep | sed -e 's|^[^/]*||' | cut -d' ' -f2) ; do
    for USER in $(ps aux | grep gnome-screensaver | grep -v grep | cut -d' ' -f1) ; do
      if ! grep -q open /proc/acpi/button/lid/*/state; then
        screensaver_disable $DISPLAY $USER

=== /etc/default/acpi-support ===


Tested with gnome-screensaver + GNOME 3.4.2 + Debian Wheezy


None of the answers above worked for me. I had to do this:

sudo vim /etc/UPower/UPower.conf

# <snip> ...


# <snip> ...

It required a reboot to take effect. And your other Ubuntu/GNOME settings respecting Lid events are probably nuked.


Install gnome-tweak-tool Install gnome-tweak-tool. Click on "Shell" on the right and there you can choose what to do with or without the battery.

  • Sadly they both said "do nothing". Jan 21 '12 at 0:43
  • These options don't seem to do what is being asked for; at least on Ubuntu 12.04. Feb 10 '14 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.