15

I want lightdm to enter power save after a specific period of time. If I'm logged in then my screen will time out as per the user settings, however when no one is logged in the screen will stay on forever.

I've looked at some posts that make some suggestions on what to do, but none of them seem to work or it's down to my limited knowledge of Linux.

updated 6/2/2014: The settings shown by sudo -H -u lightdm dbus-launch --exit-with-session gsettings list-recursively org.gnome.settings-daemon.plugins.power are as follows:

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 'interactive'
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 'suspend'
org.gnome.settings-daemon.plugins.power idle-brightness 30    
org.gnome.settings-daemon.plugins.power idle-dim true    
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend' 
org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor false    
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 0    
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 120    
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'suspend' 
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

I would have assumed the sleep-inactive-ac-timeout 120 would have been the correct entry, but it doesn't time-out unless I'm actually logged in as a user.

4
  • OK - people have marked this as a repeat, but the suggested solution does not work at all for me. I don't seem to have the same settings listed and those in the suggested resolution and those that are set for the lightdm account match mine directly, but still the screen does not time out when not logged in as a user. Any other ideas on what's going on?
    – Scottie
    Feb 6, 2014 at 14:14
  • 2
    Can you add what version of Ubuntu and what distro/desktop edition you are using.
    – Mateo
    Feb 21, 2014 at 19:29
  • have you looked into laptop-mode-tools or TLP ? The first one triggers the prebuild power-saving options and add a .conf file to manage it, the second is a third-party application which I use and works really well (the .conf file is very well explained)
    – MrVaykadji
    Feb 21, 2014 at 21:31
  • Confirmed bug and fixed bugs.launchpad.net/ubuntu/+source/unity-greeter/+bug/1237372
    – Braiam
    May 12, 2014 at 12:34

2 Answers 2

5
+100

This is a confirmed bug:

And bugs, generally, are off-topic here.

Anyway, I found the following workaround (comment #33 related to the bug #1245474) which works for me:

[...]I've added a script to handle turning off the X dpms timeouts when the user logs in. Here are the three files that I've created. First, the config file:

/etc/lightdm/lightdm.conf.d/50-dpms.conf

[SeatDefaults] 
display-setup-script=/etc/lightdm/dpms-enable
session-setup-script=/etc/lightdm/dpms-disable

Make sure the above is owned by root. Easiest is to create it with sudoedit.

Next are the two scripts. These need to be owned by root and made executable (chmod +x).

/etc/lightdm/dpms-enable

#!/bin/sh

(
    # This delay is required. Might be because the X server isn't
    # started yet.
    sleep 10

    # Set up a 5 minute timeout before powering off the display.
    xset dpms 0 0 300 
) &

/etc/lightdm/dpms-disable

#!/bin/sh

(
    # This delay is required. Might be because the X server isn't
    # started yet.
    sleep 10

    # Turn off X's handling of dpms timeout. Otherwise
    # gnome-settings-daemon and gnome-screensaver will fight over it.
    xset dpms 0 0 0 
) &

Given the above, I get monitor power-down at the login screen, and the dpms timeouts are set to zero for a user session, so the screensaver works properly.

2
  • Not sure if any light can be shed on why this now isn't working after an upgrade to 14.04. Obviously the lock screen is now different, so I suspect the above no longer works. Ideas?
    – Scottie
    Apr 29, 2014 at 18:29
  • This is not working on Ubuntu 16.10 (lightdm + openbox).
    – Xdg
    Jan 16, 2017 at 19:21
1

I created a file in /etc/lightdm/lightdm.conf.d/ named 50-dpms.conf.

[SeatDefaults]
display-setup-script=/usr/local/bin/dpms-start

The dpms-start file is a script that lets user lightdm enable dpms.

#!/bin/sh
sudo xhost +si:localuser:lightdm # creates a user 'lightdm'
sudo su lightdm -s /bin/bash <<HERE # lightdm starts dpms from HERE
/usr/bin/xset +dpms
exit
HERE # and stops at this HERE

Be sure to type sudo chmod +x /etc/lightdm/lightdm.conf.d/dpms-start to make it executable. In Ubuntu 14.04 I use this with both Unity and Cinnamon and Unity-Greeter for lock screen. I don't use Synergy for multiple displays in lightdm. Another way would be to add root to the lightdm group in /etc/group. That would eliminate the need to create the lightdm user in dpms-start.

1
  • above script appears to have syntax errors, would you please fix it?
    – kenn
    Apr 24, 2015 at 16:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .