How to disable screen blanking

22 posts
by Foggy » Sun Sep 23, 2012 12:19 pm

I have tried to stop the terminal from blanking out.

sudo nano /etc/rc.local and added
setterm -blank 0

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

Nothing seems to work - Even after reboot.

Any suggestions would be appreciated - its starting to drive me crazy.

Best wishes.

Posts: 18
Joined: Mon Aug 20, 2012 12:26 pm
Location: Reading UK
by kilokahn » Sun Sep 23, 2012 4:04 pm
Totally +1 on this! :)
Chris Haslage, Owner Productions
Posts: 21
Joined: Sun Sep 09, 2012 3:41 am
Location: Tallmadge, OH, USA
by Foggy » Sun Sep 23, 2012 6:22 pm

I think I have figured it out.
However I'm a newbie so you may want to double check - But it works for me.

sudo nano /etc/kbd/config

Change these two lines.

# screen blanking timeout. monitor remains on, but the screen is cleared to
# range: 0-60 min (0==never) kernels I've looked at default to 10 minutes.
# (see linux/drivers/char/console.c)
BLANK_TIME=0 (Was 30)

# Powerdown time. The console will go to DPMS Off mode POWERDOWN_TIME
# minutes _after_ blanking. (POWERDOWN_TIME + BLANK_TIME after the last input)
POWERDOWN_TIME=0 (I think it was 15)

Re start the file or just reboot
sudo /etc/init.d/kbd restart

Monitor has now been on for over 2 hrs - so looking good.
Hope it helps some one.

Best wishes.

Posts: 18
Joined: Mon Aug 20, 2012 12:26 pm
Location: Reading UK
by Rasadmin » Mon Oct 01, 2012 12:57 pm
Tried Foggy's way, and it did not work for me.
I found another solution elsewhere in these forums and it works for me:

sudo nano /etc/lightdm/lightdm.conf

In that file, look for:

and insert this line:
xserver-command=X -s 0 dpms

My test monitor has been on for a couple of days now :-)
User avatar
Posts: 2
Joined: Mon Oct 01, 2012 12:20 pm
by hgreen » Mon Oct 22, 2012 3:58 am
This is a great solution for me, thanks. The app I'm running outputs log messages to the console, so I often just plug in a HDMI screen to see the status of the application on the RPi, but I don't connect a keyboard to it.

I just set those two lines to 0 (BLANK_TIME and POWERDOWN_TIME) and this worked great.
I am running Debian Wheezy (soft-float).
Posts: 9
Joined: Tue Sep 04, 2012 1:32 am
Location: Perth, Australia
by SmokyFrosty » Wed Nov 14, 2012 4:48 pm
Neither fix is working for me, Pi still blanks after 15 mins. Need a system that is always on screen wise.

Posts: 3
Joined: Wed Nov 14, 2012 3:59 pm
by RaTTuS » Wed Nov 14, 2012 4:52 pm
SmokyFrosty wrote:Neither fix is working for me, Pi still blanks after 15 mins. Need a system that is always on screen wise.


the kbd version will stop all console screen blanks <- ask smart Questions
"That's not right, the badgers have moved the goalposts."
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX - Prosliver FTW
User avatar
Posts: 5721
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
by jojopi » Wed Nov 14, 2012 5:27 pm
RaTTuS wrote:the kbd version will stop all console screen blanks
Putting it another way, kbd will only stop the kernel from blanking the screen when X is not running.

And lightdm.conf is only effective if you boot straight into X using that particular display manager.

And .xinitrc only works after you log in and run "startx" (or use a display manager that defaults to a user session, and allows .xinitrc instead of .xsession).

So you might need all three. And if you run full-screen non-X programs like XBMC you may need to configure them not to blank as well.
User avatar
Posts: 2149
Joined: Tue Oct 11, 2011 8:38 pm
by Alvaro » Wed Nov 14, 2012 8:00 pm
So it is not possible at all with the default display manager? (There is no .xinitrc file in the home directory.)
Posts: 29
Joined: Sun Aug 19, 2012 8:47 am
by Blackcell » Fri Nov 16, 2012 9:22 pm
Is there no way to fix this? I'm sorry I'm not a linux programmer, but it seems ridiculous that there isn't a fix to keep the frikin screen from turning off.
Posts: 20
Joined: Mon Jan 23, 2012 2:25 pm
by tleland » Tue Feb 19, 2013 4:08 pm
Only way I've been able to fix this issue is install xscreensaver. To install you need "sudo apt-get install xscreensaver" . In the gui you will now have the "screensaver" option under preferences. Here you can disable the blank screen. Let me know if this makes sense and helps!
Posts: 2
Joined: Tue Jan 15, 2013 1:36 pm
by Anu » Mon Feb 25, 2013 5:03 pm
Installing xscreensaver worked on me too ...Thanks
Posts: 1
Joined: Mon Feb 25, 2013 4:59 pm
by pi18 » Tue Apr 16, 2013 11:56 am
Found this thread as I was having the same blank screening issues ever since I enabled the PI to boot automatically, xscreensaver did the trick ! Many thanks for sharing your post tleland :D
Posts: 1
Joined: Tue Apr 16, 2013 10:36 am
by tleland » Tue Apr 16, 2013 12:44 pm
Glad i was able to help.
Posts: 2
Joined: Tue Jan 15, 2013 1:36 pm
by pabluk » Wed May 01, 2013 9:06 pm
For me it worked by editing /etc/X11/xinit/xserverrc and changing
Code: Select all
exec /usr/bin/X -nolisten tcp "$@"

