~/.xinitrc not being run

38,624

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:
38,624

Related videos on Youtube

Shaun Noonan
Author by

Shaun Noonan

Email: [email protected]

Updated on September 18, 2022

Comments

  • Shaun Noonan
    Shaun Noonan over 1 year

    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"
    fi
    
    # read ~/.Xresources if it exists
    if [[ -f "${HOME}/.Xresources" ]]; then
        xrdb -load "${HOME}/.Xresources"
    fi
    
    # 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]
    Name=Xsession
    Exec=/etc/X11/Xsession
    

    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.

    • tijagi
      tijagi over 11 years
      How’s going your process of logging in? What sessions are available (if any)?
    • Gilles 'SO- stop being evil'
      Gilles 'SO- stop being evil' over 11 years
      What session type do you choose in lightdm?
    • Shaun Noonan
      Shaun Noonan over 11 years
      @Gilles I am using a custom session. I've updated my question with more information on that.
  • Shaun Noonan
    Shaun Noonan over 11 years
    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.
  • sunnysideup
    sunnysideup over 11 years
    @metwarp ok updated the comment