screen not consistently locking when lid is closed

Bug #1990742 reported by Jonathan Kamens
258
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Expired
Low
Unassigned

Bug Description

I have GNOME configured to lock the screen when the screen is blanked, and to blank the screen when the lid is closed:

org.gnome.settings-daemon.plugins.power lid-close-battery-action 'blank'
org.gnome.desktop.screensaver lock-delay uint32 0
org.gnome.desktop.screensaver lock-enabled true

This worked fine in Jammy: whenever my screen was unlocked and I closed my laptop lid, it locked immediately, i.e., if I immediately reopened my lid, the screen was locked.

After having just upgraded to Kinetic, however, sometimes when I close the lid it locks as described above, and sometimes it just... doesn't, i.e., when I open the lid again the screen is unlocked and I can just keep working.

I have been unable to determine what the factors are which control whether the screen locks when I close the lid.

There is a moderate security implication here, as it's problematic for someone's screen not to lock when they think that it did.

ProblemType: Bug
DistroRelease: Ubuntu 22.10
Package: gnome-shell 43.0-1ubuntu1
ProcVersionSignature: Ubuntu 5.19.0-15.15-generic 5.19.0
Uname: Linux 5.19.0-15-generic x86_64
ApportVersion: 2.23.0-0ubuntu2
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: ubuntu:GNOME
Date: Sat Sep 24 17:57:37 2022
DisplayManager: gdm3
InstallationDate: Installed on 2019-08-16 (1135 days ago)
InstallationMedia: Ubuntu 19.04 "Disco Dingo" - Release amd64 (20190416)
RelatedPackageVersions: mutter-common 43.0-1ubuntu1
SourcePackage: gnome-shell
UpgradeStatus: Upgraded to kinetic on 2022-09-24 (0 days ago)

Revision history for this message
Jonathan Kamens (jik) wrote :
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It looks like <email address hidden> may be to blame here. To be sure, please delete all local extensions:

  cd ~/.local/share/gnome-shell
  rm -rf extensions

and then log in again.

information type: Public → Public Security
affects: gnome-shell (Ubuntu) → ubuntu
Changed in ubuntu:
status: New → Incomplete
Revision history for this message
Jonathan Kamens (jik) wrote :

Two questions:

1) It's not clear to me how <email address hidden> can be at fault when it's not compatible with the GNOME version in kinetic so it's not enabled.

2) For my own edification can you tell me how you determined that extension might be at fault, so I can repeat those troubleshooting steps myself in the future before reporting an issue?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Extensions cause most gnome-shell bugs so removing them is always the first thing that needs to be tried.

This setting shown in the above attachments also reminded me of that:

b'org.gnome.shell' b'enabled-extensions' b"['multi-volume@tigersoldier', '<email address hidden>', '<email address hidden>', '<email address hidden>']"

P.S. Disabled extensions can still cause bugs, because disabling is voluntary and many extensions don't disable "cleanly". That's why we always ask people to start by deleting the extensions.

Revision history for this message
Jonathan Kamens (jik) wrote :

1) I am able to reproduce this issue after removing Allow Locked Remote Desktop and restarting my computer, though again, it is intermittent so I can't reproduce it every time.

2) I am somewhat confused by this: "disabling is voluntary and many extensions don't disable 'cleanly'". Note that Allow Locked Remote Desktop wasn't disabled by me, it was disabled by the shell because it's not marked compatible with Kinetic's GNOME version. Surely when the shell decides an extension is incompatible and disables it, that's not "voluntary" and the shell's code does not run?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

That might be a different kind of "disabled", but still it's good to be cautious. My advice is based on having reviewed thousands of bug reports and in some cases finding that disabling an extension was not enough and it had to be deleted before the bug stopped happening.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Please remember to delete all nonstandard extensions including 'multi-volume@tigersoldier' and '<email address hidden>'.

The purpose of the extensions does not necessarily need to relate to locking. When the screen locks, gnome-shell disables/unloads all extensions. And then they get re-enabled at unlock. Each disable/enable relies on calling into the extension itself and trusting that it is not buggy in any way. The obvious problem there is that any extension designed for any purpose might break the lock/unlock/suspend/resume behaviour.

Revision history for this message
Jonathan Kamens (jik) wrote :

Removed night themes switcher, problem is still intermittently reproducible. Sometimes when I close the lid wait several seconds and open it the screen simply doesn't lock. Never happened before Kinetic as far as I know.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, please:

1. Delete all local extensions, at least temporarily.

2. Log in again.

3. Open a Terminal window and start this running:

   journalctl -f > recentlog.txt

4. Reproduce the bug.

5. Press Ctrl+C in the Terminal window.

6. Attach the resulting text file here.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Maybe also check for simpler explanations:

  gsettings get org.gnome.desktop.lockdown disable-lock-screen
  gsettings get org.gnome.desktop.screensaver lock-enabled
  gsettings get org.gnome.desktop.screensaver ubuntu-lock-on-suspend

I've seen reports of these being toggled without the owner's knowledge.

Revision history for this message
Jonathan Kamens (jik) wrote :

i have already removed all extensions that aren't part of Ubuntu.

Attached is recentlog.txt as requested. As you can see it locked successfully several times and then didn't lock the last time. I don't see anything in the log indicating why.

Revision history for this message
Jonathan Kamens (jik) wrote :

$ gsettings get org.gnome.desktop.lockdown disable-lock-screen
false
$ gsettings get org.gnome.desktop.screensaver lock-enabled
true
$ gsettings get org.gnome.desktop.screensaver ubuntu-lock-on-suspend
true

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Thanks for that. Indeed the log shows the lid being closed without any locking near the end. That might be related to bug 1857392 which is clearly occurring at the same time. It also highlights that systemd is responsible for initiating the locking.

affects: ubuntu → systemd (Ubuntu)
Changed in systemd (Ubuntu):
status: Incomplete → New
tags: added: foundations-triage-discuss
Revision history for this message
Nick Rosbrook (enr0n) wrote :

My first guess is that there is an inhibitor lock for "handle-lid-switch" in place which is blocking or delaying the screen lock.

Jonathan - Can you please enable debug level logging on systemd-logind.service by doing the following?

$ systemctl edit systemd-logind.service

In the editor, add a section like this:

 [Service]
 Environment=SYSTEMD_LOG_LEVEL=debug

Then reboot, and next time you experience this issue share the log:

$ journalctl -b -u systemd-logind --no-pager > systemd-logind.log

It is probably also worth sharing your logind.conf:

$ systemd-analyze cat-config systemd/logind.conf > logind.conf

Revision history for this message
Nick Rosbrook (enr0n) wrote :

When I configure my systemd to lock on lid switch, I do see this debug-level message:

Oct 12 16:19:45 six systemd-logind[1173]: Inhibitor GNOME Shell (GNOME needs to lock the screen) pid=2894 uid=1000 mode=delay started.

I am not sure exactly how GNOME handles locking the screen, but maybe the bug that Daniel pointed out (bug 1857392) is preventing GNOME from processing an Inhibitor DBus signal and locking the screen in a timely manner.

Changed in systemd (Ubuntu):
status: New → Incomplete
importance: Undecided → Low
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Bug 1857392 occurs on practically all machines every day so I recommend ignoring that one specifically. In comment #13 I think I was just pointing out there seems to be a common root cause if we can find out why/where bug 1857392 occurs so often.

Nick Rosbrook (enr0n)
tags: removed: foundations-triage-discuss
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for systemd (Ubuntu) because there has been no activity for 60 days.]

Changed in systemd (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.