the-cavalry / light-locker

A simple session-locker for lightdm
GNU General Public License v2.0
224 stars 22 forks source link

Black screen when resuming from suspend in XFCE #61

Open hugegreenbug opened 9 years ago

hugegreenbug commented 9 years ago

In XFCE, if I click the suspend button and then resume by clicking a key on the keyboard, I see the cursor for 1/2 a second and then I see a black screen. By sshing in, I saw that the backlight had turned off for some reason. This doesn't happen when I suspend/resume by closing the lid and then opening it. I found a solution, which was to increase the timeout in one case:

--- light-locker-1.6.0/src/gs-monitor.c 2015-06-25 20:37:13.000000000 -0600
+++ light-locker-1.6.0.old/src/gs-monitor.c     2015-06-25 20:28:47.451521786 -0600
@@ -247,7 +247,7 @@
                 /* Add a 1s delay for VT switching.
                  * This seems to preserved content exposure.
                 */
-                g_timeout_add_seconds (1,
+                g_timeout_add_seconds (4,
                                       (GSourceFunc)gs_monitor_lock_session,
                                        monitor);
         } else {
cavalier38 commented 9 years ago

I find it odd that fixed it. If I'm correct that is in either manager_lock_cb or listener_lock_cb. One is the screensaver timeout the other is the dbus lock request. Neither should have anything to do with suspend resume, which is in listener_resume_cb. Also the patch has an offset here (line numbers don't match). Could you specify in which function you did this change?

I assume that backlight isn't off cause the screen saver is active at that point. (move the mouse or press a button to deactive the screen saver).

hugegreenbug commented 9 years ago

You are correct, that didn't fix it after all. What fixed it for me was to remove that timeout and function call altogether. My patch is based on the ubuntu package, which includes an additional patch. That is why the offsets do not make sense. Here is my current patch for the listener_lock_cb function:

