elenapan / dotfiles

There is no place like ~/
GNU General Public License v2.0
3.49k stars 178 forks source link

lovelace: lock_screen_show() is nil when liblua_pam is present #110

Closed gtsatsis closed 4 years ago

gtsatsis commented 4 years ago

Hey,

I'm trying to set up pam lockscreen authentication with the lovelace lockscreen theme, and it appears that when the liblua_pam.so file is present in ~/.config/awesome, the lock_screen_show() function called by elemental/exit_screen/lovelace.lua on line 32 is nil (errors out with attempt to call a nil value).

What would be the next steps (gathering logs, etc.) to debug this? I'm fairly new to awesome, so please excuse me not including logs here initially!

Cheers, George

elenapan commented 4 years ago

Hi George,

In both 2 cases you can then simply run tail -f /path/to/your/logs in a terminal, restart AwesomeWM with super + shift + r, try to activate the lock screen and take a look at the terminal output.



Now about your issue, I vaguely remember that I faced something similar when I was adding PAM support to the lock screen. I think that after you install the pam package of your distro you need to relog (or maybe even reboot?) once for it to be able to be used by the lua-pam library.

Also, is the error still there when using the ephemeral exit screen theme instead of the lovelace one?

gtsatsis commented 4 years ago

Hey Elena,

So, I just took a peek at the logs; It seems to be using lua5.3 instead of lua5.4, even though lua5.4 (and the respective headers) are installed.

2020-09-04 16:05:06 E: awesome: Error during a protected call: version mismatch: app. needs 504.0, Lua core provides 503.0
stack traceback:
        [C]: in ?
        [C]: in function 'require'
        .../gtsatsis/.config/awesome/elemental/lock_screen/init.lua:12: in function <.../gtsatsis/.config/awesome/elemental/lock_screen/init.lua:10>
        (...tail calls...)
        /usr/share/awesome/lib/awful/spawn.lua:487: in function </usr/share/awesome/lib/awful/spawn.lua:481>
        [C]: in function 'xpcall'
        /usr/share/awesome/lib/gears/protected_call.lua:36: in function </usr/share/awesome/lib/gears/protected_call.lua:35>
        (...tail calls...)
        /usr/share/awesome/lib/awful/spawn.lua:586: in upvalue 'done'
        /usr/share/awesome/lib/awful/spawn.lua:601: in function </usr/share/awesome/lib/awful/spawn.lua:593>

Log that is shown in the notification:

2020-09-04 16:05:08 W: awesome: luaA_dofunction:78: error while running function!
stack traceback:
        ...tsis/.config/awesome/elemental/exit_screen/ephemeral.lua:50: in upvalue 'command'
        ...tsis/.config/awesome/elemental/exit_screen/ephemeral.lua:85: in upvalue 'value'
        /usr/share/awesome/lib/awful/button.lua:150: in function </usr/share/awesome/lib/awful/button.lua:150>
        [C]: in method 'emit_signal'
        /usr/share/awesome/lib/wibox/widget/base.lua:421: in function 'wibox.widget.base.handle_button'
        (...tail calls...)
        /usr/share/awesome/lib/gears/object.lua:152: in function 'gears.object.emit_signal'
        /usr/share/awesome/lib/wibox/drawable.lua:436: in function </usr/share/awesome/lib/wibox/drawable.lua:431>
error: ...tsis/.config/awesome/elemental/exit_screen/ephemeral.lua:50: attempt to call a nil value (global 'lock_screen_show')```

Also, yeah, it happens with both themes, just tested it with ephemeral.

I've also gone through multiple reboots for various reasons so it can't be lua-pam not linking to pam :slightly_smiling_face: .

Cheers, George

elenapan commented 4 years ago

Ah yes, the Lua 5.4 issue is known. AwesomeWM is not yet compatible with it. You can check issue https://github.com/awesomeWM/awesome/issues/3123 for updates.


As for the lock screen, I am a bit stumped as to what is wrong.

I have created a pull request (https://github.com/elenapan/dotfiles/pull/116) that will hopefully fix lock_screen_show() being nil, although I am suspecting the problem is somewhere else.

Let me know of any changes to behavior and/or logs. Thank you for your patience!

gtsatsis commented 4 years ago

Hey,

Sorry for the big delay, had some stuff come up; Merged the changes locally, and the nil error is gone, but it still uses the specified password in rc.lua instead of pam; no new logs this time.

Cheers, George

elenapan commented 4 years ago

Hi there,

This could only mean that the stat command is failing or that it is not installed in your system (I think it is included in the coreutils package of most distros, which I imagine is usually pre-installed).

Could you check if running the following command succeeds or not?

stat ~/.config/awesome/liblua_pam.so

If it fails then I will consider switching to a Lua-only method of checking if the file exists, like io.open(). I initially avoided it for potential performance issues (as it is executed synchronously and blocks the main AwesomeWM thread), however this check is only done once upon loading the WM, so it should not really matter.

gtsatsis commented 4 years ago

Hey,

Stat does indeed exist, but I've managed to trace the root of the issue back to liblua_pam; It had been compiled with lua5.4, hence the Error during a protected call: version mismatch: app. needs 504.0, Lua core provides 503.0 error.

The fix was to compile it with the lua5.3 headers in path instead of the lua5.4 ones!

Cheers, George

elenapan commented 4 years ago

Good to know, thank you for the update!

SunflowerFieldsForever commented 3 years ago

Sorry for my ignorant question:

I've reached the same problem that you have. Merging the pull request fixed lock_screen_show() from being nil, though now the lock screen uses the password in rc.lua instead of pam. Stat also exists for me.

@gtsatsis Can you explain to me how to compile liblua_pam with lua5.3 headers in the path? I'm unsure of how to do this myself.

gtsatsis commented 3 years ago

Sorry for my ignorant question:

I've reached the same problem that you have. Merging the pull request fixed lock_screen_show() from being nil, though now the lock screen uses the password in rc.lua instead of pam. Stat also exists for me.

@gtsatsis Can you explain to me how to compile liblua_pam with lua5.3 headers in the path? I'm unsure of how to do this myself.

Hey,

Just woke up, haven't used Arch in a while, but if I recall correctly, make sure that your Lua version (and headers in path) is 5.3 while running the compilation instructions at https://github.com/RMTT/lua-pam (or equivalent, this is what I noticed I'd cloned).

Easiest way to do it is to simply make sure only 5.3 is installed, then just compiling.