X

User Quick Start

X session fails to start
Check ~/.xsession-errors
Set your window manager
Edit ~/.xsession (or ~/.Xsession - it doesn't matter which; the first one found is used)
Start some apps
Edit ~/.xsession
Set global environment variables for your X session
Edit ~/.xsessionrc

System Quick Start

Set the default session manager
Change the link for /usr/bin/x-session-manager->/etc/alternatives/x-session-manager->
Set the default window manager
Change the link for /usr/bin/x-window-manager->/etc/alternatives/x-window-manager->
Set the default display manager
Edit /etc/X11/default-display-manager
Set the default pseudo terminal
Change the link for /usr/bin/x-terminal-emulator->/etc/alternatives/x-terminal-emulator->
Restrict users, other session options
Edit /etc/X11/Xsession.options
Stop startx from using Xsession by default
Edit /etc/X11/xinit/xinitrc
Set xdm options
Edit /etc/X11/xdm/xdm-config

Note: ~/.Xresources is different from ~/.Xdefaults-<host_alias> and ~/.Xdefaults
The first one is read (sourced) by the "xserver" from /etc/X11/Xsession.d/30x11-common_xresources the later two are read by the application directly at every startup.

Note that ~/.Xdefaults is a relic from X Version 10 (and X11R1) days, before app-defaults files were implemented. It has been deprecated for well over ten years. ~/.Xresources should be used instead.

Definitions

X session
The combination of an X server and connecting X clients
X server
A program run on a local host connected to the user's display and input devices
X client
A program run on a remote host that processes data and talks to the X server
application server
A program run on a remote host that processes data and talks to the clients. XDM would typically run on an application server, to permit users to logon and run applications from that server
application client
A program run on a local host connected to the user's display and input devices

References

  1. Debian Starting X
  2. Shop for a Windows Manager
  3. The X Window User HOWTO
  4. Window Managers for X
  5. Reports on running Linux on notebook or laptop computers
  6. Debian hardware WIKI

Files

/etc/X11/Xsession
The final call
/etc/X11/Xsession.options
configuration options for /etc/X11/Xsession
/etc/X11/Xsession.d
run-parts like executable files run by Xsession
/etc/X11/default-display-manager
X display manager preference
~/.xsessionrc
~/.gnomerc
~/.gnome2/session
 

Discussion

XENVIRONMENT
Any user and machine-specific resources may be specified by setting the XENVIRONMENT environment variable to the name of a resource file to be loaded by all applications. If this variable is not defined, a file named $HOME/.Xdefaults-hostname is looked for instead, where hostname is the name of the host where the application is executing.

Examples

user@host:1:~ $ cat .Xdefaults-<hostname>
XTerm*title: ~/.Xdefaults-<hostname>
xterm*faceName:         10x20
xterm*saveLines:        65535
xterm*scrollBar:        true
xterm*rightScrollBar:   true
xterm*loginShell:       true
xterm*toolBar:          false
xterm*background:       blue
xterm*foreground:       yellow
user@host:1:~ $ cat .Xresources
! ~/.Xresources - sourced when xdm starts
XTerm*Font:             10x20
XTerm*Title:            ~/.Xresources
XLoad*Background:       gold
XLoad*Foreground:       red
XLoad*highlight:        black
XLoad*borderWidth:      0
user@host:1:~ $
user@host:1:~ $ cat .Xsession
/usr/bin/xset -dpms s off
/usr/bin/blackbox
user@host:1:~ $
user@host:0:~ $ cat .Xsessionrc
! ~/.Xsessionrc
! Read (sourced) by the X session scripts during login
! Most useful for setting locale information
user@host:0:~ $
user@host:1:~ $ cat .xinitrc
xterm -bg black -fg white &
/usr/bin/blackbox
#/usr/bin/gnome-session
user@host:1:~ $

Note: Complete answers to the following questions are still blowing in the wind:

Which case (X or x) must the files be?
/etc/X11/Xsession sets USERXSESSIONRC=$HOME/.xsessionrc
/etc/X11/Xsession.d/40x11-common_xsessionrc sources $USERXSESSIONRC

/etc/X11/Xsession sets USRRESOURCES=$HOME/.Xresources
/etc/X11/Xsession.d/30x11-common_xresources does xrdb -merge $USRRESOURCES

/etc/X11/Xsession sets USERXSESSION=$HOME/.xsession
and also sets ALTUSERXSESSION=$HOME/.Xsession
/etc/X11/Xsession/50x11-common_determine-startup looks for both $USERXSESSION AND $ALTUSERXSESSION in that order and operates only on the first one it finds, naming it STARTUPFILE. If the file is executable, it sets STARTUP to $STARTUPFILE, otherwise sets STARTUP to "sh $STARTUPFILE" then /etc/X11/Xsession/99x11-common_start execs $STARTUP.

/etc/X11/Xsession sets ERRFILE=$HOME/.xsession-errors
Which files are sourced and which are executed?
See above
Which files override which files in which scenario?
The presence of which files causes which files to not be read?
What happens differently between <Ctrl>-<Alt>-<Backspace> and /etc/init.d/xdm restart?
Other than the source code, where is the most uptodate information?

How X gets started

An X-session is started with either startx or one of the X display manager daemon programs (*dm) started from the end of the startup scripts in /etc/rc?.d/.

Available display managers are:

Use chkconfig to configure the startup scripts

To use xdm, run

chkconfig gdm off xdm on

To check the status use

chkconfig xdm

Continue with Xsession

X tidbits

user@host:0:~ $ startx -- :1
X: user not authorized to run the X server, aborting.
xinit:  Server error.
user@host:0:~ $

In /etc/X11/Xwrapper.config, change allowed_users=console to allowed_users=anybody to get rid of this message


Send mail to the Webmaster

logo This site best viewed with a browser
Warning: This is a Debian centric site
Many thanks to Debra and Ian Murdock for making Debian possible
First created Apr 22, 2008 ~ Last revised March 03, 2010

Valid XHTML 1.0 Strict Valid CSS!