Global PATH in Debian Wheezy XFCE

As a step in a long term plan to get rid of all MS dependencies of my workspace, I tried to setup TeXLive together with TeXstudio on my Wheezy machine. Got the TeXLive installer, ran the install-tl, which completed, after some choking, with a message, that I should now setup PATH so that it be visible, but without any hint how to do so. Some googling brought the advice to link the binaries to /opt/texbin by typing ln -s /usr/local/texlive/2013/bin/* /opt/texbin as root so that this directory is to be linked instead of /usr/local/texlive/2013/bin. So far, so good. Now, it seems that the installer of TeXstudio is able to detect a TeXLive installation provided it is visible, and installation shall be run as root. It would therefore seem worthwhile to have one central place to append /opt/texbin to the PATH setting of any user running any shell (or clicking on some activator in the GUI). More googling brought information on /etc/profile, ~/.profile, ~/.bashrc and the like, but they are either user or bash–specific, as far as I understand. Then there is /etc/environment, but since this is not a script but a definition file, it seems it is not possible to actually append a path to a preexisting system–set PATH, but to replace it altogether, which, as far as I understand, may lead to a nasty hard–to–understand situation, should the system modify its default PATH. And ultimately, at least according to google, there is the /etc/login.defs file, which is supposed to actually contain the systemwide defaults defined separately for root and non–root users in lines

ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

So that seemed to be what I was looking for. I modified the paths appropriately by appending :/opt/texbin in both definitions, restarted the sandbox system, only to find a strange behaviour. Namely, the first generation of shells appearing in the terminal application started by clicking on the GUI panel activator did not have the paths set up properly, they reverted to the original list without the one I wanted, for both root and non–root users. Only after doing su the paths defined in /etc/login.defs were present. Now, that may be enough to install TeXstudio, after logging in as user, typing su in a terminal and installing the package, but it is not satisfactory: latex is not visible in first generation terminals. So I did more googling, to find nothing. I then ran grep on some system directories to search for the string that makes up the original system path, trying to reverse–engineer who sets it back to original after /etc/login.defs sets it properly. And here came the surprise: grep‘s only answer was /usr/sbin/lightdm, which is a binary executable file of the lightdm window manager. Yes, you may not believe it, but the developers of lightdm hard–coded the PATH in the c–files of the manager. See for yourself here and here. So you change it in /etc/login.defs, and then comes lightdm and runs you over. WTF?!? Anyway, that was key in understanding how to deal with the problem: find the XFCE configuration script that is run after lightdm is started, and that is /etc/xdg/xfce4/xinitrc. That will leave us with a second file in the system to be modified in addition to /etc/login.defs. Adding

export PATH

just after the line with #export GTK_PATH in /etc/xdg/xfce4/xinitrc does the trick.

Happy hacking


6 Responses to Global PATH in Debian Wheezy XFCE

  1. Pingback: .desktop files ignoring local bin

  2. Thanks for this post. Helped me a lot with similar problem. I turns out slim is also resetting the PATH.

  3. nomail says:

    Thanks too. I also edited /etc/xdg/xfce4/xinitrc and it works fine.

  4. Yves Maniette says:

    I had the same problem trying installing TeXlive and could solve thanks to your information. I wish the problem be solved upstream eventually though, although I am not sure about where to ask.

    • ljwo says:

      I don’t really know either, and I don’t really grasp all the complexities of system startup to say whether hard-coded path is close to a right solution, but this seems to me very user-unfriendly. Thank you for reading.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: