How to Keep Your Ubuntu 22.04 from Sleeping


If you’re a user of Ubuntu 22.04, you may have noticed that your system goes to sleep after a certain period of inactivity. While this is a useful energy-saving feature, it can be frustrating if you’re in the middle of a task and your system goes to sleep. After a fresh installation, there are several options enabled that lock the screen and put your computer to sleep after the set period. If like me, you are tired of this and want to update the settings, fortunately, it’s easy to prevent your Ubuntu 22.04 system from sleeping. Below, you can find some of the methods you can employ to achieve this:

Method 1 – Through the system settings

Change the sleep settings in the Power Settings menu. To access this menu on your laptop, click on the battery icon in the top right corner of your screen to pull out the options and then select “Power Settings.” If you are running Ubuntu on a desktop, you can access it by clicking on the power icon in the upper right corner and clicking on “Settings”. From the options on the right, you need to scroll down to select “Power”.
From there, you can adjust the “Blank screen” toggle to keep your screen from going blank before going to sleep and the “Suspend” settings to set a longer period of time before your computer goes to sleep or disable it completely.

Method 2 – Through the caffeine app

Use the “caffeine” app. This is a simple app that prevents your system from going to sleep by simulating user activity. To install it, open up your terminal and execute the following command:
$sudo apt-get install caffeine -y
Then, you can launch the app from the Application Launcher. In the search box, type “caffeine” to pull up the application icon. Select the one that says “Caffeine Indicator” it to launch the application.
You will see a coffee cup show up next to the network icon. Click on it to pull up all the options. Now, click on the “Activate” button to prevent your system from sleeping.
When you are done, you can select “Deactivate” to turn off the application.

Method 3 – Through the power manager configuration file

For the purposes of this method, you will need to edit the “Power Manager” settings. You need to access the configuration file for your “Power Manager” and open it up. It mainly comes in handy with laptops. To do this, open up your terminal and execute this to pull up the configuration file in your text editor.
$sudo gedit /etc/UPower/UPower.conf
This will open the configuration file in a text editor. For laptops, find the “IdleSuspend” and “IdleSuspendDelay” settings and set them to “0” to disable sleep. Save the file and exit the text editor. For desktop computers, you can adjust options regarding the lid or if you want to set an action for when your computer is running critically low on power.

Conclusion

By following these three methods, you should be able to prevent your Ubuntu 22.04 system from going to sleep. Keep in mind that while disabling sleep can be convenient, it may also reduce the energy efficiency of your system. Use these methods sparingly and consider adjusting your sleep settings back to their default values when you’re finished with your task. Like always, if you face any errors or issues throughout the guide, do let me know through the comments section below. I will walk you through the error and help you resolve it. Similarly, if you know of any other methods for achieving this, or if you want to discuss any queries or concerns, drop us a line through the comments section below and we’ll get in touch. Cheers.
Print Friendly, PDF & Email
Categories