lightdm-webkit2-material2 icon indicating copy to clipboard operation
lightdm-webkit2-material2 copied to clipboard

Lockscreen/Switch User Screen Problem

Open cperalt06 opened this issue 8 years ago • 33 comments

Lockscreen/Switch User Screen is redirecting to a sample/template Users with some template desktop environments. Which is to say not the ones that are on my system.

To reproduce, just type this in a terminal dm-tool lock

or just switch users.

Edit: Just in case you might need this since I noticed someone else had this issue:

>sudo pacman -Qi lightdm-webkit2-greeter

Name            : lightdm-webkit2-greeter
Version         : 2.2.2-1
Description     : A webkit2 greeter for LightDM
Architecture    : x86_64
URL             : https://github.com/antergos/lightdm-webkit2-greeter
Licenses        : GPL3
Groups          : system
Provides        : lightdm-webkit2-greeter  lightdm-webkit-greeter
Depends On      : lightdm  webkit2gtk  antergos-wallpapers  accountsservice
Optional Deps   : None
Required By     : lightdm-webkit-theme-material-git  lightdm-webkit2-theme-material2-git
Optional For    : None
Conflicts With  : lightdm-webkit2-greeter  lightdm-webkit-theme-antergos
Replaces        : lightdm-webkit-theme-antergos
Installed Size  : 2.75 MiB
Packager        : Antergos Build Server <[email protected]>
Build Date      : Wed 18 Jan 2017 10:08:55 PM EST
Install Date    : Sat 21 Jan 2017 07:30:03 PM EST
Install Reason  : Explicitly installed
Install Script  : Yes
Validated By    : Signature

cperalt06 avatar Jan 24 '17 22:01 cperalt06

Lol, idk why I wasn't watching my own repo. Sorry for the slow response.

I think this is an upstream issue since the mock only gets loaded if the greeter is not found. It's hard for me to debug due to a recent issue with development tools breaking (https://github.com/Antergos/lightdm-webkit2-greeter/issues/109). We'll need to wait until I can get devtools working again unless @lots0logs has the time and is willing to look into this.

FallingSnow avatar Jan 27 '17 05:01 FallingSnow

+1 in Manjaro (Lockscreen/Switch User Screen is redirecting to a sample/template Users with some template desktop environments. Which is to say not the ones that are on my system)

captura de pantalla de 2017-02-15 10-57-13

internauta2000 avatar Feb 15 '17 15:02 internauta2000

@internauta2000, that would be the lightdm mock I wrote. @FallingSnow, did you include the check if lightdm is already defined before assigning the mock to the variable? - Also, version 1.1.0 is up.

cytodev avatar Feb 24 '17 18:02 cytodev

Yes sir.

https://github.com/FallingSnow/lightdm-webkit2-material2/blob/master/src/index.js couple of lines down.

FallingSnow avatar Feb 24 '17 18:02 FallingSnow

That would imply that lightdm has not been initialized when the greeter loads in wake-up or switch-user mode. Maybe this is an issue with the newly created python code on the lightdm-webkit2-greeter repository? I can assume @cperalt06 is using that version, but I'm not sure about the version @internauta2000 uses. All I can say is that the mockup I created was back when antergos' repository was in plain C.

I'd love to debug this further, but I'm going to need some more information from internauta2000. What release is he/she on with the webkit2-greeter, and what python version. It might be that the python code written by the antergos developer(s) has not accounted for deprecation and/or skips over some lines that result in the lightdm object not being created.

This is all speculation at this point. You could try to wrap the LightDMMock initialization into a timeout, or listen for a specific set of keypresses instead to see if it's a timing issue.

Also, might I suggest using a git-flow which replaces the mockup with an error message and fallback text-login in live code? It seems that this issue which internauta2000 is also experiencing in a way has been going on for some time now. -- I'm actually quite impressed that this mockup keeps the actual greeter framework from panicking so well.

cytodev avatar Feb 24 '17 20:02 cytodev

Maybe this is an issue with the newly created python code on the lightdm-webkit2-greeter repository?

This issue predates the move to python and I can only assume it is one of the reasons the greeter is being moved to python. Webkit2gtk had many issues which is why I assume the move to python was made.

I can assume @cperalt06 is using that version

I don't believe anyone is running the prerelease of web-greeter other than the Antergos devs seeing as its not even on the AUR... you would need to manually install it if you wanted to use it.

