69

My screen goes black after 30 seconds of inactivity and when I press a key, it shows where it was and does not need any password. This problem won't occur when I use it for watching videos in platforms such as youtube etc. My Ubuntu version is 22.04. I have used some methods to overcome it but still couldn't.

  1. I've changed screen blank to "never" in setting>power>screenBlank
  2. I've used commands such as 'gsettings set org.gnome.settings-daemon.plugins.power idle-dim false', and 'gsettings set org.gnome.desktop.screensaver lock-delay 600' with and without sudo in terminal. I restarted my pc after them just in case. could you please help me with this?
Negin Nezhadali
  • 793
  • 1
  • 5
  • 6
  • 1
    Same problem with mine, although it happens less often, it happens several times per hour and drives me insane! 'Glad' someone else has same problem and I am not insane..... – Peter-and-Crazybear May 14 '22 at 09:21
  • 3
    I'm having the same problem with Ubuntu 22 also! It just started happening this past week. – lord_nimon May 26 '22 at 04:01
  • My Ubuntu 22.04 lemur pro laptop just started doing this today after updating. WTH. – partofthething Jul 23 '22 at 23:33
  • It has started happening to me on 22.04.1. I had this same issue several years ago with 11.0. It eventually went away after a couple updates, but was annoying to say the least. I've temporarily stopped it from happening on my current setup by going into Settings/Power and randomly changing all the settings, then setting them back to what I want to have. It evidently resets DPMS some way or other and leaves my screen alone. I have to do it over again when I reboot, or if I'm away long enough for the true screen blank feature to kick in. – tbzep Aug 27 '22 at 04:39
  • 1
    Why do these things keep regressing? Even with Canonical's might and resources, it keeps happening... It's no wonder we'll never see the year of Linux on the desktop... It's an understatement to say it's disappointing! – AnthonyK Apr 05 '23 at 06:06
  • 2
    23.04 - same bug. Only restart helps. But after some time the bug "reactivates". – 4LegsDrivenCat Jul 17 '23 at 20:36
  • I have a similar problem with Xubuntu 22.04, even with a fresh install. Although, the screen blanks out after a few minutes (maybe 5 to 12), instead of 30 seconds. I have the screensaver disabled. All screen blanking turned off. The power manager doesn't even autostart (and everything in it is disabled anyway). It still goes blank. Although I am very interested in fixing it, I'm more interested in /why/ this is happening. I don't recall this happening in the previous Xubuntu version. – Brōtsyorfuzthrāx Jul 12 '24 at 02:09
  • This seems to be Launchpad bug #2002358. It might actually only affect Nvidia users on X.org – it might be good if someone could infirm it. Apparently, same issue on Pop!_OS (makes sense I guess, but it’s a long thread running for 5 years). – Didier L May 18 '25 at 22:12

6 Answers6

57

Same problem here, with Ubuntu 22.04 after only 30 second of inactivity the screen turn black, to bring back the display on screen I need to press a key or move the mouse. I have also notice it does not occur when watching video like YouTube.

The work around which work on my side, is to call this command:

xset -dpms
seb
  • 686
  • 6
  • 3
  • 3
    How often do you need to call this command? – lord_nimon May 26 '22 at 04:01
  • 2
    It looks like it resets after you reboot. So you will have to run it every time you boot. Is it possible to make this persistent? – Erik van den Hoorn Aug 25 '22 at 15:31
  • 1
    https://askubuntu.com/a/719157/29073 tells you how to make a script that runs in the background on boot. Note Upstart and rc.local are deprecated. .profile and similar (eg .gnomerc) execute after login. You can also add a cronjob. – pbhj Aug 30 '22 at 14:45
  • For me it seems to happen consistently after I put my laptop into sleep and unplug the secondary screen (not sure if the order matters), So that's when and how often I need to run this command, not on fresh boot. – FNia Oct 21 '23 at 21:21
19

Give this a try.

xset s off && xset -dpms

I ran it this morning. When I came home, the screen was on standby as it should be instead of just blacked out like it was doing with xset -dpms. I've let it go into standby several more times and it is still working as it should.

I expect this will revert when I reboot. However, if it does, I will just add it to the end of my .profile.

Edit: This fix has worked for me through a logout/login and two reboots.

tbzep
  • 201
6

not sure what's messing with the DPMS blank time, this worked fine in 20.04.

# export DISPLAY=:0 && /usr/bin/xset dpms 1200 1200 1200
# xset q
....
DPMS (Energy Star):
  Standby: 1200    Suspend: 1200    Off: 1200
  DPMS is Enabled
  Monitor is On

set correctly, but wait a few minutes, screen blanks in way too short a time...

#  xset q
....
DPMS (Energy Star):
  Standby: 0    Suspend: 0    Off: 0
  DPMS is Enabled
  Monitor is On

Something is resetting it to 0 0 0. Poking around...

gessel
  • 179
4

In Menu, go to System Tools » dconf Editor or type dconf-editor in terminal:

org » gnome » settings » daemon-plugins » power » sleep-inactive-ac-timeout

Set sleep-inactive-ac-timeout to 300 (seconds)

Set sleep-inactive-ac-type to ‘logout’

Alexis Wilke
  • 2,787
4

Adding to the answer of @user234899: For me the laptop was not suspending after 30s but the screen was dimmed. To control that timeout:

  1. Open dconf Editor
  2. Navigate to org->gnome->settings-daemon->plugins->power
  3. Set idle-brightness from 30 to e.g. 300 (5min)
  • 1
    According to the description, this value is the brightness of the screen, when idle, not the timeout. – Seppo Enarvi Nov 19 '24 at 07:16
  • and now even this doesn't work... it's like someone has decided we all HAVE to have this stupid 30 second blank out... – rub Feb 13 '25 at 07:18
2

If you're here with Ubuntu 24.04 you probably run Wayland instead of Xorg and any answers relating to xset are outdated. Check here:

https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/687

Temporary workaround:

Run systemctl restart --user org.gnome.SettingsDaemon.Power.target

Permanent workaround (from above link):

Run this command:

sudo systemctl edit --force --full screenblank-workaround

Fill in this text:

[Unit]
Description=Fix to screen timeout after resume from suspend
After=systemd-suspend.service

[Service] Type=oneshot ExecStart=/usr/bin/systemctl --user -M <your user name>@ restart org.gnome.SettingsDaemon.Power.target

[Install] WantedBy=systemd-suspend.service

Please create a +1 in that gnome ticket so that it gets the attention it deserves.