Code: Select all
exec /usr/bin/X -s 0 dpms -nolisten tcp "$@"

I'm using Raspbian “wheezy” and I start my X session with startx.
User avatar
Posts: 1
Joined: Wed May 01, 2013 8:30 pm
Location: Nantes, France
by DetlevSchm » Thu May 02, 2013 3:46 pm
And another one:

I have a non-pygame Python script running in the background, that displays every five minutes some stuff on the desktop.

That alone is not sufficient, but after I put
Code: Select all

in the loop, the screen refrains from blanking.

Needs initial
Code: Select all
import pygame
User avatar
Posts: 65
Joined: Tue Mar 12, 2013 8:43 am
Location: Germany
by tom.chamberlain » Sat May 25, 2013 11:06 am
I got fed up with all the different options and just wrote a script to kill the screen saver process should it be running;

1 create a file /home/pi/


PID=`ps -ef | grep 'xscreensaver -no-splash' | grep -v "grep" | cut -c 3-14 | sed 's| ||g'`
kill $PID

exit 0

2 Set the file to executable (chmod +x /home/pi/

3 Make the file run automatically every minute in cron by executing crontab -e and entering

* * * * * /home/pi/ > /dev/null

Very hacky and might not be safe but was quick and simple for me. For an explanation;

It prints the process tree (ps -ef), takes only lines with the phrase 'xscreensaver -no-splash' in (grep 'xscreensaver -no-splash'), then removes lines with the word grep in (as the grep process itself will appear), then takes characters 3-14 that contain the ID of the process (cut -c 3-14), then removes all white space using sed, then issues the kill command on the process ID).
Posts: 2
Joined: Sat May 25, 2013 10:54 am
by solar3000 » Thu Dec 19, 2013 8:33 pm
that's not going to work because xscreensaver is not installed by default.
Posts: 300
Joined: Sat May 18, 2013 12:14 am
by carlhage » Sat Mar 15, 2014 2:22 am
I finally had success disabling blanking with the default Raspbian installation. The xset program is not installed by default, so I did the "sudo apt-get install x11-xserver-utils". I tested using the "xset q" command. To disable the screen blanking with the default LXDE, edit the file:
comment out a xscreensaver command, and add these xset lines
Code: Select all
#@xscreensaver -no-splash
@xset s off
@xset -dpms
@xset s noblank

More info at:
Posts: 2
Joined: Sat Mar 15, 2014 1:53 am
by naumann » Tue Jul 22, 2014 11:03 am
by Rasadmin worked for me :-)

sudo nano /etc/lightdm/lightdm.conf

In that file, look for:

and insert this line:
xserver-command=X -s 0 dpms

My test monitor has been on for a couple of days now :-)
Posts: 1
Joined: Tue Jul 22, 2014 11:00 am
by mrmsbarnes » Thu Aug 07, 2014 2:08 am
About 2 years ago Rasadmin may well have posted THE answer for your system. However, I vote for carlhage, because that solution worked for my late model Raspbian system (uname -r says '3.12.22+' with LXDE display manager). Don't put magic xset commands in /etc/rc.local as advised elsewhere. Use the magic @xset commands where carlhage says.

You know you got it licked when your first terminal command after start up:
xset q
prefer blanking: no allow exposures: yes
timeout: 0 cycle: nnn (600 in my case)
DPMS is Disabled
Posts: 10
Joined: Thu Jul 31, 2014 11:27 pm
by NeilEric » Wed Aug 13, 2014 8:21 pm
Re tleland's post from 2013 about installing xscreensaver in order to be able to disable screen blanking from the GUI rather than from the command line:

- I installed xscreensaver and rebooted my Pi.
- When I restart the GUI, I still don't have a screensaver option in the GUI under Preferences.

Is there more to using xscreensaver than simply installing it by typing sudo apt-get install xscreensaver and rebooting?

Posts: 2
Joined: Wed Aug 13, 2014 8:11 pm