Operations 4 min read

How to Stop Ubuntu from Auto‑Locking and Sleeping After Inactivity

This guide explains why Ubuntu locks the screen after a few minutes of idle and provides three practical methods—adjusting power settings, using the Caffeine app, and editing UPower configuration—to prevent automatic sleep, along with step‑by‑step commands and warnings about energy efficiency.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Stop Ubuntu from Auto‑Locking and Sleeping After Inactivity

Background

After about five minutes of inactivity Ubuntu automatically locks the screen and may put the laptop into sleep mode, requiring the user to re‑enter the password. This behavior is caused by the default power‑management settings that prioritize energy saving.

Method 1: Adjust Power Settings

Open the system settings via the battery icon in the top‑right corner and select Power Settings . Disable the Blank screen switch or set a longer timeout, and adjust the Suspend options to delay or completely disable automatic sleep.

Method 2: Use the Caffeine Application

The caffeine utility simulates user activity to keep the system awake. Install it from the terminal, then launch it from the application menu. When the coffee‑cup icon appears, click Activate to prevent sleep.

sudo apt-get install caffeine -y

Method 3: Edit the UPower Configuration File

For finer control, edit /etc/UPower/UPower.conf. Set the IdleSuspend and IdleSuspendDelay values to 0 to disable automatic suspend on laptops. Save the file and restart the power‑management service or reboot.

vim /etc/UPower/UPower.conf

Conclusion

These three approaches—changing system power settings, using the Caffeine app, or modifying the UPower configuration—allow you to prevent Ubuntu from entering sleep mode automatically. While disabling sleep improves convenience, it may reduce overall energy efficiency.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Caffeinepower managementUbuntusleepUPower
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.