--- light-locker-1.6.1.orig/src/gs-monitor.c
+++ light-locker-1.6.1/src/gs-monitor.c
@@ -243,13 +243,6 @@ listener_lock_cb (GSListener *listener,
         gs_monitor_lock_screen (monitor);
         if (gs_listener_is_lid_closed (listener)) {
                 monitor->priv->perform_lock = TRUE;
-        } else if (gs_manager_get_session_visible (monitor->priv->manager)) {
-                /* Add a 1s delay for VT switching.
-                 * This seems to preserved content exposure.
-                 */
-                g_timeout_add_seconds (1,
-                                       (GSourceFunc)gs_monitor_lock_session,
-                                       monitor);
         } else {
                 gs_manager_show_content (monitor->priv->manager);
         }

Yes, the backlight isn't off and the screen turns on with mouse or keyboard activity. You can find my source package, which includes this patch here: http://www.distroshare.com/apt_ubuntu/pool/main/l/light-locker/

shtalinberg commented 7 years ago

I have a Debian Jessie (latest updates) with XFCE==4.12 and light-locker==1.7.0-3 from testing. sudo pm-suspend without locking is worked and after open lid unsuspend success. But if I try suspend with locking via button (suspend) or via closing lid I have black screen when resuming from suspend and I hear the sounds of desktop applications, such as Skype.

ikcalB commented 7 years ago

I too have Debian Jessie (up to date @02.02.2017)

randomly after waking up from screenlock (just let it sit for an hour or two) OR suspend, I get a black screen with only a cursor stuck in the middle on VT8, VT7 displays the expected "session locked".

not able to login (blindly typing passwd).
tty1 does work, and only a X-restart makes the GUI respond again

cavalier38 commented 7 years ago

you can try running light-locker with --no-lock-on-suspend and --no-lock-on-lid. To see it is caused by light-locker switching to the greeter on resume. also you can run light-locker with --debug and capture the output to a file. That might give a hint on what state light-locker is in.

@ikcalB As there is a VT8 it seems that the session was locker properly, but either the Xserver or LightDM didn't come up properly.

Iey4iej3 commented 7 years ago

I would like to report that I suffer from the same issue.

Debian Stretch, light-locker 1.7.0-3 xfce4 4.12.3

cavalier38 commented 7 years ago

@FrankEular can you run light-locker with --debug and post the output?

Iey4iej3 commented 7 years ago

It's pretty weird that after I ran light-locker with --debug, the issue hasn't shown up until minutes ago!

The system failed to resume from a suspend (auto sleep).

I catched a log: light-locker1.txt

cavalier38 commented 7 years ago

From the log I see the following:

[listener_dbus_handle_system_message] gs-listener-dbus.c:1330 (21:58:03):    obj_path=/org/freedesktop/login1/session/_32 interface=org.freedesktop.login1.Session method=Lock destination=(null)
[listener_dbus_handle_system_message] gs-listener-dbus.c:1346 (21:58:03):    systemd requested session lock

I can't find the Unlock. This means that light-locker still thinks the session is locked and it will keep sending you back to the greeter.

You do get a greeter screen? I noticed in your log that you switched between several sessions.

Iey4iej3 commented 7 years ago

I only had one login session. I did get a greeter screen of lightdm after resume from suspend, but after inputting the username and the password, the screen became completely blank with a (movable) cursor of the mouse.

cavalier38 commented 7 years ago

@FrankEular you weren't send back from the black screen to the greeter? (after about 10s) From the log, that didn't seem to have happened, as the session wasn't active for that time. light-locker is using session _32 c2, _121 or _318 is the greeter session, there could be a nested session.

(21:58:02):  Send lock session
(21:58:03):  systemd notified ActiveSession 0
(21:58:03):  systemd notified ActiveSession 0 (_121?)
(21:58:03):  systemd requested session lock
(21:58:03):  systemd initiating resume
(21:58:16):  systemd notified ActiveSession 0 (c2?)
(21:58:22):  systemd notified ActiveSession 0 (_318)
(21:58:28):  systemd notified ActiveSession 1 (_32)
(21:58:31):  systemd notified ActiveSession 0 (_318)
(21:59:20):  systemd notified ActiveSession 1 (_32)
(21:59:22):  systemd notified ActiveSession 0 (c2)
(21:59:27):  systemd notified ActiveSession 0 (_318)

One thing that seems wrong to me is "Send lock session" comes before "systemd initiating resume". That could be part of the problem. I haven't found the cause of that.

Iey4iej3 commented 7 years ago

I don't know where I was imprecise. I was sent back from the black screen to the greeter, and after inputting the username and the password, the screen was black with a mouse there -- normally, it should log in successfully and show me the screen as it was before locking.

Iey4iej3 commented 7 years ago

I met this issue once again when I was running powertop. light-locker2.txt I cannot remember details, but probably after having inputted the identity in the greeter, the black screen (with a mouse) was in VT8, and VT7 was just a caption claiming the locked status of the session.

Iey4iej3 commented 7 years ago

I met this issue once again. Now I found a temporary solution: the black screen is exactly in VT8. After switching to VT7 and wait for some seconds, after that, the greeter appears again, and I can successfully log in by inputing the username and the password.

It is pretty weird that the first greeter will redirect me to VT8, but with this piece of information, can you estimate where the issue originates from?

Olangu commented 6 years ago

I'm having the same issue with: Debian Stretch light-locker 1.7.0-3 xfce4 4.12.3 on a Thinkpad 25. Docking and undocking (while suspended) seem to make the bug appear more frequently.

James-E-A commented 6 years ago

This might be an XFCE bug

I'm getting it on Debian 9 AND Ubuntu 18, and I'm sadly not alone

And it persists exactly the same after apt purge light-locker

mlasch commented 5 years ago

Same here, in 10% of the time I get a black screen after resume on vt7. Switching to vt8 gives me the login screen. When I login I am redirected to the vt7 black screen again. loginctl shows me that the session is still active with all processes. I can only continue by restarting lightdm from tty1.

light-locker 1.8.0 Xubuntu 18.10

Iey4iej3 commented 5 years ago

Same here, in 10% of the time I get a black screen after resume on vt7. Switching to vt8 gives me the login screen. When I login I am redirected to the vt7 black screen again. loginctl shows me that the session is still active with all processes. I can only continue by restarting lightdm from tty1.

light-locker 1.8.0 Xubuntu 18.10

Did you try to login again? Most of my experience was that, very rarely I needed to switch to vt8 and do the same work, and eventually I succeeded to login. Usually it was solved by switching once.

mlasch commented 5 years ago

Same here, in 10% of the time I get a black screen after resume on vt7. Switching to vt8 gives me the login screen. When I login I am redirected to the vt7 black screen again. loginctl shows me that the session is still active with all processes. I can only continue by restarting lightdm from tty1. light-locker 1.8.0 Xubuntu 18.10

Did you try to login again? Most of my experience was that, very rarely I needed to switch to vt8 and do the same work, and eventually I succeeded to login. Usually it was solved by switching once.

No I was unable to get the login screen back, vt8 kept black after first login. However for a few weeks now, login always succeeds. The odd thing is that I still have to switch first to vt7 and then vt8 after wakeup in order to get the login window.

Iey4iej3 commented 5 years ago

Same here, in 10% of the time I get a black screen after resume on vt7. Switching to vt8 gives me the login screen. When I login I am redirected to the vt7 black screen again. loginctl shows me that the session is still active with all processes. I can only continue by restarting lightdm from tty1. light-locker 1.8.0 Xubuntu 18.10

Did you try to login again? Most of my experience was that, very rarely I needed to switch to vt8 and do the same work, and eventually I succeeded to login. Usually it was solved by switching once.

No I was unable to get the login screen back, vt8 kept black after first login. However for a few weeks now, login always succeeds. The odd thing is that I still have to switch first to vt7 and then vt8 after wakeup in order to get the login window.

Do you see a cursor in the black screen? After upgrading to Debian Buster, there was a new issue: it could be black (in fact, no backlight) without a cursor. I searched and found a solution: manually create a configuration in xorg.conf.d for my intel graphics. After applying that workaround, the problem about black-screen-with-a-cursor (with backlight) remains, namely sometimes I still need to switch vt's to unlock.

mlasch commented 5 years ago

Very good tip! I had also the no backlight issue. Creating 20-intel.conf in /usr/share/X11/xorg.conf.d/ with

Section "Device"
   Identifier  "Intel Graphics"
   Driver      "intel"
EndSection

solved the wakeup problem. For now it seems the problem is fixed.

dmulitsa commented 3 years ago

Very good tip! I had also the no backlight issue. Creating 20-intel.conf in /usr/share/X11/xorg.conf.d/ with

Section "Device"
   Identifier  "Intel Graphics"
   Driver      "intel"
EndSection

solved the wakeup problem. For now it seems the problem is fixed.

It helped me too. Debian Buster light-locker 1.8.0 xfce4 4.12.1

But it prevents normal usage bumblebee.