GNOME screen locking not working

I love Linux, but every so often something happens that makes me question
whether or not my love affair since the mid-1990s is true love or just Stockholm
syndrome.

One such instance happened recently when, for no explicable reason, my laptop, running GNOME (on Arch Linux) decided to stop locking the screen when I would hibernate the system.

I did what I’d expect any other person would probably do in this situation. I went through my GNOME settings looking for a toggle to fix the glitch. I even found the setting under Privacy > Screen Lock labeled Automatic Screen Lock.

And wouldn’t you know it, the damn toggle was enabled and toggling it back and forth didn’t change anything.

At this point, I started wondering if the hot key to lock the screen in GNOME,
<Super>+L would lock the screen, proving that the issue was with hibernate and suspend. And wouldn’t you know it, the hot key also didn’t work.

A handful of toggling the Automatic Screen Lock setting, restarting GNOME and
even rebooting, I decided it was time to dig into dconf to see if there was
anything in there that could be of any help.

If you’re unfamiliar with dconf, it’s similar to the Windows Registry and
houses a bunch of low-level configuration options. Some of these configuration
options mirror stuff you can find in settings, but there’s also so stuff that
can only be found here.

For me, the command-line is everything, but if you wanted to, you could follow
along at home using the dconf-editor.

Not really knowing what I was looking for, I went ahead and dumped everything with the dconf command and used rg to look for anything with the word lock in it:

dconf dump / | rg lock
Zsh

Of course, you can swap the less efficient grep for rg if so desired.

Upon running this command, I was presented with about a half page of results,
three that were of interest to the situation at hand.

  1. [org/gnome/desktop/lockdown] the section of dconf that houses the lock screen settings.
  2. lock-enabled=true which I confirmed correlated to the Automatic Screen Lock setting.
  3. disable-lock-screen=true which seems pretty suspect giving the issues I was having.

So disable-lock-screen seemed like the obvious thing to toggle to false, so I went ahead and updated the dconf value using a combination of the section from #1 and the setting name in #3:

dconf write /org/gnome/desktop/lockdown/disable-lock-screen false
Zsh

Upon running this command, I was able to hit <Super>+L and the screen locked as one would expect! Things also went back to normal the next time I had hibernated my machine.

Now if only there was a good explanation for why this setting decided to toggle
itself to true in the first place!

Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.