coastalwhite / lemurs

A customizable TUI display/login manager written in Rust 🐒
Apache License 2.0
721 stars 32 forks source link

Starting post-login environment failed (spectrwm) #104

Closed point-4ward closed 1 year ago

point-4ward commented 1 year ago

Hi,

Feel like I'm missing something obvious, but after a trying few different combinations I currently have:

/etc/lemurs/wms/spectrwm

#!/bin/sh

exec spectrwm

Nothing at all in ~/.xinitrc if that makes any difference

When I boot I get the lemurs login prompt with 'spectrwm' at the top, fill in my username and password and it goes to a blank screen. Log appears to show everything running fine up to Run X server, then just says:

[lemurs::ui][ERROR] Starting post-login environment failed

If I disable the service, reboot, login on tty, put exec spectrwm into my ~/.xinitrc and run startx, spectrwm loads as expected.

Any ideas please?

coastalwhite commented 1 year ago

Did you try with other window managers? If so, did that work?

Could you add spectrwm 2>&1 > $HOME/lemurs-log to the /etc/lemurs/wms/spectrwm and tell me what the content of ~/lemurs is?

I am sorry if this process of debugging is a but cumbersome. I added better error logging for the next version.

point-4ward commented 1 year ago

Hi,

I haven't tried any other window managers, this is a brand new setup.

I've tried

exec spectrwm 2>&1 > $HOME/lemurs-log
exec spectrwm
spectrwm 2>&1 > $HOME/lemurs-log
spectrwm 2>&1 > $HOME/lemurs-log
exec spectrwm

and nothing seems to be being written to any logs, the /var/log/lemurs.log looks exactly the same as it did before, and nothing is created in my home directory.

I do not have a ~/lemurs directory, just a ~/lemurs-git from the original build - I take it I should have??

full log for info...