FallingSnow avatar Feb 24 '17 20:02 FallingSnow

The issues within the antergos repository are all attributed to bad/outdated documentation and maybe even sparse testing last time I checked. (my issue for reference) I don't think that moving to python will fix any of that. But, that's just a thought.

What we can do in the meantime is verify if it is a timing issue on said configurations, and if so try to solve that. -- If not, we can both write issues on their repository's chalking board.

cytodev avatar Feb 24 '17 21:02 cytodev

The issues within the antergos repository are all attributed to bad/outdated documentation and maybe even sparse testing last time I checked.

That is completely false. I'd love to know what facts you have used to draw such conclusions. The documentation is 100% up-to-date on the stable branch. You can see it here. It has been up-to-date since the release of version 2.0 last year, btw.

In any case, this issue is most likely one of timing. Using setTimeout() should solve it for now. When version 3.0 of the greeter is released, it will include a GreeterReady event that themes can attach a callback to in order to initialize themselves.

lots0logs avatar Feb 25 '17 00:02 lots0logs

That is completely false. I'd love to know what facts you have used to draw such conclusions.

I must admit, I haven't looked at the documentation since last time I wrote the mock. I based this entirely on the old manual which doesn't even exist anymore.

Using setTimeout() should solve it for now. When version 3.0 of the greeter is released, it will include a GreeterReady event that themes can attach a callback to in order to initialize themselves.

But how would a GreeterReady event help in determining if the lightdm object is available? You would either be calling GreeterReady on null, or call it on the object and always receive true.

Perhaps listening for keypress to initialize the mockup if the lightdm object is not present is the best way to go, let's say <super>+<m>

let sequenced = 0;

document.addEventListener("keydown", function(event) {
    sequenced = sequenced === 0 ? event.keyCode : sequenced + event.keyCode;

    switch(sequenced) {
        case 168: // super+m
            // initialize mockup if(!("lightdm" in window))
            break;
        case 184: // super+shift+m
            // initialize mockup and override lightdm if it exists
            break;
    }
});

document.addEventListener("keyup", function() {
    sequenced = 0;
});

cytodev avatar Feb 25 '17 09:02 cytodev

But how would a GreeterReady event help in determining if the lightdm object is available? You would either be calling GreeterReady on null, or call it on the object and always receive true.

The event will be attached to the global window object. When the event fires, the lightdm object is guaranteed to be available.

TBH, I do not think its a good practice for themes to load any mock scripts in production environments. Mock scripts are a development tool. They have absolutely no use in production. An end-user should never see the login screen running a mock script. Period.

lots0logs avatar Feb 25 '17 10:02 lots0logs

Also, might I suggest using a git-flow which replaces the mockup with an error message and fallback text-login in live code?

My point exactly.

cytodev avatar Feb 25 '17 19:02 cytodev

This should address your guys' concerns: https://github.com/FallingSnow/lightdm-webkit2-material2/commit/e906b512aa404403e86d0703d30a4b21d94352b5

FallingSnow avatar Feb 25 '17 20:02 FallingSnow

I just fetched that commit and rebuilt, it didn't work, lightdm didnt start at all with the newly built theme.

crdil avatar Feb 26 '17 16:02 crdil

You got the big red error message on your screen?

FallingSnow avatar Feb 26 '17 16:02 FallingSnow

No, just black screen and then I just got an option to use the default theme or the fallback theme :/

crdil avatar Feb 26 '17 18:02 crdil

What do the error logs say, usually found in /var/log/lightdm.

FallingSnow avatar Feb 27 '17 16:02 FallingSnow

file:///usr/share/lightdm-webkit/themes/material3/bundle.js:59:5862: CONSOLE DEBUG Loading Theme file:///usr/share/lightdm-webkit/themes/material3/bundle.js:68:27976: CONSOLE ERROR TypeError: undefined is not an object (evaluating 'lightdm.languages')

crdil avatar Feb 27 '17 17:02 crdil

Honestly, I have no idea why this is happening. The theme checks if lightdm exists at startup, if it doesn't, it either throws an error that should stop execution or load the mock. The error above suggests neither is happening.

Can you give me some insight into what your doing to reproduce this issue? For example, does this happen only when you lock your session?

FallingSnow avatar Feb 27 '17 20:02 FallingSnow

