Sign up ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

This question already has an answer here:

We intend to use a RPi at work to drive a status display panel - it will show our project's bug status and a few other statistics of vital importance.

I've been trying stop the screen-saver from blanking the screen with no luck. I've used the following formulas:

I can get Chromium auto-starting in Kiosk mode (I used an item in .config/autostart), but I cannot stop the screen-blanking. X-Windows does not seem to be responding to the .xinitrc file. I tried editing this file on the default user (pi) and also root. Nothing seems to make a difference to the screen saver.

Has anybody managed to stop screen-blanking on Raspbian? Is there a UI option or even a configuration file which will allow me to permanently change the screensaver time out?

I expect that some of these guides might have been tested on other RPi operating systems. Could it be that using the newer Raspbian I need to adopt a different approach to preventing screen blanking?

UPDATE 0: The xset command is able to stop screen blanking when entered directly (via sudo) from the xterm. It does not work when run from the .xinitrc file. Given that the machine auto-logs in as user "pi", how can I ensure that these commands are executed as root every time xwindows fires up.

This machine must be able to run unattended as a sort of kiosk. Once it's in place (it will be a wall-mounted display with no keyboard or mouse permanently attached) the only way we will be able to configure it is via ssh.

share|improve this question

marked as duplicate by goldilocks Sep 24 at 16:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

You should try running the three commands given (xset s off; xset -dpms; xset s noblank) from a terminal started in the X-Windows session. If the screen still blanks, your issue is that the commands are not enough to stop the screen from blanking. If the screen does not blank, then your issue is simply getting those commands executed properly in your X-window session. – Nakedible Oct 1 '12 at 13:04
I ran these commands as root from the actual terminal - the result was that screen blanking was disabled. This means that the .xinitrc was not running or with insufficient permissions at the time the command was executed. Any suggestions? – Salim Fadhley Oct 1 '12 at 13:38
I added an answer with the suggestion. – Nakedible Oct 1 '12 at 15:36
I have gotten this to work by doing everything (except adding the .xinitrc file) in both the links you provided and it works for me. – shaun5 Oct 4 '12 at 1:20
"I fixed this problem by installing xscreensaver: $ sudo apt-get install xscreensaver And disabling it from within the screensaver settings. Not the most elegant of solutions but is worked for me." This was the only way i could get it to work. Thanks for the tip! – user8317 Jul 4 '13 at 11:15

6 Answers 6

up vote 0 down vote accepted

Edit /etc/xdg/lxsession/LXDE-pi/autostart and add these three lines

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

Log out, log in, verify it's working with

xset -q
share|improve this answer
This didn't work for me. I had also commented out the \@xscreensaver line that was in this file. When I ran xset -q (thanks for that suggestion!) I saw that my xset lines had had no effect. I tried uncommenting the \@xscreensaver line and rebooted and I can see that the xset lines took effect, but while this does stop DPMS kicking in, the screensaver now starts after 10 minutes. – ZoFreX Jan 29 '14 at 15:28
Please note I approved an edit (from Kaarel Kitsemets) that changed the path from LXDE/autostart to LXDE-pi/autostart, but since I am not an LXDE user, I am not certain this is correct. – goldilocks Sep 24 at 16:04

You can enter the following three xset commands

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

into the


file (You should insert these after the first line).

share|improve this answer
Pupil becoming the teacher? ;) – Jivings Oct 4 '12 at 7:14
By default xset is not installed, so it cannot be run. You need to install x11-xserver-utils so you have an executable xset app. – user2250957 Sep 7 at 22:13

I had the same issue. At raspberry pi forum I found this:

You need to edit your script that's starting X. In the default build with lightdm the file to edit is


in the SeatDefaults section it gives the command for starting the X server which I modified to get it to turn off the screen saver as well as dpms

xserver-command=X -s 0 -dpms

That worked well for me - no more blank screen!

share|improve this answer

I fixed this problem by installing xscreensaver:

$ sudo apt-get install xscreensaver

And disabling it from within the screensaver settings. Not the most elegant of solutions but is worked for me.

share|improve this answer

As it was clarified in a comment that the commands work while being run from a terminal, but not from .xinitrc, and that Chromium is being started from .config/autostart/, I would suggest the following:

Create a shell script that runs the xset commands and add an entry in .config/autostart/ calling that script. That way, everything is started with the same method and either both work or neither works.

Also, these commands affect the current running X window session and are configurable by the user. They should not be run as root, but the user Chromium is running as.

Not knowing exactly how you start your X, or other details, this is probably the safest way - although there probably is a more straightforward way.

share|improve this answer

It's the console blanking that is kicking in.

I tried several suggested methods, but the one that worked for me was to edit /etc/rc.local and add a setterm -blank 0 command:

setterm -blank 0

So the file looks like this afterwards:

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

# turn off console blanking
setterm -blank 0

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"

exit 0

(entire file here to show exactly where I put it)

Essentially, the setterm -blank 0 command sets the terminal blanking period to 0 seconds (off), disabling the blanking which usually occurs. rc.local is executed at the end of the boot process with root privileges so it affects all the physical consoles (the TV & HDMI outputs here)

You could also change the command to include turning off the cursor (not the mouse pointer, text cursor in console):

setterm -blank 0 -cursor off

I've posted more on this on a few other questions, but this should fix your issue without resorting to drastic measures.

share|improve this answer

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