pi_lover
Posts: 75
Joined: Fri Apr 28, 2017 4:00 am

How to disable screen blanking ?

Tue Apr 24, 2018 8:27 am

Hi,
The screen goes dark after a period of inactivity ... How to stop this ?

User avatar
RaTTuS
Posts: 10381
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: How to disable screen blanking ?

Tue Apr 24, 2018 8:47 am

edit /boot/cmdline.txt *
and add
consoleblank=0
right after the rootwait
then reboot



*
if using NOOBS
then
Use the NOOBS recovery system [spam the [SHIFT] key during boot to activate it] and edit that /boot/cmdline.txt
Last edited by RaTTuS on Fri Apr 27, 2018 9:03 am, edited 1 time in total.
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

pi_lover
Posts: 75
Joined: Fri Apr 28, 2017 4:00 am

Re: How to disable screen blanking ?

Tue Apr 24, 2018 9:23 am

Yes I am using Noobs.

What exactly should I add to that /boot/config.txt?

User avatar
B.Goode
Posts: 8059
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: How to disable screen blanking ?

Tue Apr 24, 2018 9:33 am

What exactly should I add to that /boot/config.txt?
Exactly nothing.

I think there was a minor typing error - maybe due to autocorrect - in the second part of the advice above.

It is cmdline.txt that you need to modify with the Configuration Editor on the NOOBS Recovery Console.

pi_lover
Posts: 75
Joined: Fri Apr 28, 2017 4:00 am

Re: How to disable screen blanking ?

Tue Apr 24, 2018 9:37 am

If I create a script with "xset s off" and run it will it work ?

weeper
Posts: 4
Joined: Tue Apr 17, 2018 12:59 pm

Re: How to disable screen blanking ?

Wed Apr 25, 2018 12:21 am

You can install an application:

sudo apt-get install xscreensaver

After installation. Go to Menu => Preferences => Screensaver, then just disable it there :)

klricks
Posts: 6510
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: How to disable screen blanking ?

Wed Apr 25, 2018 1:11 am

I believe the edit to cmdline mentioned above is only useful if the system is set to boot to command line only.

For boot to desktop then adding the 3 lines below to autostart works for me.

Edit with nano editor:

Code: Select all

nano /home/pi/.config/lxsession/LXDE-pi/autostart
Add these 3 lines at the end:

Code: Select all

@xset s noblank
@xset s off
@xset s -dpms
Save and exit CTRL x Y

xscreensaver also works but you have to install 40MB of fluf.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

pi_lover
Posts: 75
Joined: Fri Apr 28, 2017 4:00 am

Re: How to disable screen blanking ?

Wed Apr 25, 2018 10:18 pm

@klricks

Your solution worked. Thanks a lot.

hippy
Posts: 5623
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to disable screen blanking ?

Mon Jan 14, 2019 1:58 am

klricks wrote:
Wed Apr 25, 2018 1:11 am
Edit with nano editor:

Code: Select all

nano /home/pi/.config/lxsession/LXDE-pi/autostart
Add these 3 lines at the end:

Code: Select all