The languages aren't loaded when they are accessed? Languages should be an array containing the language objects. -- That's all I can make of the error.

cytodev avatar Feb 27 '17 20:02 cytodev

@FallingSnow it happens when I try to use the theme, so for me it doesn't work at all. I'm using lightdm 1:1.20.0-2 and lightdm-webkit2-greeter 2.2.3-1 for arch/antergos repos if that matters.

crdil avatar Feb 28 '17 17:02 crdil

Can you compile the latest commit and try again please. If this doesn't work it has to be upstream and we are better off just waiting for web-greeter.

FallingSnow avatar Feb 28 '17 21:02 FallingSnow

I couldn't build it, I got an error with uglifyjs

ERROR in bundle.js from UglifyJs
TypeError: Cannot read property 'file' of undefined

I removed the following in uglifyjs config in webpack file, then I could build it.

collapse_vars: true,
reduce_vars: true

When I restarted lightdm it worked at the first login, but after I locked the screen and tried to login again, lightdm used the fallback theme instead. Error from log file

file:///usr/share/lightdm-webkit/themes/material3/bundle.js:53622:14: CONSOLE DEBUG Loading Theme
file:///usr/share/lightdm-webkit/themes/material3/bundle.js:53632:13: CONSOLE ERROR ReferenceError: Can't find variable: lightdm

** (lightdm-webkit2-greeter:32435): WARNING **: [ERROR] :: A problem was detected with the current theme. Falling back to default theme...

crdil avatar Feb 28 '17 22:02 crdil

I reinstalled it via yaourt and looked at the log for lightdm and found this: CRITICAL: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

Edit: I should clarify one thing. Switching users and logging out no longer show a mock user list and instead I get the actual users in my system. The only time I get the error with a "load fallback theme or load default theme" is by typing this in the terminal: dm-tool lock

Otherwise, it's fine so far. Thanks for fixing part of the problem!

cperalt06 avatar Mar 01 '17 00:03 cperalt06

file:///usr/share/lightdm-webkit/themes/material3/bundle.js:53632:13: CONSOLE ERROR ReferenceError: Can't find variable: lightdm

This could be the problem. lightdm is not defined at this point.

cytodev avatar Mar 01 '17 08:03 cytodev

It works for me as well, the only problem I have is the same as @cperalt06 has, when locking screen manually it loads the fallback theme

crdil avatar Mar 01 '17 09:03 crdil

@crdil Can you try changing this number to something like 10000, recompile, and see if it solves the problem? If that doesn't work maybe try CytoDev's pull request modifications.

FallingSnow avatar Mar 01 '17 20:03 FallingSnow

@FallingSnow I still get the same error, that lightdm variable can't be found. I tried both with increasing the setTimeout and pull request.

crdil avatar Mar 02 '17 09:03 crdil

@crdil That's odd... Might I suggest wrapping everything into a temporary try-catch block? I'm really interested in what line this error is spawned from actual non-compiled code. Maybe some file somewhere is still using the lightdm variable before it is defined?

Something like

try {
    // all code from index.js
} catch(excepton) {
    window.console.error("Error occured in index.js", exception);
}

cytodev avatar Mar 02 '17 12:03 cytodev

I tried to use a try/catch block, but I still get the same error not the error from console.error

crdil avatar Mar 02 '17 20:03 crdil

Can confirm this,

`$ sudo pacman -Qi lightdm-webkit2-greeter

Name : lightdm-webkit2-greeter Version : 2.2.5-1 Description : LightDM greeter that uses WebKit2 for theming via HTML/JavaScript. Architecture : x86_64 URL : https://github.com/antergos/lightdm-webkit2-greeter Licenses : GPL3 Groups : system Provides : lightdm-webkit-greeter Depends On : lightdm webkit2gtk accountsservice gnome-backgrounds Optional Deps : None Required By : None Optional For : None Conflicts With : lightdm-webkit-greeter lightdm-webkit-theme-antergos Replaces : lightdm-webkit-greeter lightdm-webkit-theme-antergos Installed Size : 2.03 MiB Packager : Unknown Packager Build Date : Tue 30 May 2017 07:16:51 PM CEST Install Date : Tue 30 May 2017 07:17:00 PM CEST Install Reason : Explicitly installed Install Script : No Validated By : None `

ByteOven avatar May 30 '17 17:05 ByteOven