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


When you are first setting up a Raspberry Pi, it is very scary for the screen to suddenly just go black. There’s no need for alarm, but particularly during software updates and other longer processes, this can cause some unnecessary anxiety. Fortunately, there are several methods of preventing this.

The Raspberry Pi doesn’t have a sleep mode, so it’s already disabled. Screen blanking is what is used. To disable screen blanking quickly,  use the raspi-config utility using the terminal and turn it off in the Display Options section.

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

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 project 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?

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

Strictly speaking, the Raspberry Pi does not have a sleep mode like 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 like 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>

Raspberry Pi Bootcamp
Sale: 10% off today.
Take it to the next level.
I'm here to help you get started on Raspberry Pi.
Learn all the skills you need in the correct order.

Here is an example:
xset dpms 60 120 240

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.

It can be difficult to recover from in certain circumstances because the 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)

How to Disable Screen Blanking

From the desktop interface

Master your Raspberry Pi in 30 days
Sale: 10% off today.
Download the eBook.
Uncover the secrets of the Raspberry Pi in a 30 days challenge.
Learn useful Linux skills and practice multiples projects.

To disable screen blanking from the desktop interface:

  • 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

    That will bring up the terminal version of the preferences settings, and you can use the arrows to navigate to Display Options… 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.


A bit lost in the Linux command line? Check this article first, which will give you 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. Back in the days of monitors with cathode ray tubes, these were essential to prevent damage to your screen from having the same image displayed all day. These days, with LCD and LED monitors, they’re not really necessary, but they can be fun when your system is idle.

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

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

Master Python on Raspberry Pi
Sale: 10% off today.
Get the eBook.
Do more with your Raspberry Pi, learn the useful concepts and take the shortcuts.
You miss half of the fun of using a Raspberry Pi if you don’t know anything about Python.

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).

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 chose 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 in the scrolling list and see what they do in the sample window to the right. Note that many in the list will appear slightly grey and show as Not Installed on the right 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 chose a random screensaver, and if you chose 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.

Conclusion

Get My Cheat Sheet!
Grab your free PDF file with all the commands you need to know on Raspberry Pi!

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.

Support us: Join the community on Patreon to show your support, get behind-the-scenes content and other awesome perks!

Raspberry Pi Resources

Not sure where to start?
Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Watch the Raspberry Pi Bootcamp course now

Master your Raspberry Pi in 30 days
Don’t want the basic stuff only? 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 multiples projects with step-by-step guides.
Download the e-book

VIP Community
If you just want to hang out with me and show your support, you can also join the Patreon community. I share behind-the-scenes content there and give you early access to my content. You’ll also get a shoutout when you join.
More details here

Need help to build something with Python?
Create, understand and improve any Python script for your Raspberry Pi.
Learn the essentials, step-by-step, without losing time understanding useless concepts.
Get the e-book now

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


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


Ken Reiss

Ken is a semi-retired computer consultant with a lifelong love of just about anything electronic. He started with the Raspberry Pi just as the Pi 4 was announced and got hooked pretty quickly. He still teaches a couple of courses at one of the local universities, just for fun.

Recent Posts

Black Friday: Get 40% off everything