I have a machine running Ubuntu 16.04 Desktop (running Unity). I was playing around with different desktop environments for xrdp, so I installed xfce4 (sudo apt install xfce4) and mate-desktop (sudo apt install mate-core mate-desktop-environment mate-notification-daemon).

However, I found that when using these desktop environments, none of the scripts in /etc/profile.d were being run for certain users (specifically mine, which was where I was running the experiments). I removed xrdp, xfce4, and mate to hopefully restore the previous behavior, but to no avail.

Is there anywhere in Ubuntu 16 startup that will show me when/where the /etc/profile.d scripts are run? How would installing a different desktop effect this?

Any help would greatly be appreciated.


Those files should be sourced by the display manager.

LightDM: /usr/sbin/lightdm-session

GDM: /etc/gdm3/Xsession

(I don't know how other DMs work in this respect.)

Please note that the script names must end with .sh.

  • I'm not seeing anything for GDM (not installed), but the config files in /usr/sbin/lightdm-session looks no different from a new install of Ubuntu. – Farzad F. Nov 7 at 21:33
  • @FarzadF.: Assuming it's LightDM you use, it should work then. Can you please edit your question and provide details about a script file which you think should work but still does not. – Gunnar Hjalmarsson Nov 7 at 22:12

Turns out it was completely unrelated to the session manager.

Upon further inspection, I realized that user that had issues with scripts not being sourced had changed their shell from bash to zsh. zsh, for some reason, wasn't sourcing the scripts in /etc/profile.d, which explains why it was working for other users and not this user. I switched them back to bash and that seems to have solved the issue.

I guess this begs the question, why wouldn't zsh run scripts in /etc/profile.d?

  • zsh is an experimental feature in 19.10 as far as I understand. But a question about it would motivated IMO. – Gunnar Hjalmarsson Nov 8 at 1:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.