@xset s noblank
@xset s off
@xset s -dpms
Save and exit CTRL x Y
I could have sworn this also worked for me when I tried it earlier this year, but on a virgin Raspbian Desktop install ( image not NOOBS, no recommended software, updated to today, boot to GUI ), creating that file ( it didn't already exist ) with those contents just leaves me with a black screen after a reboot, albeit that the mouse cursor is there. Delete the file and reboot and everything is fine again.

Any ideas or suggestion on how to debug, find out what's wrong, or make it work ?

klricks
Posts: 6510
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: How to disable screen blanking ?

Mon Jan 14, 2019 1:14 pm

hippy wrote:
Mon Jan 14, 2019 1:58 am
....
I could have sworn this also worked for me when I tried it earlier this year, but on a virgin Raspbian Desktop install ( image not NOOBS, no recommended software, updated to today, boot to GUI ), creating that file ( it didn't already exist ) with those contents just leaves me with a black screen after a reboot, albeit that the mouse cursor is there. Delete the file and reboot and everything is fine again.

Any ideas or suggestion on how to debug, find out what's wrong, or make it work ?
Due to changes to mentioned in the blog, Raspbian now uses the global autostart in this location:

Code: Select all

/etc/xdg/lxsession/LXDE-pi/autostart
If you prefer to use the one at /home/pi/.config/.......... then it must contain these lines:

Code: Select all

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@point-rpi
If autostart exists at /home/pi/.config/.... then the one at /etc/xdg/....... is ignored.

To stop screen blanking you only need these 2 commands:

Code: Select all

@xset s off
@xset -dpms
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

hippy
Posts: 5623
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to disable screen blanking ?

Mon Jan 14, 2019 1:45 pm

klricks wrote:
Mon Jan 14, 2019 1:14 pm
Due to changes to mentioned in the blog, Raspbian now uses the global autostart in this location ...
Ah yes. Many thanks for that. I had completely forgotten about that change :oops:

If disabling screen blanking had been a raspi-config or clickable desktop preferences or appearance option I wouldn't have had to care about what needed altering or where settings were stored.

It would be nice if options like this could be made more easily accessible than having to manually edit configuration files but I'm not going to suggest percussive re-education of any developers.

WhyNine
Posts: 5
Joined: Thu May 30, 2019 7:00 pm

Re: How to disable screen blanking ?

Thu May 30, 2019 7:25 pm

I have an LCD screen on the Pi which is set as the main display on boot and displays the desktop. I want to use it as a displaybaord/kiosk so I have set up a service which runs a script file containing:

Code: Select all

#!/bin/bash
xset -display :0 s off
xset -display :0 s noblank
xset -display :0 -dpms
unclutter -display :0 &
# Normal website that does not need any exceptions
/usr/bin/chromium-browser --enable-gpu-compositing --remote-debugging-port=9222 --incognito --start-maximized --kiosk file:/home/pi/Pi-Plex/index.html
My web page displays correctly as full screen but the screen still blanks after 5-10 minutes. If I SSH to the Pi and type "xset -display:0 -dpms", the screen unblanks again.

What am I doing wrong?

I have also tried putting the xset commands in the /etc/xdg/lxsession/LXDE-pi/autostart file but no joy.

It is very frustrating :?

klricks
Posts: 6510
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: How to disable screen blanking ?

Fri May 31, 2019 5:50 am

Did you install xscreensaver? xset commands won't work if xscreensaver is installed.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

WhyNine
Posts: 5
Joined: Thu May 30, 2019 7:00 pm

Re: How to disable screen blanking ?

Fri May 31, 2019 8:00 pm

klricks wrote:
Fri May 31, 2019 5:50 am
Did you install xscreensaver? xset commands won't work if xscreensaver is installed.
No, xscreensaver is not installed.

WhyNine
Posts: 5
Joined: Thu May 30, 2019 7:00 pm

Re: How to disable screen blanking ?

Fri May 31, 2019 8:43 pm

WhyNine wrote:
Fri May 31, 2019 8:00 pm
klricks wrote:
Fri May 31, 2019 5:50 am
Did you install xscreensaver? xset commands won't work if xscreensaver is installed.
No, xscreensaver is not installed.
If I type "xset -display :0 -dpms" in a terminal, the screen never goes blank.

Roken
Posts: 289
Joined: Sun Dec 31, 2017 4:35 pm
Location: UK

Re: How to disable screen blanking ?

Fri May 31, 2019 10:06 pm

Or, the traditional xorg way. Edit /etc/X11/xorg.conf and in the Monitor section, add

Code: Select all

Option	"DPMS" "off"
Headless PI. OMG, someone cut it's head off. Oh, hang on. it didn't have one to start with.

klricks
Posts: 6510
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: How to disable screen blanking ?

Sat Jun 01, 2019 1:15 am

WhyNine wrote:
Thu May 30, 2019 7:25 pm
......

I have also tried putting the xset commands in the /etc/xdg/lxsession/LXDE-pi/autostart file but no joy.
Do you have another autostart file anywhere in /home/pi/.config/........
If so the one in /etc/xdg/........ will be ignored.

Note this will show the current settings of the xset commands:

Code: Select all

xset q
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

WhyNine
Posts: 5
Joined: Thu May 30, 2019 7:00 pm

Re: How to disable screen blanking ?

Sun Jun 02, 2019 4:14 pm

Roken wrote:
Fri May 31, 2019 10:06 pm
Or, the traditional xorg way. Edit /etc/X11/xorg.conf and in the Monitor section, add

Code: Select all

Option	"DPMS" "off"
That seems to have done the trick. Many thanks for that tip. :D

matteoraggi
Posts: 121
Joined: Thu Dec 01, 2016 11:04 am

Re: How to disable screen blanking ?

Sun Jun 09, 2019 5:48 pm

Raspbian stretch changed a lot from november 2018 are you sure that these informations are updated? Which instructions should I use to disable the blank screen with raspbian stretch of may 2019?
Raspberry Pi 3 model B - Raspbian 8 Jessie and buster and ubuntu core server 18 lts

WhyNine
Posts: 5
Joined: Thu May 30, 2019 7:00 pm

Re: How to disable screen blanking ?

Sun Jun 09, 2019 6:17 pm

matteoraggi wrote:
Sun Jun 09, 2019 5:48 pm
Raspbian stretch changed a lot from november 2018 are you sure that these informations are updated? Which instructions should I use to disable the blank screen with raspbian stretch of may 2019?
The "xorg.conf" file is actually in the /usr/share/X11/xorg.conf.d folder. I have a number of files in there and one of them already had a Device section so I added a Screen and Monitor section as well, with the suggested Option. However in the end that didn't fix it (it did after one reboot but not thereafter for some reason).

So my fix was to add a file in /etc/profile.d called screen.sh (the name doesn't matter) with:

Code: Select all

xset -display :0 s off
xset -display :0 s noblank
xset -display :0 -dpms
unclutter -display :0 &
It's a bit of a hack but works for me. :D

Return to “Raspbian”