lxqt / liblxqt

Core utility library for all LXQt components
https://lxqt-project.org
GNU Lesser General Public License v2.1
59 stars 51 forks source link

Annoying error message when locking screen #257

Open tsujan opened 4 years ago

tsujan commented 4 years ago
Expected Behavior

When the screen is locked correctly, no error message should be shown.

Current Behavior

An error message is shown with xscreensaver after unlocking the screen.

Possible Solution

Do we lock the screen twice?!

Steps to Reproduce (for bugs)
  1. Install xscreensaver and start it.
  2. Check LXQt Session Settings → Basic Settings → Lock screen before suspending/hibernating.
  3. Log out and log in.
  4. Close the lid of your laptop to suspend it (or suspend it in any way).
  5. Open the lid (= resume). The system will be resumed and you could unlock the screen.

Then, after unlocking the screen, you'll see this dialog:

xscreensaver_error

This is redundant because the screen was locked and unlocked correctly.

Context

See https://github.com/lxqt/lxqt/issues/1803#issuecomment-636294697

System Information
tsujan commented 4 years ago

@selairi, @yan12125, do you know why this happens?

yan12125 commented 4 years ago

I follow your Steps to Reproduce and do not get the Screen Saver Error dialog after unlocking the screen.

If I lock the screen (not suspend) and run DISPLAY=:0 xscreensaver-command -lock from another tty, that command fails with "already locked" or "no response to command". So, a wild guess is that some other daemon has locked the screen and thus lxqt fails to lock it again.

kmiernik commented 4 years ago

Maybe this will help, but notice that it happens only with xscreensaver 5.44. WIth previous versions it is not. Secondly it happens only when suspend is called, try systemctl suspend, and simply unlock the screen.

yan12125 commented 4 years ago

I have xscreensaver 5.44, and I've tried using systemctl suspend as well as suspending from lxqt-leave, and got no error messages in either cases. By the way I also use Arch :)

tsujan commented 4 years ago

So, the problem isn't as clear as it seemed to me and @kmiernik. There should be a hidden parameter somewhere — maybe, in xscreensaver.

I also have xscreensaver 5.42 and 5.43 in /var/cache/pacman/pkg; will test with them later.

kmiernik commented 4 years ago

My next guess for culprit is gdm. If I switch to lxdm I have no error message anymore. Perhaps it is locking the screen before the lxqt.

tsujan commented 4 years ago

My next guess for culprit is gdm.

I use sddm.

yan12125 commented 4 years ago

I use sddm, too.

tsujan notifications@github.com 於 2020年5月31日 週日 19:55 寫道:

My next guess for culprit is gdm.

I use sddm.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lxqt/liblxqt/issues/257#issuecomment-636460983, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOZCGP5256ID6GALLDX2D3RUJASHANCNFSM4NO3EJ7Q .

tsujan commented 4 years ago

On the computer I did tests, I have gdm too but it's disabled (I needed gdm to install gnome, in order to test some Qt apps under it).

I don't want to install xscreensaver on my main laptop (I'm working under its LXQt session) and can't uninstall gdm on my (older) test laptop (I need its gnome for tests). But I think, sooner or later, we'll find the cause and, most probably, it won't be in LXQt.

yan12125 commented 4 years ago

Ah, found something interesting in xscreensaver

X11: On systemd systems, closing your laptop lid might actually lock your screen now, maybe.

(From changelog for version 5.43 on https://www.jwz.org/xscreensaver/changelog.html)

So I tried it - if I uncheck "Lock screen before suspending/hibernating", the screen is still locked after resuming from suspend.

Under the hood, a process xscreensaver-systemd listens to PrepareForSleep signal from systemd-logind (or maybe elogind or similar), and locks the screen. So, "some other daemon" might be xscreensaver itself :)

That also explains why the issue did not exist for older xscreensaver versions - systemd integration is new in xscreensaver 5.43.

tsujan commented 4 years ago

It makes perfect sense.

Then, I guess we don't need to do anything. If new versions of xscreensaver don't need our option, the error message shows the user that he/she should either disable xscreensaver's mechanism or, more easily, uncheck LXQt's option.

@yan12125, if you agree on that, then this issue could be closed.

tsujan commented 4 years ago

Perhaps, we could change the message to something like this:

Failed to run "xdg-screensaver lock". The reason may be that you do not have a locker/screensaver compatible with xdg-screensaver installed and running or the locking is done independently of LXQt.

yan12125 commented 4 years ago

Agreed - changing the message is the only thing LXQt needs to do.

Although I believe xscreensaver is the cause, @kmiernik, can you confirm that?

tsujan commented 4 years ago

@yan12125 I think @kmiernik has already confirmed it in https://github.com/lxqt/liblxqt/issues/257#issuecomment-636438770 but I'll also test it today.

The display manager may only affect timing: If LXQt locks the screen first, the error message won't show up.

kmiernik commented 4 years ago

I confirm that unchecking "Lock screen before suspending/hibernating" (I had hard time finding it) clears the problem. And yes, It looks like there is a race condition depending on display manager, with gdm I have the message each time, with lxdm it is like 1 in 10 tries. Unfortunately "closing your laptop lid might actually lock your screen now, maybe" is accurate. It happens sometimes but not always.

yan12125 commented 4 years ago

I confirm that unchecking "Lock screen before suspending/hibernating" (I had hard time finding it) clears the problem.

Thanks for testing! The option is in lxqt-config-session as the functionality is done by lxqt-session [1]. Maybe it should be migrated to lxqt-powermanagement, or even be split out to a new, standalone daemon. That should improve the overall stability in LXQt as bugs like https://github.com/lxqt/lxqt/issues/1803 will not crash the whole session.

It happens sometimes but not always.

