65

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.

Salim Fadhley
  • 2,035
  • 4
  • 19
  • 13

6 Answers6

41

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

/etc/X11/xinit/xinitrc

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

Steve Robillard
  • 34,988
  • 18
  • 106
  • 110
27

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

/etc/lightdm/lightdm.conf

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

[SeatDefaults]
xserver-command=X -s 0 -dpms

That worked well for me - no more blank screen!

DerDirektor
  • 271
  • 2
  • 2
20

I fixed this problem by installing xscreensaver via

$ sudo apt-get install xscreensaver

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

Wray Bowling
  • 103
  • 3
Miles Hayler
  • 309
  • 2
  • 4
9

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
goldilocks
  • 60,325
  • 17
  • 117
  • 234
Maine_guy
  • 106
  • 1
  • 1
3

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 disableblank.sh 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.

Nakedible
  • 1,561
  • 1
  • 13
  • 18
2

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"
fi

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.

lornix
  • 1,066
  • 8
  • 13