fairyglade / ly

display manager with console UI
Do What The F*ck You Want To Public License
5.23k stars 311 forks source link

[pending] /etc/ly/wsetup.sh exits unsuccessfully with TCSH #602

Open amberjennings opened 3 months ago

amberjennings commented 3 months ago

Hello, After the changes implemented in 0.12.0, I was finally able to get the zig rewrite of ly to compile. I set up the systemd service using the recommended method (zig build installsystemd) and made some changes to /etc/ly/config.ini (enable an animation, set a clock format, and change the masking text from * to -). However, upon a reboot, a few things happened:

Additional info: uname: Linux my_fqdn 6.8.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 02 May 2024 17:49:46 +0000 x86_64 GNU/Linux latest commit hash in my clone of ly: 629749b3832aaec86929794a527c108e5c1c29d1 init system: systemd desktop environments tested: i3 and sway

If there are any other questions I can answer or things I can test, let me know. Thanks!

Kawaii-Ash commented 3 months ago

I can't seem to reproduce the exception you're getting and I can successfully login on an arch vm into sway. Could you possibly list some steps that leads to the exception occurring so I can reproduce it?

My latest pr should fix the config issue u were having.

amberjennings commented 3 months ago

I can't seem to reproduce the exception you're getting and I can successfully login on an arch vm into sway. Could you possibly list some steps that leads to the exception occurring so I can reproduce it?

My latest pr should fix the config issue u were having.

Hi there, Thanks for getting back so quickly. I'll be able to be more specific on Monday when I'm back at my PC, but here are the steps I took:

Nothing fancy/that I think should cause this, but I was then unable to sign in with the error mentioned above. While I won't be at my machine physically for a few days, if there are any logs/details I can grab/share remotely let me know and I will.

Kawaii-Ash commented 3 months ago

My latest PR "should" allow you to login.

Let me know if the issue still occurs when you can.

amberjennings commented 3 months ago

Thanks! There's a chance I'll be at my computer tomorrow, if I am I will check and let you know -- else Monday.

amberjennings commented 3 months ago

@Kawaii-Ash I am now successfully seeing my config changes applied to my login screen. When I attempt to log in, the more verbose error is gone. However, there is no evidence of a sway session even attempting to start, and I am told "logged out" in the space above the username field. In addition, the cursor in the corner is still there when I do not have an animation applied (see attachment).

https://github.com/fairyglade/ly/assets/150633550/7eef552a-0222-4769-b9cd-339cd3e5921f

amberjennings commented 3 months ago

https://github.com/fairyglade/ly/assets/150633550/2a97e02f-24be-4a58-bdc9-bc604cb53420

... and here is a video of my attempt to sign in to an unconfigured ly session and start sway. I also notice that the default value of "false" for clear_password in config.ini does not seem to be doing much of anything (though I would ordinarily set it to true).

AnErrupTion commented 3 months ago

... and here is a video of my attempt to sign in to an unconfigured ly session and start sway.

It seems like Sway is crashing here (though I may be wrong). Just to confirm, are you able you launch Sway from a TTY?

amberjennings commented 3 months ago

... and here is a video of my attempt to sign in to an unconfigured ly session and start sway.

It seems like Sway is crashing here (though I may be wrong). Just to confirm, are you able you launch Sway from a TTY?

Yes, I have no issue opening sway from a tty. I've also verified that ly is looking in the right directory for my .desktop file.

Kawaii-Ash commented 3 months ago

I could reproduce this in an arch vm only when I didn't have polkit installed. Is your case the same or is it something else?

amberjennings commented 3 months ago

That could be it, I'm not sure if I have polkit installed on this system or not. I will check this evening. I don't seem to see polkit as a dependency listed in README, fyi -- but I'll look into this asap.

Kawaii-Ash commented 3 months ago

Alternatively, adding my user to the "seat" group and restarting seatd also allows me to launch sway as an alternative to installing polkit.

But without doing either, I have the same issue starting sway from a tty when I'm not root. But apparently you have no issue opening sway from a tty.

Other than that, I'm not really sure what the issue is.

amberjennings commented 3 months ago

It looks like I have polkit installed and running already. Adding myself to the seat group and restarting seatd + rebooting didn't seem to affect anything either. And yet, I am still able to start sway just fine from a tty.

Kawaii-Ash commented 3 months ago

If you redirect stderr to a file, like: sudo zig-out/bin/ly 2> o.txt

Then try to login to sway, does the file contain anything?

AnErrupTion commented 3 months ago

Ah yes, wlroots-based WMs like labwc and sway have issues when polkit and D-Bus aren't installed. Check that the latter is installed (it should be, but just to make sure).

If that's OK, I recommend redirecting and checking stderr like Ash suggested. If it says anything about the former 2 dependencies (or if it doesn't say anything useful), try prepending this command to the Exec line of your Sway desktop file:

dbus-run-session

amberjennings commented 3 months ago

I have both polkit and dbus installed and running. On attempting to redirect errors to a file, running ly and trying to start sway, no errors are generated, both when I use dbus-run-session and when I do not.

AnErrupTion commented 3 months ago

That's interesting... so it doesn't work with dbus-run-session either? Sometimes quite wrong here then. How did you end up installing Arch+ly+Sway, so that we could try to reproduce this behavior as perfectly as possible? @amberjennings

amberjennings commented 3 months ago

