Environment variables

Hi,

I’m confused about how environment variables are set in OpenSuse (Tumbleweed 2019), I’ve read several very interesing Howtos, but not specific on OpenSuse so I always end up struggling to understand

In fact it started some days ago when I installed jack-rack, and got the message

No LADSPA plugins were found!

Check your LADSPA_PATH environment variable.

so I checked with

printenv |grep LAD

and indeed the path wasn’t set

so with

export LADSPA_PATH=/usr/lib64/ladspa

I could launch jack-rack from the command line and all goes well

Starting it from the start menu however take the path into account

And as the ‘export’ wouldn’t survive a reboot I searched on ho to add it to boot, for specific user or systemwide, but til now I had no success; several online posts suggested to look into /etc/environment but all there is is :


#
# This file is parsed by pam_env module
#
# Syntax: simple "KEY=VAL" pairs on seperate lines
#

And I couldn’t get further in my inquiries

Can anyone give me a simple hint on hot to add/remove an environment valiable in OpenSuse either user or system wide and that survive reboot?

Sorry if that question is basic but it’s sort of troubling me:|

The traditional place to set environment variables, is in your shell startup files. That would be “.profile” or “.bashrc”.

For “csh” users, that would be “.login” or “.cshrc”.

Depends on whether you wish to add to your User specific paths (as nrickert suggests) or to your system.
To add to your system, you are not supposed to modify /etc/profile directly (You can open that in a text editor and read about this warning), you are supposed to create a file /etc/profile.local with your export command in it. The alternative is to create a script file with your export command and place in the directory /etc/profile.d/ where you can find other scripts which you can inspect and use as examples.

TSU

Thanks a lot for that quick response, it works indeed to put my export in .bashrc; the strange thing is that there is not much in there, Where are all the other variables stored like ie

PATH=/home/atuor/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib/mit/sbin

A central place or are they loaded at startup by some other modules ?

If you know a good reading on that would be great :slight_smile:

A good starting point is to read the file /etc/profile

TSU

Basically the environment is specific to each thread and generally it is initially inherited from the parent thread/process.

So changing it in one thread does not change it in all but the change would be inherited by subsequent processes created in that thread. So you can set it as per the above instruction for either local to a user or system wide for all users.