Sorry to hear that. As lxqt-session uses an approach similar to xscreensaver (lock the screen when the PrepareForSleep signal from systemd-logind is received), it might be unreliable, too. If you want to test if the lock before suspend feature in lxqt-session is reliable or not, you can rebuild xscreensaver using --without-systemd and re-enable the option in lxqt-config-session.

If LXQt cannot lock before suspend reliably either, a possible solution might be adding a new action like "lock screen and then suspend" and let lxqt-powermanagement to run that action when the lid is closed.

[1] https://github.com/lxqt/lxqt-session/blob/master/lxqt-session/src/lockscreenmanager.cpp

tsujan commented 4 years ago

That should improve the overall stability in LXQt as bugs like lxqt/lxqt#1803 will not crash the whole session.

Very good idea!

kmiernik commented 4 years ago

For a past two days I have been using suggested configuration with xscreensaver compiled --without-systemd along with lxqt-session suspend option. It looks like it works without problems.

From a user perspective having all blank/lock/suspend options in one place and govern by one daemon seems like a reasonable simplification and it would be easier to set the expected behavior.

yan12125 commented 4 years ago

Thanks for testing! Then the only thing to change in LXQt is the error message in the dialog.

tsujan commented 4 years ago

Then the only thing to change in LXQt is the error message in the dialog.

I agree — for this issue to be closed. Later, we'll really need to put those settings elsewhere, so that lxqt-session will be immune to bugs from other codes, as you proposed above.

yan12125 commented 4 years ago

Later, we'll really need to put those settings elsewhere, so that lxqt-session will be immune to bugs from other codes, as you proposed above.

I created https://github.com/lxqt/lxqt/issues/1806 for tracking those.

ghost commented 2 years ago
Expected Behavior

When the screen is locked correctly, no error message should be shown.

Current Behavior

An error message is shown with xscreensaver after unlocking the screen.

Possible Solution

Do we lock the screen twice?!

Steps to Reproduce (for bugs)
  1. Install xscreensaver and start it.
  2. Check LXQt Session Settings → Basic Settings → Lock screen before suspending/hibernating.
  3. Log out and log in.
  4. Close the lid of your laptop to suspend it (or suspend it in any way).
  5. Open the lid (= resume). The system will be resumed and you could unlock the screen.

Then, after unlocking the screen, you'll see this dialog:

xscreensaver_error

This is redundant because the screen was locked and unlocked correctly.

Context

See lxqt/lxqt#1803 (comment)

System Information
  • Distribution & Version:
  • Kernel:
  • Qt Version:
  • libqtxdg Version:
  • lxqt-build-tools Version:
  • Package version:
Expected Behavior

When the screen is locked correctly, no error message should be shown.

Current Behavior

An error message is shown with xscreensaver after unlocking the screen.

Possible Solution

Do we lock the screen twice?!

Steps to Reproduce (for bugs)
  1. Install xscreensaver and start it.
  2. Check LXQt Session Settings → Basic Settings → Lock screen before suspending/hibernating.
  3. Log out and log in.
  4. Close the lid of your laptop to suspend it (or suspend it in any way).
  5. Open the lid (= resume). The system will be resumed and you could unlock the screen.

Then, after unlocking the screen, you'll see this dialog:

xscreensaver_error

This is redundant because the screen was locked and unlocked correctly.

Context

See lxqt/lxqt#1803 (comment)

System Information
  • Distribution & Version:
  • Kernel:
  • Qt Version:
  • libqtxdg Version:
  • lxqt-build-tools Version:
  • Package version:

Just Install sscreensaver Im in arch So pacman -S xscreensaver reboot you will be fine now

eddmax commented 8 months ago

@tsujan chabuduo development ... you people are for LOLZ - bug still exist as well now..

DebianUser007 commented 4 months ago

still exist as well now

jhfhngj commented 4 months ago

Same, happens with Lubuntu.

stefonarch commented 4 months ago

Same, happens with Lubuntu.

I've a default installation of Lubuntu 24.04 in Vbox with xscreensaver installed and cannot reproduce this.

AengusBl commented 3 months ago

Same, happens with Lubuntu.

I am also on Lubuntu and the issue is reproducible every time I suspend the system.

stefonarch commented 3 months ago

Same, happens with Lubuntu.

I am also on Lubuntu and the issue is reproducible every time I suspend the system.

As I can't reproduce: could you try using this locking method instead of xscreensaver?

mmortal03 commented 2 months ago

I just installed Debian 12.6 with LXQt and lightdm, but this was a very custom, barebones install, probably too barebones. None of xscreensaver, xdg-utils, or light-locker were installed. This being the case, I was getting this error when locking or suspending the machine. So, I tried installing xscreensaver and xdg-utils. (I believe I logged out and/or restarted after doing this, but I can't remember for sure.) This did not fix the problem. Then I tried installing light-locker, and this fixed the problem, but xscreensaver was telling me that the two interfere with each other, so I next uninstalled xscreensaver, and now this is fixed. Weird bug because I have a different machine that is up to date, with xscreensaver and xdg-utils installed, but not light-locker, and I can't reproduce the bug there.

AengusBl commented 2 months ago

Same, happens with Lubuntu.

I am also on Lubuntu and the issue is reproducible every time I suspend the system.

As I can't reproduce: could you try using this locking method instead of xscreensaver?

As @kmiernik pointed out, the solution is to go to the LXQt settings and untick "Lock screen before suspending/hibernating". Here is the exact path to access this on Lubuntu:

  1. Lubuntu icon at the bottom left-hand corner of the screen;
  2. Preferences;
  3. LXQt Settings;
  4. Session Settings;
  5. Basic Settings;
  6. Under "Leave Session", untick "Lock screen before suspending/hibernating".