coastalwhite / lemurs

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

Compilation failure (mismatched types) #105

Closed PaddiM8 closed 1 year ago

PaddiM8 commented 1 year ago

It currently doesn't build on Rust 1.65.0

error[E0308]: mismatched types
  --> src/auth/utmpx.rs:23:21
   |
23 |         s.ut_user = ut_user;
   |         ---------   ^^^^^^^ expected `u8`, found `i8`
   |         |
   |         expected due to the type of this binding
   |
   = note: expected array `[u8; 32]`
              found array `[i8; 32]`

error[E0308]: mismatched types
  --> src/auth/utmpx.rs:36:21
   |
36 |         s.ut_line = ut_line;
   |         ---------   ^^^^^^^ expected `u8`, found `i8`
   |         |
   |         expected due to the type of this binding
   |
   = note: expected array `[u8; 32]`
              found array `[i8; 32]`

error[E0308]: mismatched types
  --> src/auth/utmpx.rs:40:19
   |
40 |         s.ut_id = ut_id;
   |         -------   ^^^^^ expected `u8`, found `i8`
   |         |
   |         expected due to the type of this binding
   |
   = note: expected array `[u8; 4]`
              found array `[i8; 4]`
coastalwhite commented 1 year ago

Hey!

Thank you for bringing this to my attention. LibC uses some different types for some different platforms. All the platforms on docs.rs show that c_char is an i8, so I used that. Turns out for most ARM devices it is not, I guess I need to watch closer next time. Can you confirm that you are indeed using an ARM device? If you have the time and interest, could you try to compile the referenced branch? That would massively help me.

Thank you again.

PaddiM8 commented 1 year ago

I am indeed on ARM (Asahi Linux). The referenced branch does compile! Very nice, thank you for getting on this so quickly. I'll try it and make sure it actually works as well.

PaddiM8 commented 1 year ago

Hmm I can't seem to log in. It thinks the password is incorrect. Entering the (correct) password a few times results in being locked out for some minutes, so lemurs might give it the wrong password?

coastalwhite commented 1 year ago

Is there any chance you can switch to another TTY and give me the contents of /var/log/lemurs? There might be problems with PAM or the rust bindings to it, we are using.

PaddiM8 commented 1 year ago

Yeah sure, I have plenty of time right now so don't worry! After pressing enter, I could see some text flash for a split seconds to the left of the input fields. I think it said it failed to login or something like that, but Icouldn't really read it.

