Howto: Disable Screen Saver In Raspbian


55 posts   Page 1 of 3   1, 2, 3
by jwzumwalt » Mon Oct 07, 2013 5:55 am
I became very frustrated in my attempts to disable the screen saver. I finally found that there are two steps to this. The bash (shell) text terminal has its own blanking software, while the Xserver uses independant graphic settings.

To add to the frustration, many recommendations just don't work on the Raspbian version of Debian, or (as I found out) Raspbian used different files.

To view your Xsession screen saver setting, use this command (must be used from xterminal)
xset q

In brief, this is what must be done for Raspbian...
Disable text terminals from blanking
change two settings in /etc/kbd/config
BLANK_TIME=0
POWERDOWN_TIME=0

Disable Xsession from blanking
Additional info https://wiki.archlinux.org/index.php/Di ... _Signaling
Add these lines to /etc/xdg/lxsession/LXDE/autostart
@xset s noblank
@xset s off
@xset -dpms

UpDate: (Jan 27th, 20115) - I just received an email from "Dirk" saying the file location has changed...
The file changed from /etc/xdg/lxsession/LXDE/autostart -to- /etc/xdg/lxsession/LXDE-pi/autostart
If the file location has changed on the version you are using, the script will need to be edited

Here is a script that will permanently disable Xsession blanking
no_blank.sh
Code: Select all
#!/bin/bash

NOBLANK="
@xset s noblank
@xset s off
@xset -dpms
"

  # Pretty ANSI text colors
  OFF="\033[0m"
  BOLD="\033[1m"
  DIM="\033[2m"
  RED="\033[1;31m"
  GREEN="\033[1;32m"
  YELLOW="\033[1;33m"
  BLUE="\033[1;34m"

  clear
  printf "\n\n\t $YELLOW           "; date ; printf "$OFF"
  printf "\n $GREEN"
  printf "\t +------------------------------------------------+\n"
  printf "\t |                  no_blank.sh                   |\n"
  printf "\t |                rev Oct 1, 2013                 |\n"
  printf "\t |                                                |\n"
  printf "\t |  by: Jan Zumwalt - net-wrench.com              |\n"
  printf "\t |                                                |\n"
  printf "\t |  This script permanently disables the xsession |\n"
  printf "\t |  screen saver for RASPBIAN PI OS. It allows    |\n"
  printf "\t |  the user to abort before any change is made.  |\n"
  printf "\t +------------------------------------------------+$OFF\n\n"

  printf "\t This program will disable your xsession\n"
  printf "\t screen saver permanently, is this what \n"
  printf "\t you really want to do? $YELLOW<y/n>$OFF"; read -n 1 KEYIN

  if [[ $KEYIN == "N"  ||  $KEYIN == "n" ]]; then
    printf "\n\n\t OK, I quit and did not do anything.\n\n"
    exit 0
  fi

  printf "\n\n\t I intend to modify your current \n"
  printf "\t /etc/xdg/lxsession/LXDE/autostart \n"
  printf "\t I will add the$GREEN GREEN$OFF lines to the file...\n\n"

  printf "$DIM\n"
  pr -t -o 9 /etc/xdg/lxsession/LXDE/autostart
  printf "$OFF$GREEN$NOBLANK" | pr -t -o 9
  printf "$OFF\n\n"

  printf "\t Is this really what you want to do? $YELLOW<y/n>$OFF"; read -n 1 KEYIN

  if [[ $KEYIN == "N"  ||  $KEYIN == "n" ]]; then
    printf "\n\n\t OK, I quit and did not do anything.\n\n"
    exit 0
  fi

  cat /etc/xdg/lxsession/LXDE/autostart > /etc/xdg/lxsession/LXDE/autostart.`date +%m-%d-%Y_%I:%M:%S`
  printf "\n\t Created backup copy of the autostart file...\n"
  printf "$NOBLANK" >> /etc/xdg/lxsession/LXDE/autostart

  printf "\t Your new file looks like this\n"
  printf "$DIM\n"
  pr -t -o 9 /etc/xdg/lxsession/LXDE/autostart
  printf "$OFF\n\n"

  printf "\t$RED Modified file. Screensaver is now disabled.$OFF\n"

  # required so xterm will not close
  printf "\n\t press any key to exit: "; read -n 1 KEYIN
  printf "\t$GREEN Program ended normaly $OFF\n\n"



For completeness here are the other methods that reportedly worked for other OS.

+-------------------------------------+
Stop Screen Blanking
1 & 2 work for the Raspbian
+------------------------------------+

1) Stop text terminals from blanking
change in /etc/kbd/config these two:
BLANK_TIME=0
POWERDOWN_TIME=0

2) Stop Xsession from blanking
Additional info https://wiki.archlinux.org/index.php/Di ... _Signaling
Add these lines to /etc/xdg/lxsession/LXDE/autostart
@xset s noblank
@xset s off
@xset -dpms
------------------------------------
A) Change your ~/.xinitrc or /etc/X11/xinit/xinitrc or /etc/xdg/lxsession/LXDE/autostart
NOTE: attempting to create a ~/.xinitrc and use in Raspbian crashed my Xserver
@xset s noblank
@xset s off
@xset -dpms

B) Change the /etc/lightdm/lightdm.conf and paste under the [SeatDefault]
xserver-command=X -s 0 dpms
"only effective if you boot straight into X using that particular display manager."

C) Use the xdotool to send a benign keyboard input to midori every ten minutes e.g. over crontab
...not a real solution, but it could work for my purpose.

D) Use a Display-Manager such as LXDE and run your browser there. User coolblue2000
had the same issue and finally went the way over a window manager, disabling the panel
(menu bar at the bottom) and setting the background picture to black - so you can't
see the whole LXDE. Here's a description:
http://pikiosk.tumblr.com/post/38721623 ... -static-ip
-- This will use more CPU - if anybody tries this, please leave a comment how much.
I'm really short of CPU, so I don't want to run an unnecessary windowmanager just to
prevent a screensaver... :(

E) 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.
Last edited by jwzumwalt on Tue Jan 27, 2015 8:14 pm, edited 5 times in total.
User avatar
Posts: 44
Joined: Sun Aug 04, 2013 4:00 pm
by ramstrong » Mon Oct 07, 2013 7:56 pm
Ha ha. Yeah, disabling screen saver can be a pain. That's why I added that capability on my Noob Tools script. Just do "noob noblank" to disable screen saver. "noob blank" to enable it. It only works on GUI, though. I didn't make it for terminal.

Add gpicview program, and you have a full screen slide show pictures capability all day long. Very nice.
Raspberry Pi Journal: http://simpletongeek.blogspot.com/p/raspberry-pi-journal-directory_4.html
Posts: 36
Joined: Thu Aug 15, 2013 11:14 pm
by SoftSpot » Sat Mar 08, 2014 4:29 am
jwzumwalt: thanks for this explanation. This one did the trick! Finally. :D
Posts: 3
Joined: Wed Jul 25, 2012 11:29 pm
by carolinarider » Thu May 15, 2014 11:33 pm
Hi,

I am a new user. I have a model b that I want to use for digital signage using Impress. I found this thread and have copied the code for the "no_blank".

I was hoping that someone would provide some additional instructions on how to implement the code. I suspect it is fairly straight forward. Any assistance would be appreciated.

Jim
Posts: 8
Joined: Mon May 12, 2014 5:46 pm
by sammyrox » Thu Jun 26, 2014 9:17 pm
Hello,

Please forgive me, as I am basically computer illiterate.

I have tried this solution on my raspberry pi and yet the screen still blanks after the 10 minutes. I checked the files to insure the changes saved, and they have been. Why am I still getting blanking?
Posts: 1
Joined: Thu Jun 26, 2014 7:10 pm
by NeilEric » Thu Aug 14, 2014 6:51 pm
jwzumwalt,

Finally! Thank you for posting this.

Neil
Posts: 2
Joined: Wed Aug 13, 2014 8:11 pm
by vallieres » Tue Aug 19, 2014 6:04 pm
Hello,

I'm having the same problem even after doing all the steps.

We have a wall display powered by a Raspberry Pi. It worked fine for about 2-3 months then I had issues with memory corruption on the SD card. So I reinstalled it with the latest Raspbian.

