You are not logged in.
I was using Fedora and decided to switch to Arch Linux and I kept most of my dotfiles, but I have been having problems with some environment variables in .zshenv and commands in .zprofile.
Exporting new $PATH locations is working as expected but
export QT_QPA_PLATFORMTHEME="qt5ct"and
export LD_PRELOAD="/usr/local/lib/libgtk3-nocsd.so.0"didn't work at all in .zshenv. Even though the variables appear to be set correctly when I echo them. I also use .zprofile to start some systemd user services at login, but these are not working either.
I found this while peeking at journalctl:
pam_env(login:session): deprecated reading of user environment enabled
I don't know if this has anything to do with the .z files problem.
Anyone knows how to fix this?
SOLVED
Solution: Lightdm doesn't source .zprofile and .zshenv by default in Arch. I had to add .zprofile to the files it sources at login at /etc/lightdm/Xsession and I also followed wiki's suggestion for .zshenv
Last edited by UnluckyNinja (2022-02-14 21:06:38)
Offline
https://wiki.archlinux.org/title/Zsh#St … down_files
But if you are using OMZ, all bets are off.
Offline
I don't see how this helps me. I know what which file does. My problem is that they appear to not being read properly at user login. It was working in Fedora, but now they are acting weird.
Last edited by UnluckyNinja (2022-02-14 19:38:34)
Offline
That section of the wiki describes the order in which they are read. If they "aren't being read properly", it probably means "they aren't being read at all", which suggests there is a prior file that is...
Offline
Exporting new $PATH locations is working as expected but
export QT_QPA_PLATFORMTHEME="qt5ct"and
export LD_PRELOAD="/usr/local/lib/libgtk3-nocsd.so.0"didn't work at all in .zshenv. Even though the variables appear to be set correctly when I echo them.
What makes you think that this isn't working if they are echoing the correct value?
Offline
That section of the wiki describes the order in which they are read. If they "aren't being read properly", it probably means "they aren't being read at all", which suggests there is a prior file that is...
But I only have these variables in this file.
UnluckyNinja wrote:Exporting new $PATH locations is working as expected but
export QT_QPA_PLATFORMTHEME="qt5ct"and
export LD_PRELOAD="/usr/local/lib/libgtk3-nocsd.so.0"didn't work at all in .zshenv. Even though the variables appear to be set correctly when I echo them.
What makes you think that this isn't working if they are echoing the correct value?
Because qt5ct keeps saying I need to set up the variable when it appears to be already set. I would believe it was qt5ct bug but it wasn't working for gtk3-nocsd either. Also .zprofile is not starting my user services.
Offline
And how are you logging in?
Offline
And how are you logging in?
I'm using lightdm. This is a ZFS on root install and my home directory is encrypted with ZFS native encryption but I don't think it has anything to do with ZFS. Pam has to load my encryption keys and mount the dataset at first login and I can see that causing problems, but it doesn't unload the key or unmount the dataset at logout and the problem persists at subsequent logins when the home directory is already unencrypted and mounted.
I just added
echo "bla bla bla" > ~/blabla.txtto my .zprofile and it doesn't create a blabla.txt file at login so it isn't being read.
Offline
Does it work if you log into an actual terminal and start X from there? DMs don't start normal login shells.
Offline
Thankfully I stopped using lightdm long ago, but I would speculate that it launches a bash session. Try putting the variables in .bash_profile.
Offline
Thankfully I stopped using lightdm long ago, but I would speculate that it launches a bash session. Try putting the variables in .bash_profile.
You speculate incorrectly. DM's shouldn't launch any login shell...
Offline
Thankfully I stopped using lightdm long ago, but I would speculate that it launches a bash session. Try putting the variables in .bash_profile.
It doesn't read .bash_profile either.
Does it work if you log into an actual terminal and start X from there? DMs don't start normal login shells.
I know lightdm sessions do not read .zlogout when you are logging out, but .zprofile and .zshenv always worked for me. I actually never tried starting x from the command line. I just tried using startx but it outputs errors so I guess I need to do some configuring before I can start x from tty. At least when I log in via tty it creates the blabla.txt file so it is reading .zprofile.
tucuxi wrote:Thankfully I stopped using lightdm long ago, but I would speculate that it launches a bash session. Try putting the variables in .bash_profile.
You speculate incorrectly. DM's don't usually launch any login shell...
lightdm usually does launch login shells. I have been using lightdm for a while and it does read .zprofile and .zshenv (at least in Fedora it does).
Offline
lightdm usually does launch login shells
Yes, but no. It does in the sense that it will log into a desktop shell, but itwould be stupid to source configurations for specific interactive text shells at this moment.
It's more likely that fedora ships some *profile* in etc or etc/skel that grabs everything it can get hold on or checks your users login shell (if that's zsh) and sources that because reasons - that's not a default nor desired nor sane behavior.
Put the stuff you need globally into global profiles, the stuff you need in X 11 in xprofile and the stuff you need in zsh in zprofile. Don't junk everything into zshenv, that's an awesome way to screw yourself.
Offline