I installed Arch from the official iso, looks like this system was set up in August 2023 so the 2023.08.01 image. I keep my packages up to date, though, so I'm not sure that's super relevant. Sway would've just been installed via Pacman, and ly via this repository and zig build/zig build installsystemd. Not sure how helpful this is but let me know if you have more questions.

Kawaii-Ash commented 3 months ago

Could you edit your config file and change wayland_cmd = /etc/ly/wsetup.sh to just wayland_cmd = to see if it makes any difference?

amberjennings commented 3 months ago

This seems to have done it! I do use tcsh and I'm not sure how extensively that block is tested. I notice that it's not checking for ~/.cshrc alongside /etc/csh.login and ~/.login though I don't know if that means much. But in the meantime, this issue is resolved. Thank you both again!

amberjennings commented 3 months ago

I guess maybe this should stay open until the repository is updated to fix this. But my personal situation is resolved.

AnErrupTion commented 3 months ago

@amberjennings We're both unable to reproduce your issue with TCSH changed as the default shell for all users. Do you have a custom TCSH configuration perhaps? And, just to make sure (but I can probably guess the result), what's the output of echo $SHELL in a TTY?

amberjennings commented 3 months ago

@amberjennings We're both unable to reproduce your issue with TCSH changed as the default shell for all users. Do you have a custom TCSH configuration perhaps? And, just to make sure (but I can probably guess the result), what's the output of echo $SHELL in a TTY?

amber@shruikan ~ % echo $SHELL
/bin/tcsh
amber@shruikan ~ % cat .cshrc
alias ls        ls --color
alias l         ls -al
alias ll        ls -l
alias g         git
alias em        emacs
alias sget      spotdl --bitrate 320k download

setenv  EDITOR  emacs

if (`uname` == "Linux") then
 setenv PATH  "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/amber/.local/bin"
endif

if (`uname` == "Darwin") then
 setenv PATH  "/opt/homebrew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/Users/amber/.local/bin"
endif

if (-e ~/.hushmotd) then
    rm -f ~/.hushmotd
endif

set     red="%{\033[1;31m%}"
set   green="%{\033[0;32m%}"
set  yellow="%{\033[1;33m%}"
set    blue="%{\033[1;34m%}"
set magenta="%{\033[1;35m%}"
set    cyan="%{\033[1;36m%}"
set   white="%{\033[0;37m%}"
set     end="%{\033[0m%}"

set prompt="${blue}%n${white}@${blue}%m ${cyan}%~ ${white}%%${end} "
unset red green yellow blue magenta cyan yellow white end
umask 077
AnErrupTion commented 3 months ago

@amberjennings Well that's awkward, I'm still unable to reproduce the bug. I think it might be easier for you to try to mess with the wsetup.sh script, in particular with the TCSH configuration part, to maybe find what's wrong (and perhaps we'll be able to better deduce what's wrong later on).

amberjennings commented 3 months ago

Yeah, I can do that. No promises on timeline as I am quite busy but if you want to assign to me I'll do what I can.

AnErrupTion commented 3 months ago

Yeah, I can do that. No promises on timeline as I am quite busy but if you want to assign to me I'll do what I can.

No pressure! I feel like assigning yourself to an issue you reported is kind of odd though... but I'll edit the title of the issue to reflect its "pending" status.

amberjennings commented 3 months ago

I'm attempting to find the source referred to in wsetup.sh (kde-workspace/kdm/kfrontend/genkdmconf.c) and it looks like the kde-workspace repository was shuttered 9 years ago in favor of plasma-workspace, and even then I cannot locate that file. I realize that this is a part of the original C version of ly and not put in place by you, but also, if telling it not to run at all makes the program work, with some more testing, could it be phased out entirely?

AnErrupTion commented 3 months ago

if telling it not to run at all makes the program work, with some more testing, could it be phased out entirely?

Well, it sources the profile for the logged in user's shell. Yes, it can work just fine without it, however it can be useful if you want to run something specific right before your DE/WM starts. Granted, I don't believe the current shell code for sourcing the logged in user's shell profile is that much useful anymore (or maybe it is, like if that sets up some specific stuff that the DE/WM can use while starting?).

With all of that said, you also have to keep in mind that xsetup.sh exists as well, which fills an even more important purpose because it sources an X11-specific profile (which may or may not be needed by the DE/WM), but more importantly, it calls xrdb -merge on X11 resource files.

So at the end of the day, I think it's probably best to try and fix the issue at hand, or at least try to find why the script doesn't work with your specific setup.

amberjennings commented 3 months ago

Yeah, I can see the use case, I'm just not sure why it's entirely preventing me from starting a desktop session. Just running the script on its own works fine (because all its doing is sourcing environment variables that already exist, aiui). The xsetup script is definitely more integral.

/etc/csh.login has some interesting stuff happening:

if ( -o /dev/$tty && ${?prompt} ) then
    # Console
    if ( ! ${?TERM} )           setenv TERM linux
    if ( "$TERM" == "unknown" ) setenv TERM linux
    # No tset available on SlackWare
    if ( -x "`which stty`" ) stty sane cr0 pass8 dec
    if ( -x "`which tset`" ) tset -I -Q
    unsetenv TERMCAP
    settc km yes
endif

/etc/csh.cshrc seems mostly uninteresting, but it exists as well. When I get some time I will try modifying wsetup.sh and doing some more testing.