Followed this guide that worked before (http://bloguedegeek.net/2014/05/13/cree ... -tutoriel/), and now after about 10 minutes I still have the screen go black, still open and green, just nothing being pushed via video.

I did the BLANK_TIME=0 and POWERDOWN_TIME=0 without success.
I also added the same @xset commands to the two xinitrc files I have

And finally added this SeatDefault thing too. No success.

I'm at a loss! How can I get that wall display to stay lit?

Thanks!
Posts: 8
Joined: Mon May 05, 2014 1:51 pm
by vallieres » Wed Aug 20, 2014 3:08 pm
Nevermind, I forgot to install the x11-xserver-utils... :P

On my previous setup I had installed Chromium, x11-xserver-utils and unclutter. That's why it worked fined after going with Iceweasel.

I did this to fix the problem:

Code: Select all
 sudo apt-get install x11-xserver-utils unclutter

Thanks!
Posts: 8
Joined: Mon May 05, 2014 1:51 pm
by bearsarepeopletoo » Tue Apr 07, 2015 5:41 pm
Question for: jwzumwalt regarding your script posted on Jan 2015.. where do I insert this?
Sorry, new to Raspbian and first step is getting the monitor to stay on.

Thanks!
Posts: 2
Joined: Tue Apr 07, 2015 5:37 pm
by kusti8 » Tue Apr 07, 2015 7:56 pm
bearsarepeopletoo wrote:Question for: jwzumwalt regarding your script posted on Jan 2015.. where do I insert this?
Sorry, new to Raspbian and first step is getting the monitor to stay on.

Thanks!


You should probably look at some Linux books. You put the script into a file using leaf pad or nano and then exexute it like this:
./script.sh where script is the name of the file.
There are 10 types of people: those who understand binary and those who don't.
User avatar
Posts: 2888
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA
by klricks » Tue Apr 07, 2015 11:15 pm
The easiest way to disable screen blanking in the Raspbian GUI is to install xscreensaver then configure it to disabled.
Code: Select all
sudo apt-get update
sudo apt-get install xscreensaver


In the [Display Mode] tab, set like this - Mode: [Disable Screen Saver]
Last edited by klricks on Mon Jun 01, 2015 12:40 pm, edited 2 times in total.
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://blackeagle12.net/Comp/RPi/Rpi.html Click web icon on right side --->
Posts: 3571
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
by bearsarepeopletoo » Wed Apr 08, 2015 4:03 pm
Thanks! This worked well for a non-programmer like me
Posts: 2
Joined: Tue Apr 07, 2015 5:37 pm
by spatieman » Thu Apr 09, 2015 10:30 am
aah, the xscreensaver package did the trick for me !
tjnxs.
Posts: 10
Joined: Tue Jan 13, 2015 10:06 am
by Krassegrand » Sat May 09, 2015 2:31 pm
jwzumwalt wrote:In brief, this is what must be done for Raspbian...
Disable text terminals from blanking
change two settings in /etc/kbd/config
BLANK_TIME=0
POWERDOWN_TIME=0




I would like to have the blank screen option but not the power down, or at least set it for a few hours.

I tried to set BLANK_TIME=1 and
POWERDOWN_TIME=0 but the file is write protected.
Do I have to edit it on another PC?

Jörgen
Posts: 104
Joined: Sat Apr 25, 2015 3:20 pm
Location: Halmstad Sweden
by Krassegrand » Sat May 09, 2015 3:02 pm
I tried to open the config file from the terminal but I am doing somethingwrong

pi@raspberrypi /etc $ cd kbd
pi@raspberrypi /etc/kbd $ ls
config remap
pi@raspberrypi /etc/kbd $ sudo config
sudo: config: command not found
pi@raspberrypi /etc/kbd $ run config
bash: run: command not found
pi@raspberrypi /etc/kbd $ open config
Couldn't get a file descriptor referring to the console
pi@raspberrypi /etc/kbd $


J;rgen

PS how do I get swedish keyboard_
Posts: 104
Joined: Sat Apr 25, 2015 3:20 pm
Location: Halmstad Sweden
by rpdom » Sat May 09, 2015 5:14 pm
You need to open the file with a text editor with root (superuser) permissions. Try

sudo nano config

or

sudo nano /etc/kbd/config
User avatar
Posts: 9270
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK
by kusti8 » Sat May 09, 2015 5:16 pm
Krassegrand wrote:PS how do I get swedish keyboard_



Go to:
Code: Select all
sudo raspi-config

and you can change it under Internationalization.
There are 10 types of people: those who understand binary and those who don't.
User avatar
Posts: 2888
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA
by Krassegrand » Sat May 09, 2015 5:35 pm
kusti8 wrote:
Krassegrand wrote:PS how do I get swedish keyboard_



Go to:
Code: Select all
sudo raspi-config

and you can change it under Internationalization.


I have been there but there seems to be only 1 alternative.
Or is it not supposed to be called something like SE?

Jörgen
Posts: 104
Joined: Sat Apr 25, 2015 3:20 pm
Location: Halmstad Sweden
by DougieLawson » Sat May 09, 2015 6:45 pm
From the man 5 page for keyboard
The standard location of the keyboard file is /etc/default/keyboard.
Description of all available keyboard models, layouts, variants and op‐
tions is available in /usr/share/X11/xkb/rules/xorg.lst. In most cas‐
es, in /usr/share/keymaps/ or /usr/share/syscons/keymaps/ you will find
several keymaps that can be used with the variable KMAP.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
RPi owner since '12.
Twitter: @DougieLawson

2B, B+, A+, 5Bs, zero, 3B

Please post ALL technical questions on the forum.Do not send private messages.
User avatar
Posts: 22615
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by Krassegrand » Sat May 09, 2015 8:11 pm
rpdom wrote:You need to open the file with a text editor with root (superuser) permissions. Try

sudo nano config

or

sudo nano /etc/kbd/config


I will try this tomorrow morning!

Thank You
Jörgen
Posts: 104
Joined: Sat Apr 25, 2015 3:20 pm
Location: Halmstad Sweden
by Krassegrand » Sun May 10, 2015 4:30 am
How do I exit from nano?

Jörgen

I have entered ^X but nothing happens!

Sorry sorry sorry!
I have read the manual now!
^ means control!

Thank You guys!
Posts: 104
Joined: Sat Apr 25, 2015 3:20 pm
Location: Halmstad Sweden
by Krassegrand » Sun May 10, 2015 6:32 am
Krassegrand wrote:
I tried to set BLANK_TIME=1 and
POWERDOWN_TIME=0 but the file is write protected.
Do I have to edit it on another PC?

Jörgen


I did it now with nano (sudo) and when I open after restart it is still
BLANK_TIME=1 and
POWERDOWN_TIME=0
but it don't seem to change any behaviour. it still blanks after about 15 minutes (it was originally set to 30 in the config) as it did from the beginning.
This is a very minor problem so I will let it be for now.

Thanks for the help guys.
Jörgen
Posts: 104
Joined: Sat Apr 25, 2015 3:20 pm
Location: Halmstad Sweden
by hamza » Thu May 21, 2015 6:10 pm
Posts: 76
Joined: Fri Apr 03, 2015 7:16 pm
by rosignol » Fri May 29, 2015 4:41 pm
Hi I'm(well I was) desperately in need of help.
I'm trying to run a scrolling notice board and have looked at all (well most) of the posts regarding this. and eventually got there this way
My problem was that
1) I couldn't get in to where I needed to be to over write the "lightdm.conf" file.
[OK I've managed to do this now with "sudo" what is sudo?
(if you are following this to solve a similar problem here is what I did)
i] click on the LXTerminal (the little black screen at top of page) and when it appears you will see "raspberrypi$- ", now type "sudo leafpad" (btw don't put the " "s in) and hit return, you'll see some
code appear on the screen and then leafpad will open. (leafpad is your text editor btw)
(explanation of what you have just done)[ sudo stands for 'super user do' so you are now a super user also known as 'root'
So you have just opened the leafpad editor as a su or root user (this is just temporary for the current session)
ii] go to the file menu and click on pi and then go down to the file icon below 'python games' (the one with just a folder followed by a / , click on it and then follow the path "etc/lightdm/lightdm.conf" this will open the file lightdm.conf
iii] tab down until you find the line that begins [SeatDefaults] and the code line #xserver-command=x
iv]now you need to change that line to read xserver-command=x -s 0 -dpms ( leave the hash{#} out and note the spaces between x&-s, s&0, and 0&-dpms)
v) now go up to the file menu and click save and in the dialog box that comes up click 'save' again. now close and reboot your pi
vi) this should stop the Pi falling asleep.
2) having explained all this I find that in some cases (mine for instance) this does not work but it was good fun trying. At last though I have come upon a working solution. Here it is.
3) Go to the LXTerminal and type the following sudo apt-get install xscreensaver (press enter), when it has loaded reboot your Pi
4) when Pi has rebooted click on File manager and open screensaver. The first line of the screen saver menu says "disable screen saver" click on it close it, reboot Pi again and hey presto Pi will stay awake. yippee!!!!!!!
Finally Thanks to all those who between them supplied the answers I needed, but please remember that newbies(like me) need very,very detailed instructions

best regards Rosignol
Last edited by rosignol on Sun May 31, 2015 3:30 pm, edited 4 times in total.
Posts: 4
Joined: Mon May 25, 2015 3:14 pm
by Krassegrand » Sun May 31, 2015 8:04 am
Try using the sudo nano command to open lightdn.con.
It will overwrite the existing file when you save it.
The changes should take place after restart if I understand it.

Jörgen

Edit
By the way,
What do You want to change in lightdn.con?
Posts: 104
Joined: Sat Apr 25, 2015 3:20 pm
Location: Halmstad Sweden