From ArchWiki
Revision as of 07:20, 29 August 2014 by Lahwaacz (Talk | contribs) (Rootless Xorg (v1.16): include 216)

Jump to: navigation, search

From http://www.x.org/wiki/:

The X.Org project provides an open source implementation of the X Window System. The development work is being done in conjunction with the freedesktop.org community. The X.Org Foundation is the educational non-profit corporation whose Board serves this effort, and whose Members lead this work.

Xorg is the public, open-source implementation of the X window system version 11. Since Xorg is the most popular choice among Linux users, its ubiquity has led to making it an ever-present requisite for GUI applications, resulting in massive adoption from most distributions. See the Xorg Wikipedia article or visit the Xorg website for more details.


install xorg-server from the official repositories.

Additionally, some packages from the xorg-server-utils meta-package are necessary for certain configuration tasks, they are pointed out in the relevant sections. Other useful packages are in the xorg-apps group.

Tip: You will typically seek to install a window manager or a desktop environment to supplement X.

Driver installation

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: Too cryptic for an introduction (Discuss in Talk:Xorg#)

The Linux kernel includes open-source video drivers and support for hardware accelerated framebuffers. However, userland support is required for OpenGL and 2D acceleration in X11.

First, identify your card:

$ lspci | grep -e VGA -e 3D

Then install an appropriate driver. You can search the package database for a complete list of open-source video drivers:

$ pacman -Ss xf86-video

The default graphics driver is xf86-video-vesa, which handles a large number of chipsets but does not include any 2D or 3D acceleration. If a better driver cannot be found or fails to load, Xorg will fall back to vesa.

In order for video acceleration to work, and often to expose all the modes that the GPU can set, a proper video driver is required:

Note: If you have a NVIDIA Optimus enabled laptop which uses an integrated video card combined with a dedicated GPU, see Bumblebee.
Brand Type Driver Multilib Documentation
AMD/ATI Open source xf86-video-ati lib32-ati-dri ATI
Proprietary catalystAUR lib32-catalyst-utilsAUR AMD Catalyst
Intel Open source xf86-video-intel lib32-intel-dri Intel graphics
Nvidia Open source xf86-video-nouveau lib32-nouveau-dri Nouveau
Proprietary nvidia lib32-nvidia-libgl NVIDIA
nvidia-304xx lib32-nvidia-304xx-libgl

Other video drivers can be found in the xorg-drivers group.

Xorg should run smoothly without closed source drivers, which are typically needed only for advanced features such as fast 3D-accelerated rendering for games, dual-screen setups, and TV-out.


Display manager

A convenient way to start X, but one that requires an additional application and dependencies, is by using a display manager.


Install the xorg-xinit package, which provides xinit and its front-end, startx. To determine which client to run, startx will first look for ~/.xinitrc to run as a shell script. In case the user file does not exist, the system default at /etc/X11/xinit/xinitrc will be used. This will start a basic environment with Twm, xclock and Xterm (assuming that the necessary packages are installed). See xinitrc for configuration details.

To launch the X server and clients, run:

$ startx

To quit X, run your window manager's exit function (assuming it has one). If it lacks such functionality, run:

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Since 1.16, the process name is Xorg.bin, but perhaps only for "rootless" X. (Discuss in Talk:Xorg#)
$ pkill -15 X
Note: pkill will kill all running X instances. To specifically kill the window manager on the current VT, use:
WM_PID=$(xprop -id $(xprop -root _NET_SUPPORTING_WM_CHECK \
| awk -F'#' '{ print $2 }') _NET_WM_PID \
| awk -F' = ' '{ print $2 }')

kill -15 $WM_PID

The program xprop is provided by the package xorg-xprop in the official repositories.

See also Start X at Login.

Merge-arrows-2.pngThis article or section is a candidate for merging with xinitrc.Merge-arrows-2.png

Notes: please use the second argument of the template to provide more detailed indications. (Discuss in Talk:Xorg#)
  • By default, due to permissions on console devices, the X display needs to be on the same tty where the login occurred. This is handled by the default /etc/X11/xinit/xserverrc. See General troubleshooting#Session permissions for details.
  • If you wish to have the X display on a separate console from the one where the server is invoked, you can do so by using the X server wrapper provided by /usr/lib/systemd/systemd-multi-seat-x. For convenience, startx can be set up to use this wrapper by modifying your ~/.xserverrc.
  • If you choose to use xinit instead of startx, you are responsible for passing -nolisten tcp and ensuring the session does not break by starting X on a different tty.


Note: Arch supplies default configuration files in /usr/share/X11/xorg.conf.d, and no extra configuration is necessary for most setups.

Xorg uses a configuration file called xorg.conf and files ending in the suffix .conf for its initial setup: the complete list of the folders where these files are searched can be found at [1] or by running man xorg.conf, together with a detailed explanation of all the available options.

Using .conf files

The /etc/X11/xorg.conf.d/ directory stores host-specific configuration. You are free to add configuration files there, but they must have a .conf suffix: the files are read in ASCII order, and by convention their names start with XX- (two digits and a hyphen, so that for example 10 is read before 20). These files are parsed by the X server upon startup and are treated like part of the traditional xorg.conf configuration file. The X server essentially treats the collection of configuration files as one big file with entries from xorg.conf at the end.

Using xorg.conf

Xorg can also be configured via /etc/X11/xorg.conf or /etc/xorg.conf. You can also generate a skeleton for xorg.conf with:

# Xorg :0 -configure

This should create a xorg.conf.new file in /root/ that you can copy over to /etc/X11/xorg.conf.

Alternatively, your proprietary video card drivers may come with a tool to automatically configure Xorg: see the article of your video driver, NVIDIA or AMD Catalyst, for more details.

Note: Configuration file keywords are case insensitive, and "_" characters are ignored. Most strings (including Option names) are also case insensitive, and insensitive to white space and "_" characters.

Sample configurations

  • xorg.conf
Sample 1
Note: Sample configuration file using /etc/X11/xorg.conf.d/10-evdev.conf for the keyboard layouts. Note the commented out InputDevice sections.
  • /etc/X11/xorg.conf.d/10-evdev.conf
Sample 1
Note: This is the 10-evdev.conf file that goes with the xorg.conf sample 1.
  • /etc/X11/xorg.conf.d/10-monitor.conf
  1. VMware
  2. KVM
Note: nvidia-ck binary drivers (v325); Dual GPU, Dual Monitor, Dual Screen; No Twinview, No Xinerama; Rotated and vertically placed screen1 above screen0.

Input devices

Udev will detect your hardware and evdev will act as the hotplugging input driver for almost all devices. Udev is provided by systemd and xf86-input-evdev is required by xorg-server, so there is no need to explicitly install those packages. If evdev does not support your device, install the needed driver from the xorg-drivers group.

You should have 10-evdev.conf in the /etc/X11/xorg.conf.d/ directory, which manages keyboards, mice, touchpads and touchscreens.

See the following pages for specific instructions, or the Fedora wiki entry for more examples.

Mouse acceleration

See the main page: Mouse acceleration

Extra mouse buttons

See the main page: All Mouse Buttons Working

Touchpad Synaptics

See the main page: Touchpad Synaptics

Keyboard settings

See the main page: Keyboard configuration in Xorg

Monitor settings

Getting started

Note: Newer versions of Xorg are auto-configuring, you should not need to use this.

First, create a new config file, such as /etc/X11/xorg.conf.d/10-monitor.conf.

Section "Monitor"
    Identifier             "Monitor0"

Section "Device"
    Identifier             "Device0"
    Driver                 "vesa" #Choose the driver used for this monitor

Section "Screen"
    Identifier             "Screen0"  #Collapse Monitor and Device section to Screen section
    Device                 "Device0"
    Monitor                "Monitor0"
    DefaultDepth           16 #Choose the depth (16||24)
    SubSection             "Display"
        Depth              16
        Modes              "1024x768_75.00" #Choose the resolution

Multiple monitors

See main article Multihead for general information.

See also GPU-specific instructions:

More than one graphics card

You must define the correct driver to use and put the bus ID of your graphic cards.

Section "Device"
    Identifier             "Screen0"
    Driver                 "nouveau"
    BusID                  "PCI:0:12:0"

Section "Device"
    Identifier             "Screen1"
    Driver                 "radeon"
    BusID                  "PCI:1:0:0"

To get your bus ID:

$ lspci | grep VGA
01:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce 9600M GT] (rev a1)

The bus ID here is 1:0:0.

Display size and DPI

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Xorg always sets dpi to 96. See this, this and finally this. (Discuss in Talk:Xorg#)

The DPI of the X server is determined in the following manner:

  1. The -dpi command line option has highest priority.
  2. If this is not used, the DisplaySize setting in the X config file is used to derive the DPI, given the screen resolution.
  3. If no DisplaySize is given, the monitor size values from DDC are used to derive the DPI, given the screen resolution.
  4. If DDC does not specify a size, 75 DPI is used by default.

In order to get correct dots per inch (DPI) set, the display size must be recognized or set. Having the correct DPI is especially necessary where fine detail is required (like font rendering). Previously, manufacturers tried to create a standard for 96 DPI (a 10.3" diagonal monitor would be 800x600, a 13.2" monitor 1024x768). These days, screen DPIs vary and may not be equal horizontally and vertically. For example, a 19" widescreen LCD at 1440x900 may have a DPI of 89x87. To be able to set the DPI, the Xorg server attempts to auto-detect your monitor's physical screen size through the graphic card with DDC. When the Xorg server knows the physical screen size, it will be able to set the correct DPI depending on resolution size.

To see if your display size and DPI are detected/calculated correctly:

$ xdpyinfo | grep -B2 resolution

Check that the dimensions match your display size. If the Xorg server is not able to correctly calculate the screen size, it will default to 75x75 DPI and you will have to calculate it yourself.

If you have specifications on the physical size of the screen, they can be entered in the Xorg configuration file so that the proper DPI is calculated:

Section "Monitor"
    Identifier             "Monitor0"
    DisplaySize             286 179    # In millimeters

If you only want to enter the specification of your monitor without creating a full xorg.conf create a new config file. For example (/etc/X11/xorg.conf.d/90-monitor.conf):

Section "Monitor"
    Identifier             "<default monitor>"
    DisplaySize            286 179    # In millimeters

If you do not have specifications for physical screen width and height (most specifications these days only list by diagonal size), you can use the monitor's native resolution (or aspect ratio) and diagonal length to calculate the horizontal and vertical physical dimensions. Using the Pythagorean theorem on a 13.3" diagonal length screen with a 1280x800 native resolution (or 16:10 aspect ratio):

$ echo 'scale=5;sqrt(1280^2+800^2)' | bc  # 1509.43698

This will give the pixel diagonal length and with this value you can discover the physical horizontal and vertical lengths (and convert them to millimeters):

$ echo 'scale=5;(13.3/1509)*1280*25.4' | bc  # 286.43072
$ echo 'scale=5;(13.3/1509)*800*25.4'  | bc  # 179.01920
Note: This calculation works for monitors with square pixels; however, there is the seldom monitor that may compress aspect ratio (e.g 16:10 aspect resolution to a 16:9 monitor). If this is the case, you should measure your screen size manually.

Setting DPI manually

Note: While you can set any dpi you like and applications using Qt and GTK will scale accordingly, it's recommended to set it to 96, 120 (25% higher), 144 (50% higher), 168 (75% higher), 192 (100% higher) etc., to reduce scaling artifacts to GUI that use bitmaps. Reducing it below 96 dpi may not reduce size of graphical elements of GUI as typically the lowest dpi the icons are made for is 96.

For RandR compliant drivers (for example the open source ATI driver), you can set it by:

$ xrandr --dpi 144
Note: Applications that comply with the setting will not change immediately. You have to start them anew.

See Execute commands after X start to make it permanent.

Proprietary NVIDIA driver

DPI can be set manually if you only plan to use one resolution (DPI calculator):

Section "Monitor"
    Identifier             "Monitor0"
    Option                 "DPI" "96 x 96"

You can manually set the DPI adding the options bellow on /etc/X11/xorg.conf.d/20-nvidia.conf (inside Device section):

Option              "UseEdidDpi" "False"
Option              "DPI" "96 x 96"


DPMS (Display Power Management Signaling) is a technology that allows power saving behaviour of monitors when the computer is not in use. This will allow you to have your monitors automatically go into standby after a predefined period of time. See: DPMS


The Composite extension for X causes an entire sub-tree of the window hierarchy to be rendered to an off-screen buffer. Applications can then take the contents of that buffer and do whatever they like. The off-screen buffer can be automatically merged into the parent window or merged by external programs, called compositing managers. See the following article for more information: compositing window manager

List of composite managers

http://cairo-compmgr.tuxfamily.org/ || cairo-compmgr-gitAUR
  • Compiz — Composite manager for Aiglx and Xgl, with plugins and CCSM
http://www.compiz.org/ || compiz-core-develAUR
  • Compton — X Compositor (a fork of xcompmgr-dana)
https://github.com/chjj/compton || comptonAUR
  • Xcompmgr — Composite Window-effects manager for X.org.
http://cgit.freedesktop.org/xorg/app/xcompmgr/ || xcompmgr

Tips and tricks

X startup tweaking (startx)

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: /usr/bin/startx should not be modified, startx recognises the options as command line arguments (Discuss in Talk:Xorg#)

For X's option reference see:

$ man Xserver

The following options have to be appended to the variable "defaultserverargs" in the /usr/bin/startx file:

  • Enable deferred glyph loading for 16 bit fonts:
-deferglyphs 16
Note: If you start X with kdm, the startx script does not seem to be executed. X options must be appended to the variable ServerArgsLocal in the /usr/share/config/kdm/kdmrc file.

Nested X session

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: mention xephyr (Discuss in Talk:Xorg#)

To run a nested session of another desktop environment:

$ /usr/bin/Xnest :1 -geometry 1024x768+0+0 -ac -name Windowmaker & wmaker -display :1

This will launch a Window Maker session in a 1024 by 768 window within your current X session.

This needs the package xorg-server-xnest to be installed.

Starting GUI programs remotely

See main article: SSH#X11 forwarding.

On-demand disabling and enabling of input sources

With the help of xinput you can temporarily disable or enable input sources. This might be useful, for example, on systems that have more than one mouse, such as the ThinkPads and you would rather use just one to avoid unwanted mouse clicks.

Install the xorg-xinput package from the official repositories.

Find the ID of the device you want to disable:

$ xinput

For example in a Lenovo ThinkPad T500, the output looks like this:

$ xinput
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=11   [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=10   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=9    [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                    id=12   [slave  keyboard (3)]

Disable the device with xinput --disable device_id, where device_id is the device ID you want to disable. In this example we will disable the Synaptics Touchpad, with the ID 10:

$ xinput --disable 10

To re-enable the device, just issue the opposite command:

$ xinput --enable 10



If a problem occurs, view the log stored in either /var/log/ or, for the rootless X default since v1.16, in ~/.local/share/xorg/.

The logfiles are of the form Xorg.n.log with n being the display number. For a single user machine with default configuration the applicable log is frequently Xorg.0.log, but otherwise it may vary. To make sure to pick the right file it may help to look at the timestamp of the X server session start and from which console it was started. For example:

$ grep -e Log -e tty Xorg.0.log
[    40.623] (==) Log file: "/home/archuser/.local/share/xorg/Xorg.0.log", Time: Thu Aug 28 12:36:44 2014
[    40.704] (--) controlling tty is VT number 1, auto-enabling KeepTty
  • In the logfile then be on the lookout for any lines beginning with (EE), which represent errors, and also (WW), which are warnings that could indicate other issues.
  • If there is an empty .xinitrc file in your $HOME, either delete or edit it in order for X to start properly. If you do not do this X will show a blank screen with what appears to be no errors in your Xorg.0.log. Simply deleting it will get it running with a default X environment.
  • If the screen goes black, you may still attempt to switch to a different virtual console (e.g. Ctrl+Alt+F2), and blindly log in as root. You can do this by typing root (press Enter after typing it) and entering the root password (again, press Enter after typing it).
You may also attempt to kill the X server with:
# pkill X
If this does not work, reboot blindly with:
# reboot

Black screen, No protocol specified.., Resource temporarily unavailable for all or some users

X creates configuration and temporary files in current user's home directory. Make sure there is free disk space available on the partition your home directory resides in. Unfortunately, X server does not provide any more obvious information about lack of disk space in this case.

CTRL right key does not work with oss keymap

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: The file will be overwritten on xkeyboard-config update; for such simple task should be used Xmodmap. (Discuss in Talk:Xorg#)

Edit as root /usr/share/X11/xkb/symbols/fr, and change the line:

include "level5(rctrl_switch)"


// include "level5(rctrl_switch)"

Then restart X, reboot or run

setxkbmap fr oss

DRI with Matrox cards stops working

If you use a Matrox card and DRI stops working after upgrading to Xorg, try adding the line:

Option "OldDmaInit" "On"

to the Device section that references the video card in xorg.conf.

Frame-buffer mode problems

If X fails to start with the following log messages,

(WW) Falling back to old probe method for fbdev
(II) Loading sub module "fbdevhw"
(II) LoadModule: "fbdevhw"
(II) Loading /usr/lib/xorg/modules/linux//libfbdevhw.so
(II) Module fbdevhw: vendor="X.Org Foundation"
       compiled for 1.6.1, module version=0.0.2
       ABI class: X.Org Video Driver, version 5.0
(II) FBDEV(1): using default device

Fatal server error:
Cannot run in framebuffer mode. Please specify busIDs for all framebuffer devices

uninstall fbdev:

# pacman -R xf86-video-fbdev

Launching multiple X sessions with proprietary NVIDIA on Xorg 1.16

When attempting to launch X sessions in multiple ttys on Xorg 1.16, you may be rejected with a log indicating that no drivers were found. I found that a workaround for this was to specifically tell X that we'd like to use the 'nvidia' driver.


Section "Device"
    Identifier "Device0"
    Driver     "nvidia"
    VendorName "NVIDIA Corporation"
    Option     "NoLogo" "True"

Program requests "font '(null)'"

  • Error message: "unable to load font `(null)'."

Some programs only work with bitmap fonts. Two major packages with bitmap fonts are available, xorg-fonts-75dpi and xorg-fonts-100dpi. You do not need both; one should be enough. To find out which one would be better in your case, try this:

$ xdpyinfo | grep resolution

and use what is closer to you (75 or 100 instead of XX)

# pacman -S xorg-fonts-XXdpi

Recovery: disabling Xorg before GUI login

If Xorg is set to boot up automatically and for some reason you need to prevent it from starting up before the login/display manager appears (if the system is wrongly configured and Xorg does not recognize your mouse or keyboard input, for instance), you can accomplish this task with two methods.

  • Change default target to rescue.target. See systemd#Change default target to boot into.
  • If you have not only a faulty system that makes Xorg unusable, but you have also set the GRUB menu wait time to zero, or cannot otherwise use GRUB to prevent Xorg from booting, you can use the Arch Linux live CD. Boot up the live CD and log in as root. You need a mount point, such as /mnt, and you need to know the name of the partition you want to mount.

You can use the command,

# fdisk -l

to see your partitions. Usually, the one you want will be resembling /dev/sda1. Then, to mount this to /mnt, use

# mount /dev/sda1 /mnt

Then your filesystem will show up under /mnt. From here you can delete the gdm daemon to prevent Xorg from booting up normally or make any other necessary changes to the configuration.

X clients started with "su" fail

If you are getting "Client is not authorized to connect to server", try adding the line:

session        optional        pam_xauth.so

to /etc/pam.d/su. pam_xauth will then properly set environment variables and handle xauth keys.

X failed to start: Keyboard initialization failed

If your hard disk is full, startx will fail. /var/log/Xorg.0.log will end with:

(EE) Error compiling keymap (server-0)
(EE) XKB: Could not compile keymap
(EE) XKB: Failed to load keymap. Loading default keymap instead.
(EE) Error compiling keymap (server-0)
(EE) XKB: Could not compile keymap
XKB: Failed to compile keymap
Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
Fatal server error:
Failed to activate core devices.
Please consult the The X.Org Foundation support at http://wiki.x.org
for help.
Please also check the log file at "/var/log/Xorg.0.log" for additional information.
(II) AIGLX: Suspending AIGLX clients for VT switch

Make some free space on your root partition and X will start.

Rootless Xorg (v1.16)

As of version 1.16 [2], Xorg may run with standard user privileges with the help of logind. The requirements for this are:

  • systemd; version >=216 for multiple instances
  • Starting X via xinit; display managers are not supported
  • Working KMS; proprietary drivers are not supported

If you do not fit these requirements, re-enable root rights in /etc/X11/Xwrapper.config:

needs_root_rights = yes

See also Systemd/User#Xorg_as_a_systemd_user_service.

Broken redirection

While user Xorg logs are stored in ~/.local/share/X11/Xorg.log, they do not include the output from the X session. To re-enable redirection, start X with the -keeptty flag:

exec startx -- -keeptty > ~/.xorg.log 2>&1

See [3].