[Solved] Can’t lock screen with shortcut on Ubuntu 20.04 gnome

In shortcuts i have Super + L for locking screen. But on pressing it – nothing happens. In syslog:

gsd-media-keys[1979]: Couldn't lock screen: Cannot invoke method; 
proxy is for the well-known name org.gnome.ScreenSaver without an owner, and proxy was constructed with the G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START flag

Locking from interface works fine.

System info: Ubuntu 19.04 upgraded to 20.04

Linux laptop 5.4.0-21-generic #25-Ubuntu SMP Sat Mar 28 13:10:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:    20.04
Codename:   focal

GNOME Shell 3.36.1

Other info:

gsettings get org.gnome.desktop.screensaver lock-enabled = true
gsettings get org.gnome.desktop.lockdown disable-lock-screen = false

gnome-screensaver 3.6.1

I also tried: gnome-screensaver-command -l but nothing happens.

I already tried to reinstall gnome-shell and gnome-screensaver – it didn’t help.

How to fix locking screen from hotkey?

Solution #1:

My original question was banned as bug, but it isn’t a bug – it’s a wrong configuration.
People faced this problem a lot in the internet and SO:

In my case I was using lightdm and screen lock is disabled in it due security issues. Read more here

You can check you display manager with: sudo systemctl status display-manager

If you still want to lock your screen with lightdm – you can use dm-tool lock. Also you can add it to keyboard shortcut as command (e.g. Super+L).

Switching to gdm3 helped: sudo dpkg-reconfigure gdm3

Respondent: littleguga

Solution #2:

I face same problem after I switched my display-manager to lightdm. (because I prefer the design of lightdm over gdm)

However, I still want to lock the screen with keyboard shortcut.

So this is what I did:
Settings > Keyboard Shortcuts > ‘+’
Name : lightdm_lockscreen
Command : dm-tool lock
Shortcut : Super+L (I edited original Lock Screen shortcut to other combination)

In my case, Super+L enables the lock of the screen perfectly with this setting.
Enjoy 🙂

Respondent: HJ Han

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.