Re: gnome 49 doesn't source /etc/profile - what did I miss?

"Richard Henschel" ([email protected] via blfs-support Mailing List) <[email protected]> Sun, 21 Dec 2025 20:07:19 -0600
Newsgroups gmane.linux.lfs.beyond.support
Message-ID <[email protected]>
On 12/14/25 20:35, "Douglas R. Reno" ([email protected] via 
blfs-support Mailing List) wrote:

> On 12/14/25 7:51 PM, "Richard" ([email protected] via 
> blfs-support Mailing List) wrote:
>> I updated gnome to the version 49 as in the development systemd 
>> book.  Seemed
>> like a good idea since glib and webkit needed replacement anyway.  It 
>> works
>> fine, except environment looks like /etc/profile isn't sourced.
>> For example, in a gnome terminal 
>> PATH=/usr/local/sbin:/usr/local/bin:/usr/
>> sbin:/usr/bin
>>
>> Any idea of what I missed?  i.e. any changes to the /etc/ files?
>>
>> Thanks very much in advance.
>>
> This is a known issue that I'm still working on a solution for. The 
> problem is that GNOME switched from a shell script to a C program for 
> starting a GNOME session, and when starting in Wayland mode (the 
> recommended way now since X11 disappears in GNOME 50), there's nothing 
> to tell it to source /etc/profile.
>
> We were kind of depending on a hack on this for about 10 years but the 
> way that we've done it is no longer supported, and I'm trying to work 
> on a better solution for it at the moment since we'll probably need to 
> setup something in /etc/systemd/user-environment-generators and I'm 
> not sure how to do this yet and haven't had time to spend on it. That 
> is supposed to be the new standards compliant way to do that though 
> but that's another thing I will also need to factor in for SysV 
> systems, and it's likely that other desktops may start depending on 
> this behavior as well.
>
> - Doug
>
See 'man systemd.environment-generator'.

It discusses setup for setting XDG_DATA_DIRS.  This variable is fairly 
dynamic because some of the path is in the users $HOME directory.

In /usr/lib/systemd/user-environment-generators directory I created a 
file 50-xdg-data-dirs which looks like:

-----------------------------------------------------------------
#!/bin/sh
# SPDX-License-Identifier: MIT-0

# set the default value
XDG_DATA_DIRS="${XDG_DATA_DIRS:-/usr/local/share/:/usr/share}"

# add a directory if it exists
if [ -d /opt/kf6/share ]; then
     XDG_DATA_DIRS="${XDG_DATA_DIRS}:/opt/kf6/share"
fi

# write our output
echo "XDG_DATA_DIRS=${XDG_DATA_DIRS}"
-----------------------------------------------------------------

This variable, and some others need to be setup before gnome is run or 
it won't see any of the kf6 applications to run.  All the other needed 
variables not seen in gnome otherwise can be set in /etc/environment 
which pam_env will load on login.  This is not very flexible, but will 
work on system V. I don't know an easy way to handle XDG_DATA_DIRS on 
system V.  Bruce had suggested sourcing /etc/profile in .bashrc, and 
that works fine for shell environment like LS_COLORS and functions.  I 
chose to do 'source /etc/profile' at the end of /etc/bashrc so it works 
for everyone. It just won't set up environment for gdm started by 
systemd cleanly.

Hope this helps...

-- 
http://lists.linuxfromscratch.org/sympa/info/blfs-support
Unsubscribe: See the above information page