[2022-12-11][20:13:01][lemurs][INFO] Lemurs logger is running
[2022-12-11][20:13:01][lemurs][INFO] Switching to tty 2
[2022-12-11][20:13:01][lemurs][INFO] UI booted up
[2022-12-11][20:13:01][lemurs::post_login][WARN] Failed to read from the wayland folder '/etc/lemurs/wayland'
[2022-12-11][20:13:01][lemurs::info_caching][INFO] Attempting to get a cached information from '/var/cache/lemurs'
[2022-12-11][20:13:01][lemurs::info_caching][INFO] Read cache file and found environment 'spectrwm' and username 'p4'
[2022-12-11][20:13:01][lemurs::ui][INFO] Loading username 'p4' from cache
[2022-12-11][20:13:01][lemurs::ui][INFO] Loading environment 'spectrwm' from cache
[2022-12-11][20:13:06][lemurs::auth][INFO] Login attempt for 'p4'
[2022-12-11][20:13:06][lemurs::auth::pam][INFO] Started opening session
[2022-12-11][20:13:06][lemurs::auth::pam][INFO] Gotten Authenticator
[2022-12-11][20:13:06][lemurs::auth::pam][INFO] Got handler
[2022-12-11][20:13:06][lemurs::auth::pam][INFO] Validated account
[2022-12-11][20:13:06][lemurs::auth::pam][INFO] Opened session
[2022-12-11][20:13:06][lemurs::ui][INFO] Setting cached information
[2022-12-11][20:13:06][lemurs::info_caching][INFO] Attempting to set cache
[2022-12-11][20:13:06][lemurs::info_caching][INFO] Successfully set username in cache file
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'HOME' to '/home/p4'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Successfully changed working directory to /home/p4!
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'SHELL' to '/bin/bash'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'USER' to 'p4'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'LOGNAME' to 'p4'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'PATH' to '/usr/local/sbin:/usr/local/bin:/usr/bin'
[2022-12-11][20:13:06][lemurs::post_login][INFO] Set environment variables.
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_CONFIG_DIR' to '/home/p4/.config'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_CACHE_HOME' to '/home/p4/.cache'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_DATA_HOME' to '/home/p4/.local/share'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_STATE_HOME' to '/home/p4/.local/state'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_DATA_DIRS' to '/usr/local/share:/usr/share'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_CONFIG_DIRS' to '/etc/xdg'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_RUNTIME_DIR' to '/run/user/1000'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_SESSION_DIR' to 'user'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_SESSION_ID' to '1'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_SEAT' to 'seat0'
[2022-12-11][20:13:06][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_VTNR' to '2'
[2022-12-11][20:13:06][lemurs::post_login][INFO] Set XDG environment variables
[2022-12-11][20:13:06][lemurs::post_login::x][INFO] Start setup of X
[2022-12-11][20:13:06][lemurs::post_login::x][INFO] Filling Xauthority file
[2022-12-11][20:13:06][lemurs::post_login::x][INFO] Run X server
[2022-12-11][20:13:26][lemurs::ui][ERROR] Starting post-login environment failed
coastalwhite commented 1 year ago

I am sorry, that was a bit unclear from my side. The script

#! /bin/sh
spectrwm 2>&1 > $HOME/lemurs-log
exec spectrwm

should create a log file in your home directory ~/lemurs-log. I am interested in the contents of this file.

point-4ward commented 1 year ago

No problem, I did try that combination but nothing was created - let me try it again just to be sure...

Confirmed, nothing is created in the home directory and the output to /var/log/lemurs.log is identical to the one I posted above (except the timestamps, obviously)

I've tried putting spectrwm 2>&1 > /home/p4/lemurs-log in case there was some issue with the env var but still nothing 😕

coastalwhite commented 1 year ago

Thank you for the continued debugging?

Does the /etc/lemurs/xsetup.sh file exist?

point-4ward commented 1 year ago

Hi, sorry for the delay.

Yes, that file is there and is executable - do you need the contents?

coastalwhite commented 1 year ago

Mmmh, okay. I have finally to find some time and set up a VM with spectrwm. I do not seem to have any problem. What distribution are you using? It might help to install from the develop branch, the debug logging in /var/log/lemurs should be vastly improved there.

point-4ward commented 1 year ago

This is an Arch install.

I'll have a look over the weekend with the develop branch and get back to you 👍

point-4ward commented 1 year ago

Hi,

So I installed from the develop branch today - same problem persists. Not much has changed in the log though...

[INFO  lemurs] Lemurs logger is running
[INFO  lemurs] Switching to tty 2
[INFO  lemurs] UI booted up
[INFO  lemurs::info_caching] Attempting to get a cached information from '/var/cache/lemurs'
[INFO  lemurs::info_caching] Read cache file and found environment 'p4' and username 'None'
[INFO  lemurs::ui] Loading environment 'p4' from cache
[WARN  lemurs::ui::switcher] Failed to find selection with title: 'p4'
[INFO  lemurs::auth] Login attempt for 'p4'
[INFO  lemurs::auth::pam] Started opening session
[INFO  lemurs::auth::pam] Gotten Authenticator
[INFO  lemurs::auth::pam] Got handler
[INFO  lemurs::auth::pam] Validated account
[INFO  lemurs::auth::pam] Opened session
[INFO  lemurs::ui] Setting cached information
[INFO  lemurs::info_caching] Attempting to set cache
[INFO  lemurs::info_caching] Successfully set username in cache file
[INFO  lemurs::post_login::env_variables] Set environment variable 'HOME' to '/home/p4'
[INFO  lemurs::post_login::env_variables] Successfully changed working directory to /home/p4!
[INFO  lemurs::post_login::env_variables] Set environment variable 'SHELL' to '/bin/bash'
[INFO  lemurs::post_login::env_variables] Set environment variable 'USER' to 'p4'
[INFO  lemurs::post_login::env_variables] Set environment variable 'LOGNAME' to 'p4'
[INFO  lemurs::post_login::env_variables] Set environment variable 'PATH' to '/usr/local/sbin:/usr>
[INFO  lemurs::post_login] Set environment variables
[INFO  lemurs::post_login::env_variables] Set environment variable 'XDG_CONFIG_DIR' to '/home/p4/.>
[INFO  lemurs::post_login::env_variables] Set environment variable 'XDG_CACHE_HOME' to '/home/p4/.>
[INFO  lemurs::post_login::env_variables] Set environment variable 'XDG_DATA_HOME' to '/home/p4/.l>
[INFO  lemurs::post_login::env_variables] Set environment variable 'XDG_STATE_HOME' to '/home/p4/.>
[INFO  lemurs::post_login::env_variables] Set environment variable 'XDG_DATA_DIRS' to '/usr/local/>
[INFO  lemurs::post_login::env_variables] Set environment variable 'XDG_CONFIG_DIRS' to '/etc/xdg'
[INFO  lemurs::post_login::env_variables] Set environment variable 'XDG_RUNTIME_DIR' to '/run/user>
[INFO  lemurs::post_login::env_variables] Set environment variable 'XDG_SESSION_DIR' to 'user'
[INFO  lemurs::post_login::env_variables] Set environment variable 'XDG_SESSION_ID' to '1'
[INFO  lemurs::post_login::env_variables] Set environment variable 'XDG_SEAT' to 'seat0'
[INFO  lemurs::post_login::env_variables] Set environment variable 'XDG_VTNR' to '2'
[INFO  lemurs::post_login::env_variables] Set environment variable 'XDG_SESSION_TYPE' to 'x11'
[INFO  lemurs::post_login] Set XDG environment variables
[INFO  lemurs::post_login::x] Start setup of X
[INFO  lemurs::post_login::x] Filling Xauthority file
[INFO  lemurs::post_login::x] Run X server
[ERROR lemurs::post_login::x] Starting X timed out!
[ERROR lemurs::ui] Starting post-login environment failed

Only noticable difference for me is the penultimate line "Starting X timed out!" :/

coastalwhite commented 1 year ago

Oh, that is very interesting, actually! But unless you have a laptop from 1980s, I would still consider that a bug.

What Lemurs is doing internally is asking X every 100ms whether it has started. After a set number of tries, it gives up and assumes X is stuck or not starting up at all. Then, it will kill the session and kick you back to the login screen. Not really sure why X is not starting within 20 seconds.

I will leave this issue open as others may have the same problem, but I am not really sure where to go from here. I am attempting to make debugging these problems a lot better, but that is going to take a while.

point-4ward commented 1 year ago

No worries - I will wait and see what you come up with.

As I say, using startx after logging in from the tty works fine, it's only through Lemurs.

One thing I had noticed though, is that after I have had a try with Lemurs and then disable it to use startx, I have to delete the .Xauthority file as startx cannot write to it. I presume this is because Lemurs opens the file when it tries to start X but then it never gets correctly closed as X never starts, but just in case it's another clue for you I thought I'd better include it here.

EDIT - also, to note, I never get kicked back to login screen (as you described should be the behaviour), it just hangs on black screen until I either ctl-alt-bksp or switch to another tty.

coastalwhite commented 1 year ago

Ah, okay. The Xauthority thing was a bug that should be solved on develop. Looking into the rest.

0xDkXy commented 1 year ago

I have the same bug while using awesomewm. But, something weird is that on the another computer which I installed arch before, it worked well.

And it's seems like it's caused by using systemd. The owner of .Xauthrity is root, so I guess that it will make the timeout of xauth.

coastalwhite commented 1 year ago

I have solutions for both problems. Personally, I was blocking the next version for #114 and #115, but it seems like those issues can wait for the next version. I will seek to update Lemurs somewhere in the coming days with fixes for these problems.

coastalwhite commented 1 year ago

Good news. I am able to boot into spectrwm on the new version 0.3.1. :smile: