You are not logged in.

#1 2022-03-24 05:01:58

latipun
Member
Registered: 2022-03-23
Posts: 5

[SOLVED] SDDM freeze at login with the following session error

> 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"
done

which 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

#2 2022-03-24 07:45:37

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,696

Re: [SOLVED] SDDM freeze at login with the following session error

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

roll

Offline

#3 2022-03-25 22:29:35

latipun
Member
Registered: 2022-03-23
Posts: 5

Re: [SOLVED] SDDM freeze at login with the following session error

Thank you for your help.

seth wrote:

Because xprofile isn't interpreted by zsh and "{1…255}" isn't exactly POSIX.

So, SDDM expect `.xprofile` to be POSIX compliant then?

seth wrote:

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 hmm

seth wrote:

Also

In `.zshenv`, I have the following script:

#!/usr/bin/env bash

roll

I thought it would solve the error for this SDDM issue, but not. Sorry, noob me.

Offline

#4 2022-03-26 06:45:20

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,696

Re: [SOLVED] SDDM freeze at login with the following session error

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

#5 2022-03-26 11:24:00

latipun
Member
Registered: 2022-03-23
Posts: 5

Re: [SOLVED] SDDM freeze at login with the following session error

seth wrote:

Not necessarily, but you can't expect {ba,z}shism to work outside the targetted shell either.

Ok, thanks.

seth wrote:

/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 hmm

Offline

#6 2022-04-04 14:54:42

latipun
Member
Registered: 2022-03-23
Posts: 5

Re: [SOLVED] SDDM freeze at login with the following session error

[MY SOLUTION]
Turned out, you didn't need to source `.zshenv` into `.xprofile`. With SDDM, that file is automatically included smile

Last edited by latipun (2022-04-04 15:11:37)

Offline

#7 2022-04-04 15:01:28

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,696

Re: [SOLVED] SDDM freeze at login with the following session error

SDDM does *hopefully* not source .zshenv, but any zsh inside your session will.

Offline

#8 2022-04-04 15:09:41

latipun
Member
Registered: 2022-03-23
Posts: 5

Re: [SOLVED] SDDM freeze at login with the following session error

seth wrote:

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 hmm

Last edited by latipun (2022-04-04 15:10:05)

Offline

#9 2022-04-04 19:09:44

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,696

Re: [SOLVED] SDDM freeze at login with the following session error

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

Board footer

Powered by FluxBB