OK, the file is surely processed, because the MESA_SHADER_CACHE_DIR is set and 
I do not manipulate it elsewhere. So the timing issue is the problem. I am 
thinking whether it is not created by gdm, if you claim the environment 
generator is run before anything from plasma?

Marek
štvrtok 12. marca 2026, 6:57, Marek Greško <[email protected]> 
napísal/a:

> Hello Michael,
>
> unfortunately, also after reboot there is no progress in this matter. I also 
> tried to define MESA_SHADER_CACHE_DIR before reboot, but also no luck.
>
> Either the file is ignored, or it is not soon enough processed, or mesa 
> ignores the setting in some situations. But I think the last one is not the 
> right one, because I found some drkonqi files also in the .cache directory 
> yesterday. So this points to timing again.
>
> Thanks
>
> Marek
>
> streda 11. marca 2026, 17:30, Michael Shaw <[email protected]> napísal/a:
>
>> Hi Marek,
>>
>> Duncan hit the nail on the head here regarding how modern Plasma and systemd 
>> interact. The issue you're running into is purely a timing problem.
>>
>> Because you're using GDM and a newer systemd-managed session, the 
>> traditional shell scripts in /etc/profile.d or Plasma's env folders are 
>> simply being executed too late in the login process. By the time your script 
>> runs and exports those variables, systemd has already spun up the early 
>> graphical components, and Mesa has already defaulted to creating 
>> mesa_shader_cache in the NFS $HOME/.cache.
>>
>> Since your logic is dynamic (checking if the user is on the domain and if 
>> the local dir is writable), static systemd environment config files won't 
>> work either.
>>
>> The cleanest solution to beat Mesa to the punch is to use a systemd User 
>> Environment Generator. These run the exact millisecond the user 
>> authenticates—before GDM launches Wayland, Plasma, or Mesa.
>>
>> You just need to adapt your current script slightly. Instead of using 
>> export, systemd generators expect you to echo the KEY=value pairs directly 
>> to standard output.
>>
>> Create a file here: 
>> /etc/systemd/user-environment-generators/60-local-xdg-cache.sh
>>
>> And drop this in:
>>
>> Bash
>>
>> #!/bin/bash
>>
>> CACHEDIR=
>>
>> "/home/local/
>>
>> ${USER}
>>
>> "
>>
>> if
>>
>> [[
>>
>> "
>>
>> ${HOME}
>>
>> "
>>
>> =~ ^/home/domain/.* ]];
>>
>> then
>>
>> echo
>>
>> "NSS_SDB_USE_CACHE=yes"
>>
>> if
>>
>> [ -w
>>
>> "
>>
>> ${CACHEDIR}
>>
>> "
>>
>> ];
>>
>> then
>>
>> echo
>>
>> "XDG_CACHE_HOME=
>>
>> ${CACHEDIR}
>>
>> /.cache"
>>
>> fi
>>
>> fi
>>
>> Make sure to make it executable, or systemd will silently ignore it: sudo 
>> chmod +x /etc/systemd/user-environment-generators/60-local-xdg-cache.sh
>>
>> Because the systemd --user instance collects these outputs to build the 
>> master environment block for the session, everything launched afterward 
>> (including Mesa) will natively inherit your local XDG_CACHE_HOME right out 
>> of the gate.
>>
>> Give that a shot and let us know if it catches the cache creation in time!
>>
>> Cheers,
>>
>> Thanks,
>> V/r
>> Mike Shaw
>> 314-650-3097
>> [email protected]
>>
>> On Sat, Feb 28, 2026 at 2:02 PM Marek Greško <[email protected]> 
>> wrote:
>>
>>> Hello,
>>>
>>> it is worth mentioning I use Fedora 43 and gdm login manager. I am thinking 
>>> about mesa_shader_cache created in $HOME/.cache location whether it is 
>>> created by gdm or by early phase of plasma startup?
>>>
>>> Thanks
>>>
>>> Marek
>>>
>>> sobota 28. februára 2026, 11:54, Marek Greško <[email protected]> 
>>> napísal/a:
>>>
>>>> Hello,
>>>>
>>>> I am trying to find out where to set XDG_CACHE_HOME in Fedora 43 for 
>>>> plasma correctly.
>>>>
>>>> I have setup an environment where users have home directories on a nfs 
>>>> share. I wanted to create local directory for XDG_CACHE_HOME. So I created 
>>>> a file /etc/profile.d/nss-cache.sh containing
>>>>
>>>> #!/bin/bash
>>>>
>>>> CACHEDIR="/home/local/${USER}"
>>>>
>>>> if [[ "${HOME}" =~ ^/home/domain/.* ]]; then
>>>> export NSS_SDB_USE_CACHE=yes
>>>> if [ -w "${CACHEDIR}" ]; then
>>>> export XDG_CACHE_HOME="${CACHEDIR}/.cache"
>>>> fi
>>>> fi
>>>>
>>>> But it was not doing anything. Then I found out it works when I run some 
>>>> applications from the terminal, so I realized plasma does not use 
>>>> /etc/profile.d. Thereafter I tried to copy the file into the 
>>>> /etc/xdg/plasma-workspace/env/ directory. It mostly works. But I get the 
>>>> mesa_shader_cache directory created in the $HOME/.cache and also in the 
>>>> $XDG_CACHE_HOME. I think this is because the directory is created prior to 
>>>> runing the script in /etc/xdg/plasma-workspace/env, and then aft4er 
>>>> loading the file the directory is created again.
>>>>
>>>> Do you have any clue where should be the script run from to be started 
>>>> soon enough I do not have the $HOME/.cache/mesa_shader_cache created?
>>>>
>>>> Thanks
>>>>
>>>> Marek

Reply via email to