9

I'm running Lubuntu 14.10. It seems that LighDM invokes /etc/X11/Xsession only if directed to so by the user. In fact there is no shadow of it in lightdm-session wrapper.

  • startx command line (wrapper around xinit for reasonable defaults) uses ~/.xinitrc if exists, otherwise uses /etc/X11/xinit/xinitrc.
  • /etc/X11/xinit/xinitrc sources /etc/X11/Xsession, that redirects output to .xsession-errors.
  • /etc/X11/Xsession sources ~/.xsessionrc if exists, then executes ~/.xsession if executable, sources if not.

What happens when using lightdm? If it doesn't source /etc/X11/Xsession, how could it possibly redirect errors to error-file ~/.xsession-errors (I couldn't find any informations on other scripts in /etc/X11/Xsession.d/)?

The man page for Xsession documents ~/.xsessionrc and ~/.xsession. It says that ~/.xsessionrc is only for setting variables and the ~/.xsession is for executing commands, but ~/.xsession gets sourced only if I create a custom *.desktop file in /usr/share/xsessions/ for it. Should I create a custom /etc/X11/Xsession.d/ file (like 40x11-common_xsessionrc works for ~/.xsessionrc), or just use ~/.xsessionrc to add any scripts?

Also, I'd like to know how x-window-manager and x-session-manager work through alternatives. I noticed that they seem to work if no ~/.xinitrc and ~/.xsession exist, and apparently they work only when running startx.

Thanks in advance for any answers.

  • By the way I'd have another question. Ubuntu's man suggests creating a custom *.desktop file in /usr/share/xsessions with line Exec=/etc/X11/Xsession in order to set custom settings in ~/.xsession. That means, running another wrapper after /usr/sbin/lightdm-session, which in this case would be /etc/X11/Xsession; that will result in everything under /etc/X11/Xsession.d/ being applied twice. So wouldn't it be better to create a script in /etc/X11/Xsession.d/ to source ~/.xsession? Any help appreciated. – Giuseppe Di Chiacchio Mar 24 '15 at 18:24
  • In order to use ~/.xsession through /usr/sbin/lightdm-session, it was useful to me creating a new script in /etc/X11/Xsession.d which I named 45x11-common_xsession. Since variables are all well defined into the wrapper, I just added the following lines: if [ -r "$USERXSESSION" ]; then . "$USERXSESSION" fi This way the wrapper will source ~/.xsession file too, after having sourced ~/.xsessionrc. Hope this might be useful. – Giuseppe Di Chiacchio Mar 26 '15 at 19:34
  • If you can answer part of your question, pleas just create an answer yourself, that's perfectly normal. The comments are only temporary ang can get lost. – Volker Siegel May 10 '15 at 8:37
0

This bug

Bug #1001035 “lightdm uses a hardcoded path to .xsession-errors,...” : Bugs : lightdm package : Ubuntu

states that LightDM has the path for $HOME/.xsession-errors hard-coded in its source. And that really should be configurable.

Sadly, “modern” display managers seem to often not care about /etc/X11 much anymore, and re-invent the wheel… badly.
Probably because it is rather hard to find out why things are the way they are. (I tried. I still don’t know why there are so many files/scripts and what all their purposes are.)

E.g. SDDM doesn’t use .xsession-errors at all, and logs to some other strange location, if at all.


Addendum

The second question should really be separate.
Due to me still not knowing all about it, I can’t help with that.
But I think I can say that you probably shouldn’t create another custom session file.
Maybe the LightDM documentation helps you there…

About the third question: The man page for xinit and its associated man pages (from the same software package) explain this. There’s a list of alternatives, some in $HOME, some in /etc, some even in /usr/share/… sub-directories. But I think if there is none, some default is assumed too.
Sorry, this should probably be separate too. I only post what I do know.

| improve this answer | |

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.