disable sleep mode on raspberry pi

How to Disable Sleep Mode on Raspberry Pi (with pictures)

When you first set up a Raspberry Pi, it’s very scary for the screen to suddenly just go black. Don’t worry, there’s no need to be alarmed. This black screen can cause some necessary anxiety, especially during software updates and other long processes. Fortunately, there are several methods to prevent this, which I will share in this article.

Raspberry Pi doesn’t have a sleep mode, but it does utilize screen blanking which is very similar. To quickly disable screen blanking, use the raspi-config utility through the terminal and turn it off in the Display Options section.

There are other ways to accomplish this, including installing a screensaver, which can be done without using the terminal. Read on for more info and step-by-step instructions to prevent screen blanking!

If you need help getting started on Raspberry Pi, I have an entire course to guide you through your first steps. I’ll help you use the perfect hardware, plug everything in and install your first system. You’ll also do your first projects with me, just to make sure you are ready for the next level. Get all the information on this page if you are interested.

Does Raspberry Pi 4 Have Sleep Mode?

Strictly speaking, the Raspberry Pi does not have a sleep mode as we would see on a desktop or laptop computer. The hardware is either on or off, but it does not go into a power save or sleep mode as you would see on a more complete system.

The feature is available on a fresh installation of Raspberry Pi OS, but it’s turned off by default. We call this a DPMS (Display Power Management System).

DPMS has 3 values that can be set, suspend time, hibernate time and off time. These are set with the terminal command:
xset dpms <suspend> <hibernate> <off>

Here is an example:
xset dpms 60 120 240

Download the Pi Glossary!
If you are lost in all these new words and abbreviations, request my free Raspberry Pi glossary here (PDF format)!
Download now

And you can turn DPMS on or off with:
xset +dpms
xset -dpms

Suspend just puts the monitor to sleep, but everything else stays on.

Hibernate is where we get into trouble because the Raspberry Pi doesn’t understand how to hibernate. Hibernation is transferring the contents of memory to disk and putting the computer into a very low-power state, which the Pi simply doesn’t support.

Join Our Community!

Connect, learn, and grow with other Raspberry Pi enthusiasts. Support RaspberryTips and enjoy an ad-free reading experience. Get exclusive monthly video tutorials and many other benefits.

Learn more

It can be difficult to recover from in certain circumstances because Pi doesn’t know how to deal with anything other than on or off. DPMS is best left off for our purposes. That’s why the Raspberry Pi Foundation enables screen blanking, but not the DPMS feature.

What is Screen Blanking?

Screen blanking will take the image off your screen and replace it with a completely black screen, but the power is still supplied to the HDMI port. This is what you are encountering when you first set up a Raspberry Pi system, and it can be very annoying.

In recent versions of the operating system, raspi-config for the command line, and the Raspberry Pi Configuration utility used in the desktop environment have both added a switch to turn off the screen blanking.

How do I Wake Up my Raspberry Pi from Sleep?

If your Raspberry Pi does try to hibernate or sleep, the only fix may be to turn it off and reboot, which we’d rather avoid.

If your screen has just gone blank, you may be able to revive it with a quick press on the keyboard (space bar is usually recommended, but any key will work).

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

How to Disable Screen Blanking

From the desktop interface

To disable screen blanking from the desktop interface:

Download the Pi Glossary!
If you are lost in all these new words and abbreviations, request my free Raspberry Pi glossary here (PDF format)!
Download now
  • Simply go to the main menu.
  • Open the Preferences submenu and choose Raspberry Pi Configuration.
  • Once there, click on the Display tab.
  • At the bottom of the short list is Screen Blanking, Enable or Disable.
    If yours is greyed out like mine, it means something else is controlling the setting (most likely a screensaver).

Using the command line

If you’d prefer to use the command line, you have several options, depending on how detailed you want to get. In the terminal, start with:

  • sudo raspi-config
    It will bring up the terminal version of the preferences settings, and you can use the arrows to navigate to Display Options, and press enter.

  • Navigate to the 4th line, Screen Blanking:

  • Press enter:

  • Select No on this screen, then press enter again at the ok prompt.
  • Finally, select finish from the main menu. It will prompt you for a reboot. Your settings will not take effect until you reboot, but you don’t have to do it right away if you’d prefer.

Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember and a free downloadable cheat sheet so you can have the commands at your fingertips.

Using a screensaver

Another way to control screen blanking is by using a good old-fashioned screen saver. When monitors had cathode ray tubes, these were essential to prevent damaging your screen from having the same image displayed all day.

The idea is that rather than having a screen display that doesn’t change, you introduce some motion or color-changing effects onto the screen when the user was not busy with the computer. This helped save CRT displays from “burn in” where the constantly displayed image became more or less permanent on display after hours.

Today, with LCD and LED monitors, screen savers aren’t really necessary, but they can be fun when your system is idle. There is an excellent screensaver available that works just fine on the Pi called xscreensaver. You can install it from the terminal with the command:

sudo apt install xscreensaver

Or you can use the Add/Remove software tool in the graphical desktop environment if you prefer not to use the terminal.

  • Under Preferences, choose Add/Remove Software.
  • Enter xscreensaver in the search area and press return.

    You’ll get back quite a list of things, but the main one you need is called Screensaver daemon and frontend for X11. Most of the other things in the list are add-ons that will add additional modules to the screensaver after it’s installed.
  • Select that one and click apply. After it’s installed, a reboot will be necessary to start it (although it may not prompt you for that).

If you are not familiar with the installation of new applications on Raspberry Pi, you can click on that link to read my step-by-step tutorial on the topic.

Anyway, once installed, under Preferences, you’ll now have a new Screensaver option. Choosing this will bring up the main screensaver window. If you are only interested in disabling the screen blanking, you can choose that under the Mode pop-up menu at the top left.

If you’d like to play a little, you can select any of the screensavers listed and see what they do in the sample window on the right.

Many in the list will appear slightly grey and show as Not Installed if you select them. They are available in some of those other options we saw in the Add/Remove Software list, but figuring out which one is in which package can be a bit challenging.

However, if you select one that is listed in black, it will be installed and you’ll get a sample on the right. Down below, you can set how long you’d like the display to be idle before the screensaver appears, and also if you’d like the screen to lock with a password after a certain number of minutes.

One of the modes above is to choose a random screensaver, and if you choose that, the Cycle After setting will control how long each one is on the screen before it randomly chooses another one. It can be fun to see old favorites now and then, especially if you have been around long enough to have had one on a CRT display.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

If you are looking for exclusive tutorials, I post a new course each month, available for premium members only. Join the community to get access to all of them right now!


So, there you have several options for keeping the display alive while you’re working on things. It is usually one of the first things I do when setting up a new Raspberry Pi OS drive so that I don’t lose the display while doing updates or other installations.

Whatever you decide, have fun with your Pi. And now that this issue is fixed, here are a few articles I recommend to do more with your Raspberry Pi:

Whenever you’re ready, here are other ways I can help you:

The RaspberryTips Community: If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.

Master your Raspberry Pi in 30 days: If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.

The Raspberry Pi Bootcamp: Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.

Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.

You can also find all my recommendations for tools and hardware on this page.

Similar Posts

One Comment

  1. So are you still disabling screen blanking and installing xcreensaver? I dont seem to ever have it active automatically. I had to create a desktop icon called lock.

Comments are closed.