88

I am running the Debian wheezy beta and using my Pi to display my geckoboard dashboards using midori, as a result I want to prevent the screen from going blank, which it does after 10 minutes (though it doesn't seem to turn off the backlight). I have searched through the menu options and can not find how to prevent this. I came across a post on raspberrypi.org suggesting that the following:

sudo sh -c "TERM=linux setterm -blank 0 >/dev/tty0"

would solve the problem, but it does not work. I have also tried changing BLANK_TIME to zero in /etc/kbd/config without success.

0

5 Answers 5

76

This is an X power-saving thing.

Firstly, you may need to install xset, a lightweight application that controls some X settings.

apt-get install x11-xserver-utils

Now open up your ~/.xinitrc file (if you don't have one then create it) and enter this:

xset s off         # don't activate screensaver
xset -dpms         # disable DPMS (Energy Star) features.
xset s noblank     # don't blank the video device

exec /etc/alternatives/x-session-manager      # start lxde

This file runs once every time X starts and should solve the problem. I copy and pasted it from my own .xinitrc and can confirm that my screen does not blank.

10
  • 3
    Which account should the .xinitrc be created for? The pi account (which auto-logs in) or the root account (which owns the x-server)? Commented Oct 1, 2012 at 14:27
  • 2
    what does exec /etc/alternatives/x-session-manager do? When I take it out the bar at the bottom is gone. I'm curious about how it all fits together. A brief explanation would be appreciated.
    – Scoop
    Commented Dec 21, 2012 at 21:52
  • 3
    Modifying: /etc/xdg/lxsession/LXDE/autostart as described here and modifying ~/.xinitrc + /etc/kbd/config as described from cwd did not get me any further. My screen still gets black with backlight.
    – Andi Giga
    Commented Apr 14, 2016 at 12:21
  • 8
    Can confirm this does not work on the Pi 3
    – djthoms
    Commented Apr 14, 2016 at 18:40
  • 2
    This certainly didn't work on my Raspberry PI 2 Model B running Raspbian Jessie.
    – ThN
    Commented Jul 25, 2016 at 15:53
28

The other solutions here did not work for me (fresh Raspbian, boot to GUI). Instead, this worked:

  1. Open up /etc/lightdm/lightdm.conf using your favorite text editor (I prefer nano).
  2. Look for the line #xserver-command=X. Change it to xserver-command=X -s 0 dpms
    • It should be at line 87 if things don't change.
  3. Save and reboot.

Source

8
  • This DID work on my Raspberry PI 2 Model B running Raspbian Jessie.
    – ThN
    Commented Jul 25, 2016 at 18:19
  • 1
    This worked for me on Pi3 with Jessie
    – MikeT
    Commented Oct 10, 2016 at 20:32
  • I'm trying to understand these options. -s 0 sets the screen timeout to 0 minutes, which I assume makes it 'never'. (Is this different from -s off?) Why dpms, though, not -dpms? Don't I want to disable display power management services? Commented Nov 15, 2017 at 15:17
  • @TheGuywithTheHat Have you tried this solution with -dpms? Please report back and maybe we can infer what's going on.
    – Aloha
    Commented Nov 15, 2017 at 17:09
  • @pandalion98 Testing it right now with dpms, -dpms, and neither. Will report back soon. Commented Nov 15, 2017 at 17:29
14

I think @Jivings answer may be better, but I have it in my notes to do this:

  • Install apt-get install x11-xserver-utils

  • Edit /etc/xdg/lxsession/LXDE/autostart

Append these lines:

@xset s noblank
@xset s off
@xset -dpms

Possibly also comment out the line that says @xscreensaver -no-splash, so the complete file should look something like this:

@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
# @xscreensaver -no-splash

@xset s noblank
@xset s off
@xset -dpms

Also edit /etc/kbd/config and make sure these values are set as follows (however I believe this is only for when the lightweight desktop (LXDE) is not running (i.e. the pi is still in text / terminal mode):

BLANK_TIME=0
BLANK_DPMS=off
POWERDOWN_TIME=0

I believe that the /etc/xdg/lxsession/LXDE/autostart may be the sort of system-wide version of ~/.xinitrc but someone else probably knows the nuances better.

4
  • 2
    Edits to /etc/kbd/config solved the problem for me.
    – Steve
    Commented Dec 12, 2014 at 16:47
  • I applied all the changes mentioned in this answer. This certainly didn't work on my Raspberry PI 2 Model B running Raspbian Jessie.
    – ThN
    Commented Jul 25, 2016 at 17:38
  • 1
    I think there has been some change with profiles by default, the autostart you need to edit might be ~/.config/lxprofile/LXDE-pi/autostart. Commented Jan 2, 2017 at 21:23
  • my rpi 2 on raspbian jessie needed the above edits to ~/.config/lxsession/LXDE-pi/autostart as jason points out below
    – mfink
    Commented Jul 9, 2017 at 13:03
10

To prevent the screen from going blank try adding consoleblank=0 to the end of the first line of /boot/cmdline.txt

Source

5
  • Please don't post duplicate answers for duplicate questions. Commented Feb 2, 2017 at 14:40
  • 3
    It was a very difficult answer to find and figured it applied. Why not vote for this to be a duplicate question instead of commenting?
    – Tim Penner
    Commented Feb 2, 2017 at 15:15
  • I voted for the original question to be marked as duplicate of this one. Keeping either of the answers sounds fine, but I suppose you prefer to have the one that got upvoted. Commented Feb 2, 2017 at 15:30
  • 2
    I wouldn't want my answer to only be on the duplicate, I would want it on the master of the two - even if I found the other question first. Which is why i suggested you vote instead of comment
    – Tim Penner
    Commented Feb 2, 2017 at 15:31
  • 1
    This is the only solution that has worked for my Pi Zero with a monitor but no keyboard, and no X11.
    – Memetic
    Commented Mar 30, 2017 at 0:29
4

What worked for me was editing ~/.config/lxsession/LXDE-pi/autostart and commenting out the screensaver, all the other xset commands didn't seem to affect it when it is started here:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
#@xscreensaver -no-splash

You might also need to add one or both of these lines to disable the power management:

@xset dpms 0 0 0
@xset -dpms

On the version of Raspbian Jessie I got the utils were already installed.

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