TransWikia.com

How to properly set environment variables for KDE?

Unix & Linux Asked on December 24, 2021

I’m using Kubuntu v20.04, which I launch using SDDM. The issue I’m facing is setting some environment variables for my Xsession. I use ~/.config/plasma-workspace/env/env.sh to export my environment variables, however, I’m observing that a few variables aren’t getting set such as LD_PRELOAD. I can confirm this because echo $LD_PRELOAD returns nothing.

What should be a proper way of doing this?

These are my dotfiles: https://github.com/utkarshverma/dotfiles

One Answer

After a long time, I finally came back to analysing this issue and embarrassingly found out that the exports were working, but I had two conflicting exports, through .zprofile and .xsessionrc for the same variable.

Also, I've noticed that for some reason, probably security related?, you can't simply inspect the LD_PRELOAD variable. It will always return empty.

Though the answer isn't much, I do feel it would be worthwhile to share how I tracked down the issue.

  • My first clue was .xsession-errors which properly logs all stuff related to X. In that file, I could see that LD_PRELOAD was being set twice on logon.
  • After that, I just searched the exact line of code in all my files using grep -rnw ~/* -e "export LD_PRELOAD". It clearly indicated the respective files which had the lines, .zprofile and .xsessionrc and I was able to fix the issue.

Update: It seems that LD_PRELOAD was being unset by KDE after sourcing ~/.xsessionrc that's why export wasn't reporting anything. I've moved the export statement to ~/.zshrc for now.

Answered by Utkarsh Verma on December 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP