How/where to set global environment variables?

Need support for GhostBSD. Ask here if your question does not fit elsewhere.
Jes
Posts: 42
Joined: Sun Dec 25, 2016 2:43 pm
Location: Spain
Contact:

Re: How/where to set global environment variables?

Post by Jes »

I prefer to fill ~/.profile or ~/.bashrc to place my env variables and settings (alias for example). In this way I don't need ~/.login_conf.

The only system in which I configure /etc/login.conf for specific settings like no coredumps, memory, etc. is in OpenBSD.

BR,

Jes
WytWun
Posts: 13
Joined: Sat Aug 12, 2017 8:54 am

Re: How/where to set global environment variables?

Post by WytWun »

I know about cap_mkdb and that was the first thing I checked when the /etc/login.conf didn't work for a desktop session.

I have since double checked SSH sessions and both the /etc/login.conf and /etc/profile approaches work as expected for these.

So it seems to me that the graphical desktop login process doesn't support either approach :-(. If it supported /etc/login.conf, the BLOCKSIZE environment variable would be set in a normal user xterm session on a default GhostBSD installation (as that variable is in the default login.conf) but it isn't. That variable is commented out of all the default dot files AFAICS.
NeverSimple
Posts: 40
Joined: Sun Aug 20, 2017 10:08 am

Re: How/where to set global environment variables?

Post by NeverSimple »

ASX wrote:I'm starting to think you have come across that FreeBSD cap_mkdb(1) obscenity:
8-) Mhh, I used this when i tried this a few posts back (but forgot to mention it) and it did work for me. Not sure if the OP ommited this fine 'post processing utility'...
ASX
Posts: 988
Joined: Wed May 06, 2015 12:46 pm

Re: How/where to set global environment variables?

Post by ASX »

[quote="NeverSimple" Not sure if the OP ommited this fine 'post processing utility'...[/quote]

LoL :D :lol: Hope that imply some irony ! Anyway, yes he wrote he used that fine utility.
NeverSimple
Posts: 40
Joined: Sun Aug 20, 2017 10:08 am

Re: How/where to set global environment variables?

Post by NeverSimple »

ASX wrote:LoL :D :lol: Hope that imply some irony ! Anyway, yes he wrote he used that fine utility.
Irony? No, not at all.... ;) :P

I now see that the OP has responded that he used that utility, but his post wasn't there when I posted, although it now looks that way. Weird?

Still kinda,sorta (...) works for me though. If I place the environment variables in /etc/profile, they are available in a fish shell under Xfce, where the variables placed in /etc/login.conf are not.
When I SSH into the box, the situation is the other way around: There I see the varaiables defined in /etc/login.conf, and not the ones I defined in /etc/profile.

Two things:
- There is something different between the OP's situation and mine,
- This gives me a headache... :?
ASX
Posts: 988
Joined: Wed May 06, 2015 12:46 pm

Re: How/where to set global environment variables?

Post by ASX »

NeverSimple wrote:Still kinda,sorta (...) works for me though. If I place the environment variables in /etc/profile, they are available in a fish shell under Xfce, where the variables placed in /etc/login.conf are not.
When I SSH into the box, the situation is the other way around: There I see the varaiables defined in /etc/login.conf, and not the ones I defined in /etc/profile.

Two things:
- There is something different between the OP's situation and mine,
- This gives me a headache... :?
How do you start Xfce ? May be the difference is in using slim or not ...
NeverSimple
Posts: 40
Joined: Sun Aug 20, 2017 10:08 am

Re: How/where to set global environment variables?

Post by NeverSimple »

ASX wrote:How do you start Xfce ? May be the difference is in using slim or not ...
Standard GhostBSD Xfce installation, so I'm using Slim
WytWun
Posts: 13
Joined: Sat Aug 12, 2017 8:54 am

Re: How/where to set global environment variables?

Post by WytWun »

Okay, I've finally had a few hours to dig deeper - my findings:
- the FreeBSD port of Slim does grab some capabilities out of /etc/login.conf, but not the setenv capabity :( See r379608 for more details.
- I haven't been able to identify any support in LightDM (original source or FreeBSD port) for the capability database.

I have however found a workaround: changing the login command in /usr/local/etc/slim.conf to use the commented out bash invocation (with path modified) rather than the FreeBSD sh invocation seems to result in /etc/profile being read during a graphical login. Using bash works because it has a command option to force operation as a login shell; most other shells (ash seems to be an exception) don't have a command option for this.

Now I'm able to use Octopkg to install things...
Post Reply