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 settingsChange 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 appUse 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:
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.
$sudo apt-get install caffeine -y
Method 3 – Through the power manager configuration fileFor 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.
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.
$sudo gedit /etc/UPower/UPower.conf