[2022-12-15][19:14:33][lemurs][INFO] Lemurs logger is running
[2022-12-15][19:14:33][lemurs][INFO] Switching to tty 2
[2022-12-15][19:14:33][lemurs][INFO] UI booted up
[2022-12-15][19:14:33][lemurs::info_caching][INFO] Attempting to get a cached information from '/var/cache/lemurs'
[2022-12-15][19:14:33][lemurs::info_caching][INFO] Read cache file and found environment 'paddi' and username 'None'
[2022-12-15][19:14:33][lemurs::ui][INFO] Loading environment 'paddi' from cache
[2022-12-15][19:14:33][lemurs::ui::switcher][WARN] Failed to find selection with title: 'paddi'
[2022-12-15][19:14:42][lemurs::auth][INFO] Login attempt for 'paddi'
[2022-12-15][19:14:42][lemurs::auth::pam][INFO] Started opening session
[2022-12-15][19:14:42][lemurs::auth::pam][INFO] Gotten Authenticator
[2022-12-15][19:14:42][lemurs::auth::pam][INFO] Got handler
[2022-12-15][19:14:42][lemurs::auth::pam][INFO] Validated account
[2022-12-15][19:14:42][lemurs::auth::pam][INFO] Opened session
[2022-12-15][19:14:42][lemurs::ui][INFO] Setting cached information
[2022-12-15][19:14:42][lemurs::info_caching][INFO] Attempting to set cache
[2022-12-15][19:14:42][lemurs::info_caching][INFO] Successfully set username in cache file
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'HOME' to '/home/paddi'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Successfully changed working directory to /home/paddi!
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'SHELL' to '/usr/bin/fish'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'USER' to 'paddi'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'LOGNAME' to 'paddi'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'PATH' to '/usr/local/sbin:/usr/local/bin:/usr/bin'
[2022-12-15][19:14:42][lemurs::post_login][INFO] Set environment variables.
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_CONFIG_DIR' to '/home/paddi/.config'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_CACHE_HOME' to '/home/paddi/.cache'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_DATA_HOME' to '/home/paddi/.local/share'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_STATE_HOME' to '/home/paddi/.local/state'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_DATA_DIRS' to '/usr/local/share:/usr/share'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_CONFIG_DIRS' to '/etc/xdg'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_RUNTIME_DIR' to '/run/user/1000'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_SESSION_DIR' to 'user'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_SESSION_ID' to '1'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_SEAT' to 'seat0'
[2022-12-15][19:14:42][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_VTNR' to '2'
[2022-12-15][19:14:42][lemurs::post_login][INFO] Set XDG environment variables
[2022-12-15][19:14:42][lemurs::post_login][INFO] Starting Wayland Session
[2022-12-15][19:14:42][lemurs::post_login][INFO] Entered Wayland compositor
[2022-12-15][19:14:42][lemurs::auth::utmpx][INFO] Adding UTMPX record
[2022-12-15][19:14:42][lemurs::auth::utmpx][INFO] Added UTMPX record
[2022-12-15][19:14:42][lemurs::auth::utmpx][INFO] Removing UTMPX record
[2022-12-15][19:14:49][lemurs::auth][INFO] Login attempt for 'paddi'
[2022-12-15][19:14:49][lemurs::auth::pam][INFO] Started opening session
[2022-12-15][19:14:49][lemurs::auth::pam][INFO] Gotten Authenticator
[2022-12-15][19:14:49][lemurs::auth::pam][INFO] Got handler
[2022-12-15][19:14:49][lemurs::auth::pam][INFO] Validated account
[2022-12-15][19:14:49][lemurs::auth::pam][INFO] Opened session
[2022-12-15][19:14:49][lemurs::ui][INFO] Setting cached information
[2022-12-15][19:14:49][lemurs::info_caching][INFO] Attempting to set cache
[2022-12-15][19:14:49][lemurs::info_caching][INFO] Successfully set username in cache file
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'HOME' to '/home/paddi'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Successfully changed working directory to /home/paddi!
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'SHELL' to '/usr/bin/fish'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'USER' to 'paddi'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'LOGNAME' to 'paddi'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'PATH' to '/usr/local/sbin:/usr/local/bin:/usr/bin'
[2022-12-15][19:14:49][lemurs::post_login][INFO] Set environment variables.
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_CONFIG_DIR' to '/home/paddi/.config'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_CACHE_HOME' to '/home/paddi/.cache'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_DATA_HOME' to '/home/paddi/.local/share'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_STATE_HOME' to '/home/paddi/.local/state'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_DATA_DIRS' to '/usr/local/share:/usr/share'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_CONFIG_DIRS' to '/etc/xdg'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_RUNTIME_DIR' to '/run/user/1000'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_SESSION_DIR' to 'user'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_SESSION_ID' to '1'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_SEAT' to 'seat0'
[2022-12-15][19:14:49][lemurs::post_login::env_variables][INFO] Set environment variable 'XDG_VTNR' to '2'
[2022-12-15][19:14:49][lemurs::post_login][INFO] Set XDG environment variables
[2022-12-15][19:14:49][lemurs::post_login][INFO] Starting Wayland Session
[2022-12-15][19:14:49][lemurs::post_login][INFO] Entered Wayland compositor
[2022-12-15][19:14:49][lemurs::auth::utmpx][INFO] Adding UTMPX record
[2022-12-15][19:14:49][lemurs::auth::utmpx][INFO] Added UTMPX record
[2022-12-15][19:14:49][lemurs::auth::utmpx][INFO] Removing UTMPX record
coastalwhite commented 1 year ago

It is logging in as it supposed to. The Wayland session is crashing, though. What Wayland desktop environment / window manager are you using? These problems are kind of difficult to debug at the moment. You could try to update to the develop branch, as I have been working on improving the logging there a bit.

PaddiM8 commented 1 year ago

I switched to the develop branch and merged the new changes. Now I did get some good output from Sway:

[INFO  lemurs::auth::utmpx] Adding UTMPX record
[INFO  lemurs::auth::utmpx] Added UTMPX record
[WARN  lemurs::post_login] Environment came back with non-zero exit code.
[WARN  lemurs::post_login] Environment's stderr: """
    00:00:00.004 [ERROR] [wlr] [libseat] [libseat/backend/logind.c:642] Could not check if session was active: No such device or address
    00:00:00.004 [ERROR] [wlr] [libseat] [libseat/libseat.c:79] No backend was able to open a seat
    00:00:00.004 [ERROR] [wlr] [backend/session/session.c:84] Unable to create seat: Function not implemented
    00:00:00.004 [ERROR] [wlr] [backend/session/session.c:249] Failed to load session backend
    00:00:00.004 [ERROR] [wlr] [backend/backend.c:86] Failed to start a session
    00:00:00.004 [ERROR] [wlr] [backend/backend.c:352] Failed to start a DRM session
    00:00:00.004 [ERROR] [sway/server.c:56] Unable to create backend
    """
[INFO  lemurs::post_login] Returning to Lemurs...
[INFO  lemurs::auth::utmpx] Removing UTMPX record

My user is in the seat group. Tried with plasma and Hyprland as well with no success. Hyprland gave similar errors while plasma didn't give me any information (not sure how plasma works though, it just came with Asahi).

I know ly has issues with arm64 as well, I wonder if it's related to something similar.

coastalwhite commented 1 year ago

It might very well be. A lot of the code from this repository is inspired from ly. Wayland is usually very difficult to debug. Did you try with polkit instead of seatd? This should work well with SystemD.