Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am not able to run my ~/.xinitrc (~/.xsession) scripts when logging into my computer. I'm using Xubuntu 12.10 with vanilla lightgm as the login manager. Both these files have the right permission (executable). I have in my ~/.xinitrc, the following:

#!/usr/bin/env bash 

# read ~/.Xmodmap if it exists
if [[ -f "${HOME}/.Xmodmap" ]]; then
    xmodmap "${HOME}/.Xmodmap"

# read ~/.Xresources if it exists
if [[ -f "${HOME}/.Xresources" ]]; then
    xrdb -load "${HOME}/.Xresources"

# use gnome-keyring-daemon to manage keys
/usr/bin/gnome-keyring-daemon --start --components=gpg
/usr/bin/gnome-keyring-daemon --start --components=ssh

Any other command (like date >> "$HOME/did_start") is not also being executed.

Now apparently, even if I delete my ~/.xinitrc and ~/.xsession files, xmodmap seems to be reading ~/.Xmodmap, and ~/.Xresources is also being partly read. I checked in /etc/X11/Xsession to see if there are any commands which makes it read these two files, and found none. What could be happening?

EDIT: Since Gilles asked, I'm using a custom session while login in through lightdm (/usr/share/xsessions/custom.desktop):

[Desktop Entry]

But apparently this still starts XFCE via startxfce4 even though I don't have it in my ~/.xinitrc.

And as Ulrich Dangel pointed out, there is a line in /usr/xdg/xfce4/xinitrc which reads ~/.Xmodmap and ~/.Xresources, and this script is executed by startxfce4. So that "mystery" is now resolved. But again, the colors (for xterm, urxvt etc.) from ~/.xinitrc is still not being loaded.

share|improve this question
How’s going your process of logging in? What sessions are available (if any)? –  tijagi Dec 24 '12 at 5:20
What session type do you choose in lightdm? –  Gilles Dec 24 '12 at 17:40
@Gilles I am using a custom session. I've updated my question with more information on that. –  metwarp Dec 25 '12 at 13:18
add comment

1 Answer

For your first question, it typically depends on your session, i.e. the file in your example is not necessarily sufficient as it doesn't start your WM/DE. Normally ~/.xsession or ~/.xinitrc start the whole environment and are not only used to automatically launch some programs, i.e. they should contain a line like exec x-window-manager but the global xsession may just source the file.

For your other question, Debian (and probably Ubuntu) have /etc/X11/Xsession.d which for example loads ~/.Xresources. These files are also responsible for loading and finding the default window manager.

To debug your issues you should have a look in ~/.xsession-errors or start the xserver from a console and see the error messages directly there, i.e. startx -- /etc/X11/Xsession

share|improve this answer
For the first part, even though I don't have a exec startxfce4 line in my ~/.xinitrc, XFCE starts (it's weird, something else must be happening). For the second part, yes, what you said seems to be the case. The /etc/xdg/xfce4/xinitrc script caused the two files to be read. –  metwarp Dec 25 '12 at 13:17
@metwarp ok updated the comment –  Ulrich Dangel Dec 26 '12 at 1:31
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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