You are not logged in.
> Tried to switch from `LightDM` with `SDDM`.
> After successful install and enable the service, reboot and tried to login, but after enter my password and login, it freeze, the cursor still can move, but can't interact to anything, didn't login to desktop.
> Switch to tty2 and login, check the `~/.local/share/sddm/xorg-session.log`:
/home/latipun/.zshenv:declare:54: not valid in this context: color{0..255}Turned out I can't login because of bash script.
I have `.xprofile` which is sourching the `.zshenv` file. In `.zshenv`, I have the following script:
#!/usr/bin/env bash
esc="\033"
reset="${esc}[0m"
for color in {0..255}; do
declare "color${color}=${esc}[38;5;${color}m"
done
for bg in {0..255}; do
declare "bg${bg}=${esc}[48;5;${bg}m"
donewhich is I thought a valid script, and I didn't have issue and can login with `LightDM`. If I commented out the `.zshenv` sourcing in the `.xprofile` file, I can login into desktop with `SDDM`.
Why is that?
Thank you.
Last edited by latipun (2022-03-25 22:30:03)
Offline
Why is that?
Because xprofile isn't interpreted by zsh and "{1…255}" isn't exactly POSIX.
https://mywiki.wooledge.org/Bashism
Though I don't see why you'd need that variable definition in the context of the X11 shell anyway.
Also
In `.zshenv`, I have the following script:
#!/usr/bin/env bash
… ![]()
Offline
Thank you for your help.
Because xprofile isn't interpreted by zsh and "{1…255}" isn't exactly POSIX.
So, SDDM expect `.xprofile` to be POSIX compliant then?
Though I don't see why you'd need that variable definition in the context of the X11 shell anyway.
Yeah right, I actually didn't need it too in `.zshenv` in context of shell / terminal too, it's just there because I didn't cleanup the code from my bash scripts. Because of that, I just have new findings since the error did not show up in LightDM which make me wondering again why is that ![]()
Also
In `.zshenv`, I have the following script:
#!/usr/bin/env bash
…
I thought it would solve the error for this SDDM issue, but not. Sorry, noob me.
Offline
So, SDDM expect `.xprofile` to be POSIX compliant then?
Not necessarily, but you can't expect {ba,z}shism to work outside the targetted shell either.
/usr/share/sddm/scripts/Xsession has a /bin/sh shebang, does /bin/sh symlink bash?
Offline
Not necessarily, but you can't expect {ba,z}shism to work outside the targetted shell either.
Ok, thanks.
/usr/share/sddm/scripts/Xsession has a /bin/sh shebang, does /bin/sh symlink bash?
Yes, my /bin/sh is symlinked to the /bin/bash ![]()
Offline
[MY SOLUTION]
Turned out, you didn't need to source `.zshenv` into `.xprofile`. With SDDM, that file is automatically included ![]()
Last edited by latipun (2022-04-04 15:11:37)
Offline
SDDM does *hopefully* not source .zshenv, but any zsh inside your session will.
Offline
SDDM does *hopefully* not source .zshenv, but any zsh inside your session will.
yes, thanks. Exactly, that's what I meant. ZSH shell always source `.zshenv`, so, in SDDM Xsession scripts, there's no `.zshenv`.
IIRC, it does not work before in LightDM, so I need to source `.zshenv` inside my `.xprofile`, because I think, LightDM didn't use my default shell which is ZSH when login ![]()
Last edited by latipun (2022-04-04 15:10:05)
Offline
so I need to source `.zshenv` inside my `.xprofile`, because I think, LightDM didn't use my default shell which is ZSH when login
No? I'm not sure *what* "didn't work" w/ lightdm, but the zshenv declares some color variables - you rather won't need those for the overall session at all, but only inside a zsh shell?
And zsh, in any terminal, on any desktop environment, started by any DM will always load .zshenv - before anything else.
zshenv is zsh specific, it has no business being in xprofile or /etc/profile etc.
If you need anything in those contexts (X11 session or globally), you should add it there - not zshenv.
And if something is only required in the context of zsh, you should not add it to completely unrelated stuff like either the X11 session nor the global profiles.
Offline