Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Lockscreen/Switch User Screen Problem #2

Open
cperalt06 opened this issue Jan 24, 2017 · 33 comments
Open

Lockscreen/Switch User Screen Problem #2

cperalt06 opened this issue Jan 24, 2017 · 33 comments

Comments

@cperalt06
Copy link

cperalt06 commented Jan 24, 2017

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
@FallingSnow
Copy link
Owner

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 (Antergos/web-greeter#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.

@internauta2000
Copy link

+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

@cytodev
Copy link

cytodev commented Feb 24, 2017

@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.

@FallingSnow
Copy link
Owner

@cytodev
Copy link

cytodev commented Feb 24, 2017

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.

@FallingSnow
Copy link
Owner

FallingSnow commented Feb 24, 2017

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.

@cytodev
Copy link

cytodev commented Feb 24, 2017

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.

@lots0logs
Copy link

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.

@cytodev
Copy link

cytodev commented Feb 25, 2017

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;
});

@lots0logs
Copy link

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.

@cytodev
Copy link

cytodev commented Feb 25, 2017

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.

@FallingSnow
Copy link
Owner

FallingSnow commented Feb 25, 2017

This should address your guys' concerns: e906b51

@crdil
Copy link

crdil commented Feb 26, 2017

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

@FallingSnow
Copy link
Owner

You got the big red error message on your screen?

@crdil
Copy link

crdil commented Feb 26, 2017

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

@FallingSnow
Copy link
Owner

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

@crdil
Copy link

crdil commented Feb 27, 2017

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')

@FallingSnow
Copy link
Owner

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?

@cytodev
Copy link

cytodev commented Feb 27, 2017

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.

@crdil
Copy link

crdil commented Feb 28, 2017

@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.

@FallingSnow
Copy link
Owner

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.

@crdil
Copy link

crdil commented Feb 28, 2017

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...

@cperalt06
Copy link
Author

cperalt06 commented Mar 1, 2017

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!

cytodev added a commit to cytodev/lightdm-webkit2-material2 that referenced this issue Mar 1, 2017
@cytodev
Copy link

cytodev commented Mar 1, 2017

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.

@crdil
Copy link

crdil commented Mar 1, 2017

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

@FallingSnow
Copy link
Owner

@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.

@crdil
Copy link

crdil commented Mar 2, 2017

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

@cytodev
Copy link

cytodev commented Mar 2, 2017

@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);
}

@crdil
Copy link

crdil commented Mar 2, 2017

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

@ByteOven
Copy link

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
`

@cytodev
Copy link

cytodev commented May 30, 2017

@0xHM, @crdil, I'm unsure about how the webkit greeter handles "native" js logging, I probably should check that out before suggesting potential error-chasing options... Another option would be to literally write all of it to the screen. Just for debugging purpouses ofcourse! -- Then again, if this is an issue with the actual source package - like I suspect, there is little we can do to fix it...

bytheway, @crdil, apologies for the late reply!

@ByteOven
Copy link

@cytodev Let me just give few notes,

I'm using https://github.com/FallingSnow/LightDMMock as mock, there is also a bug in there

file:///usr/share/lightdm-webkit/themes/arch/mock/LightDMMock.js:575:7: CONSOLE ERROR ReferenceError: Can't find variable: module

This can be solved by adding above the last
var module = module || {}

@cytodev
Copy link

cytodev commented May 31, 2017

@0xHM That is an issue which can be easily resolved, the original branch already has an update compared to the branch @FallingSnow is using as mock.

You can see if replacing the mockup with the original fixes this error. - It probably will, but if it doesn't please don't hesitate to file a bug against my repo!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants