Skip to content →

Prevent screen blanking and disable screensaver on Raspbian

By default Raspbian has two things that make the screen blank: Screensaver and HDMI blanking. To remedy this we have to edit two files: LXDE’s autostart programs and kbd’s configuration.

The screensaver (xscreensaver) is bundled with the LXDE desktop and is autostarted by default. The HDMI output is subject to kbd and is due to the default configuration being powered down after 30 minutes of inactivity.

Disabling screensaver and configuring x11 options

Begin by installing the x11-server-utils if they’re not already installed.

raspberry@pi:~$ sudo apt-get install x11-xserver-utils

Now we need to edit the autostart file

raspberry@pi:~$ sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

Find and remove the line @xscreensaver -no-splash.

Add the following, each on a separate line:

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

Save and exit the file (ctrl + x, then y)

raspberry@pi:~$ sudo nano /etc/kbd/config

Find and edit the following sections in the file so they look like below:

BLANK_TIME=0
BLANK_DPMS=off
POWERDOWN_TIME=0

Now just restart the raspberry pi or run:

raspberry@pi:~$ sudo pkill xscreensaver
raspberry@pi:~$ sudo service kbd restart
raspberry@pi:~$ export DISPLAY=:0; xset s noblank; xset s off; xset -dpms

That should do the trick!

Published in Command line Linux Raspberry Pi Raspbian

4 Comments

  1. sudo service kdb restart

    should be

    sudo service kbd restart

  2. Mauro Pi Mauro Pi

    how to keep it when reboot?

    • Actually, the settings should be retained after a reboot. Are you not experiencing this?

Leave a Reply to Tobias Järvelöv Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.