canonical / lightdm

Display Manager
GNU General Public License v3.0
813 stars 137 forks source link

1.32.0-6 Xsession #342

Closed OisLone2 closed 4 months ago

OisLone2 commented 4 months ago

archlinux shell: zsh

updated from 1.32.0-5 to 1.32.0-6.

Restart the computer and execute "pycherm" on the desktop system, but it cannot be executed. In terminal mode, manually enter instructions and they can be executed.

Restore to 1.32.0-5 can execute it directly on the desktop.

i checking the upgrade file, again upgrade to 1.32.0-6, manually restore the Xsession file from 1.32.0-5, restart the computer, and it will be a normal executable program. ​

AngryPhantom commented 4 months ago

I can confirm this on Artix Linux too (Arch-based). When I start xfce terminal I get this:

bash: PROMPT_COMMAND: line 0: syntax error near unexpected token `;'
bash: PROMPT_COMMAND: line 0: `history -a; history -n; ; printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'

As I see the main difference is in the /etc/lightdm/Xsession file between these two versions. Just look at it.

AngryPhantom commented 4 months ago

@OisLone2 I guess it's the wrong place to post issues since the last release was on the July 18, 2022.

I guess these files are being edited by Linux distribution developers. So, we should contact Arch or Artix teams who are responsible for the updates of lightdm.

OisLone2 commented 4 months ago

you are right

veremenko-y commented 4 months ago

@OisLone2 I guess it's the wrong place to post issues since the last release was on the July 18, 2022.

I guess these files are being edited by Linux distribution developers. So, we should contact Arch or Artix teams who are responsible for the updates of lightdm.

https://gitlab.archlinux.org/archlinux/packaging/packages/lightdm/-/issues/6

Arch claims it's upstream responsibility...

AngryPhantom commented 4 months ago

@veremenko-y Yeah, they took some sddm code and changed the Xsession file, couldn't reproduce it at first attempt and immediately closed the issue. Arch in all its glory. Anyway, we know what causes these errors and what should we do.

OisLone2 commented 4 months ago

FIX:

I'll test $HOME/.profile again My environment settings are also set here.

Test 1.32.0-5 should also not read .zshrc. But when logging in, 1.32.0-5 will read $HOME/.profile 1.32.0-6 login does not read $HOME/.profile. Not sure of the real reason yet, the previous guess that .zshrc should be incorrect. But make sure the interactive terminal reads .zshrc.


I did many tests. Solved my problem.

The problem is determined, 1.32.0-6 Xsession executes the program on the desktop and does not read and execute the $HOME/.zshrc file.

As a result, some environment settings in $HOME/.zshrc were not executed.

I transferred some environment settings in $HOME/.zshrc to .xprofile or .zprofile. After restarting, I can use the desktop environment to directly execute the program normally with the mouse and shortcut keys.

Therefore, Xsession reads .xprofile and .zprofile during login, but does not read .zshrc.

However, when using the interactive terminal mode, .zshrc will be read, so this is normal. .zshrc is the file used by ZSH itself and has nothing to do with oh-my-zsh.

The problem is that the Xsession of 1.32.0-5 runs normally on the desktop. This means that it will use the .zshrc file.

Koljasha commented 4 months ago

I also have a problem on Archlinux on version 1.32.0-6 in the Xsession file. In this version was changed the file code with different exports for different Shells. I am using Fish shell and version 1.32.0-6 does not work for me. I can't login to the window manager. When I enter my username and password, I have the lightdm screen again. If I change the shell to Bash by default, then logging is correct. To work, I had to use a fix: comment out the lines:

   # xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX`
   # $SHELL --login -c "/bin/sh -c 'export -p' > $xsess_tmp"
   # . $xsess_tmp
   # rm -f $xsess_tmp

There are a lot of additional exports in this part. And as I understand it, the additional export of $UID="1000" leads to an error when working with Fish.

I wrote to the Arch package support, but the guys answered me: "The code was "borrowed" from upstream sddm where it supposedly works." and they can't reproduce the error.

So the solution for me is to patch it myself. Maybe my decision will also help someone :)

OisLone2 commented 4 months ago

compare Xsession different version files


# 1.32.0-5
# Load profile
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
     if [ -f "$file" ]; then
         echo "Loading profile from $file";
         . "$file"
     fi
done

# Will read $HOME/.profile

-----------------------
# 1.32.0-6

# case

*/zsh)
     [ -z "$ZSH_NAME" ] && exec $SHELL --login $0 "$@"
     [[ -o login ]] || exec $SHELL --login $0 "$@"
     emulate -R sh

#esac

[ -f /etc/xprofile ] && . /etc/xprofile
[ -f /usr/local/etc/xprofile ] && . /usr/local/etc/xprofile
[ -f "$HOME/.xprofile" ] && . "$HOME/.xprofile"
`

# $HOME/.profile is not read, but .xprofile will be read, and ZSH will also read .zprofile

So it can be determined that the problem is that $HOME/.profile is not read. It is recommended to add


[ -f /etc/xprofile ] && . /etc/xprofile
[ -f /usr/local/etc/xprofile ] && . /usr/local/etc/xprofile
# ------ append this line ------
[ -f "$HOME/.profile" ] && . "$HOME/.profile"   
[ -f "$HOME/.xprofile" ] && . "$HOME/.xprofile"

should be able to solve

Maybe also consider that /etc/profile is not read either But I haven't tested this yet.

OisLone2 commented 4 months ago
# xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX`
# $SHELL --login -c "/bin/sh -c 'export -p' > $xsess_tmp"
# . $xsess_tmp
#rm -f $xsess_tmp

I think it's a problem with the program If modified to


# remove mktmp
xsess_tmp=`/tmp/xsess-env-XXXXXX`
# add line
mktemp $xsess_tmp
$SHELL --login -c "/bin/sh -c 'export -p' > $xsess_tmp"
.  $xsess_tmp
rm -f $xsess_tmp

Will it be correct?

Koljasha commented 4 months ago
# xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX`
# $SHELL --login -c "/bin/sh -c 'export -p' > $xsess_tmp"
# . $xsess_tmp
#rm -f $xsess_tmp

I think it's a problem with the program If modified to


# remove mktmp
xsess_tmp=`/tmp/xsess-env-XXXXXX`
# add line
mktemp $xsess_tmp
$SHELL --login -c "/bin/sh -c 'export -p' > $xsess_tmp"
.  $xsess_tmp
rm -f $xsess_tmp

Will it be correct?

No, it's not work. For me two options work for Fish:

OisLone2 commented 4 months ago

um... my zsh use export -p , no UID variable

Koljasha commented 4 months ago

um... my zsh use export -p , no UID variable

different shells - different ways )) Anyway, thanks for the "issue" - it helped me in my decision.