Difference between revisions of "Xorg"

From ArchWiki
Jump to: navigation, search
(Editing xorg.conf)
m (Reverted edits by TheUnderPwn (talk) to last revision by Lonaowna)
(960 intermediate revisions by more than 100 users not shown)
Line 1: Line 1:
[[Category:X Server (English)]]
+
[[Category:X server]]
[[Category:HOWTOs (English)]]
+
[[cs:Xorg]]
 +
[[da:Xorg]]
 +
[[de:X]]
 +
[[el:Xorg]]
 +
[[es:Xorg]]
 +
[[fr:Xorg]]
 +
[[it:Xorg]]
 +
[[ja:Xorg]]
 +
[[nl:Xorg]]
 +
[[pl:Xorg]]
 +
[[pt:Xorg]]
 +
[[ro:Xorg]]
 +
[[ru:Xorg]]
 +
[[zh-hans:Xorg]]
 +
[[zh-hant:Xorg]]
 +
{{Related articles start}}
 +
{{Related|Autostarting}}
 +
{{Related|Display manager}}
 +
{{Related|Window manager}}
 +
{{Related|Font configuration}}
 +
{{Related|Cursor themes}}
 +
{{Related|Desktop environment}}
 +
{{Related|Wayland}}
 +
{{Related|xinit}}
 +
{{Related|xrandr}}
 +
{{Related articles end}}
 +
From http://www.x.org/wiki/:
 +
:The X.Org project provides an open source implementation of the [[Wikipedia:X Window System|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.
  
{{i18n_links_start}}
+
'''Xorg''' (commonly referred as simply '''X''') is the most popular display server 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 [[Wikipedia:X.Org Server|Xorg]] Wikipedia article or visit the [http://www.x.org/wiki/ Xorg website] for more details.
{{i18n_entry|Dansk|Xorg (Dansk)}}
 
{{i18n_entry|English|Xorg}}
 
{{i18n_entry|Polski|Xorg_(Polski)}}
 
{{i18n_entry|Русский|Xorg (Русский)}}
 
{{i18n_entry|Česky|Xorg (Česky)}}
 
{{i18n_entry|Italiano|Xorg (Italiano)}}
 
{{i18n_entry|简体中文|Xorg (简体中文)}}
 
{{i18n_links_end}}
 
  
== Introduction ==
+
== Installation ==
  
'''Xorg''' is the public, open-source implementation of the X11 X Window System. (See the [http://en.wikipedia.org/wiki/X.Org_Server X.org Wikipedia Article] or [http://wiki.x.org/wiki/ X.org] for details.) Basically, if you want a GUI atop Arch, you will want xorg.
+
Xorg can be [[install]]ed with the {{Pkg|xorg-server}} package.
  
==Installing Xorg==
+
Additionally, some packages from the {{Grp|xorg-apps}} group are necessary for certain configuration tasks, they are pointed out in the relevant sections.
  
Before beginning, make sure you do the following:
+
Finally, an {{Grp|xorg}} group is also available, which includes Xorg server packages, packages from the {{Grp|xorg-apps}} group and fonts.  
#Make sure that [[pacman]] is configured and refreshed.
 
#If you are running another X server you can close it now. <code>ctrl+alt+backspace</code>
 
#Make a note about third-party drivers (e.g., nVidia or ATI drivers).  
 
  
First let us install the complete 'xorg' group:
+
{{Tip|You will typically seek to install a [[window manager]] or a [[desktop environment]] to supplement X.}}
  
# pacman -S xorg
+
=== Driver installation ===
  
The default 'vesa' driver is merely a fallback (not accelerated and doesn't support many resolutions), so you will need a proper video driver too. You can type this command to list all the video drivers available:
+
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.
  
# pacman -Ss xf86-video
+
First, identify your card:
  
Look for the appropriate driver for your card and install it with pacman -S. To check your card, if hwd is installed, run 'hwd -s', or run 'lspci' (look for 'VGA compatible controller').
+
$ lspci | grep -e VGA -e 3D
  
If Xorg installed OK, it's time to make <code>xorg.conf</code>
+
Then install an appropriate driver. You can search the package database for a complete list of open-source video drivers:
  
==Configuring xorg==
+
$ pacman -Ss xf86-video
  
Before you can run xorg, you need to configure it so that it knows about your graphics card, monitor, mouse and keyboard. There are several methods of automating the process:
+
Xorg searches for installed drivers automatically:
  
===hwd===
+
* If it cannot find the specific driver installed for the hardware (listed below), it first searches for ''fbdev'' ({{pkg|xf86-video-fbdev}}).
 +
* If that is not found, it searches for ''vesa'' ({{pkg|xf86-video-vesa}}), the generic driver, which handles a large number of chipsets but does not include any 2D or 3D acceleration.
 +
* If ''vesa'' is not found, Xorg will fall back to [[kernel mode setting]], which includes GLAMOR acceleration (see {{man|4|modesetting}}).
  
Perhaps the easiest way of getting Xorg up and running quickly is to use <tt>hwd</tt>, a tool written by users in the Arch Linux community. It's basically a hardware-detection tool that has multiple uses, one of which is setting up an X server. Fortunately, hwd is much more streamlined than <code>xorgconf</code> and doesn't require any input at all.
+
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:
  
First, install the <tt>hwd</tt> package:
+
{| class="wikitable"  style="text-align:center"
# pacman -S hwd
+
|-
 +
! Brand !! Type !! Driver !! OpenGL !! OpenGL ([[Multilib]]) !! Documentation
 +
|-
 +
| rowspan="3" {{R|'''AMD/<br/>ATI'''}} || rowspan="2" | Open source || {{Pkg|xf86-video-amdgpu}} || rowspan="2" | {{Pkg|mesa}} || rowspan="2" | {{Pkg|lib32-mesa}} || [[AMDGPU]]
 +
|-
 +
| {{Pkg|xf86-video-ati}} || [[ATI]]
 +
|-
 +
| Proprietary || {{AUR|catalyst}} || {{AUR|catalyst-libgl}} || {{AUR|lib32-catalyst-libgl}} || [[AMD Catalyst]]
 +
|-
 +
| {{C|'''Intel'''}} || Open source || {{Pkg|xf86-video-intel}} || {{Pkg|mesa}} || {{Pkg|lib32-mesa}} || [[Intel graphics]]
 +
|-
 +
| rowspan="4" {{G|'''Nvidia'''}} || Open source || {{Pkg|xf86-video-nouveau}} || {{Pkg|mesa}} || {{Pkg|lib32-mesa}} || [[Nouveau]]
 +
|-
 +
| rowspan="3" | Proprietary || {{Pkg|nvidia}} || {{Pkg|nvidia-utils}} || {{Pkg|lib32-nvidia-utils}} || rowspan="3" | [[NVIDIA]]
 +
|-
 +
| {{Pkg|nvidia-390xx}} || {{Pkg|nvidia-390xx-utils}} || {{Pkg|lib32-nvidia-390xx-utils}}
 +
|-
 +
| {{Pkg|nvidia-340xx}} || {{Pkg|nvidia-340xx-utils}} || {{Pkg|lib32-nvidia-340xx-utils}}
 +
|}
  
Now simply run the following command as root to generate a default <code>xorg.conf</code> file:
+
{{Note|
# hwd -xa
+
* For NVIDIA Optimus enabled laptop which uses an integrated video card combined with a dedicated GPU, see [[NVIDIA Optimus]] or [[Bumblebee]].
 +
* For Intel graphics on 4th generation and above, see [[Intel graphics#Installation]] for available drivers.
 +
}}
  
This will overwrite any existing /etc/X11/xorg.conf file with a pratical set of defaults, based on what <tt>hwd</tt> detected for your hardware.
+
Other video drivers can be found in the {{Grp|xorg-drivers}} group.
  
Alternatively, you can generate a sample Xorg config (/etc/X11/xorg.conf.hwd) without overwriting your existing settings.  To do so, run <tt>hwd</tt> with the '''-x''' flag instead:
+
Xorg should run smoothly without closed source drivers, which are typically needed only for advanced features such as fast 3D-accelerated rendering for games. The exceptions to this rule are recent GPUs (especially Nvidia GPUs), that are not supported by the open source drivers.
# hwd -x
 
  
Sample result:
+
=== AMD ===
/etc/X11/xorg.conf.ati
 
/etc/X11/xorg.conf.vesa
 
 
Your sample file(s) ready, rename 'xorg.conf'.
 
If unsure first try 'vesa' (default).
 
  
To use the sample config(s), you must manually rename it. Sample:
+
{| class="wikitable"  style="text-align:center"
# mv /etc/X11/xorg.conf.vesa /etc/X11/xorg.conf
+
|-
 +
! GPU architecture !! Radeon cards !! Open-source driver !! Proprietary driver
 +
|-
 +
| GCN 4<br/>and newer || rowspan=4 | [[wikipedia:List of AMD graphics processing units|various]] || [[AMDGPU]] || [[AMDGPU PRO]]
 +
|-
 +
| GCN 3 || [[AMDGPU]] || [[Catalyst]] /<br/>[[AMDGPU PRO]]
 +
|-
 +
| GCN 2 || [[AMDGPU]]* / [[ATI]] || [[Catalyst]]
 +
|-
 +
| GCN 1 || [[AMDGPU]]* / [[ATI]] || [[Catalyst]]
 +
|-
 +
| TeraScale 2&3 || HD 5000 - HD 6000 || rowspan=3 | [[ATI]] || [[Catalyst]]
 +
|-
 +
| TeraScale 1 || HD 2000 - HD 4000 || [[Catalyst]] legacy
 +
|-
 +
| Older || X1000 and older || ''not available''
 +
|-
 +
|}
 +
: *: Experimental
  
AD: In my experience hwd creates XF86Config-4 file and if there is not xorg.conf present Xorg uses it automatically.
+
== Running ==
  
===xorgconfig===
+
=== Display manager ===
  
To start up <tt>xorgconfig</tt>:
+
A convenient way to start X, but one that requires an additional application and dependencies, is by using a [[display manager]].
  
# xorgconfig
+
=== Manually ===
 +
To start the X server without a display manager, see [[xinit]].
  
This will generate a new <tt>xorg.conf</tt>.
+
== Configuration ==
  
Answer the questions, and the program will make the file for you.
+
{{Note|Arch supplies default configuration files in {{ic|/usr/share/X11/xorg.conf.d}}, and no extra configuration is necessary for most setups.}}
This program is not really good but it's a start, and you can fill in special stuff manually afterwards.
 
  
===Xorg -configure===
+
Xorg uses a configuration file called {{ic|xorg.conf}} and files ending in the suffix {{ic|.conf}} for its initial setup: the complete list of the folders where these files are searched can be found in {{man|5|xorg.conf}}, together with a detailed explanation of all the available options.
You can also use
 
# Xorg -configure
 
or
 
# X -configure
 
  
===nvidia-xconfig===
+
=== Using .conf files ===
nVidia users can also use
 
# nvidia-xconfig
 
when they have official nvidia drivers [[NVIDIA|installed]].
 
  
Comment the line
+
The {{ic|/etc/X11/xorg.conf.d/}} directory stores host-specific configuration. You are free to add configuration files there, but they must have a {{ic|.conf}} suffix: the files are read in ASCII order, and by convention their names start with {{ic|''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 {{ic|xorg.conf}} configuration file. Note that on conflicting configuration, the file read ''last'' will be processed. For that reason the most generic configuration files should be ordered first by name. The configuration entries in the {{ic|xorg.conf}} file are processed at the end.
  
  Load          "type1"
+
For option examples to set, see also the [http://fedoraproject.org/wiki/Input_device_configuration#xorg.conf.d fedora wiki].
  
in the Module section since recent versions of xorg-server does not include the type1 font module (completely replaced by freetype).
+
=== Using xorg.conf ===
  
==Editing xorg.conf==
+
Xorg can also be configured via {{ic|/etc/X11/xorg.conf}} or {{ic|/etc/xorg.conf}}. You can also generate a skeleton for {{ic|xorg.conf}} with:
  
You may wish to edit the config after it's been generated. To open in your favourite text-editor, such as Vim (you need root privileges):
+
# Xorg :0 -configure
  
# vim /etc/X11/xorg.conf
+
This should create a {{ic|xorg.conf.new}} file in {{ic|/root/}} that you can copy over to {{ic|/etc/X11/xorg.conf}}.
  
or use xorgcfg:
+
{{Tip|If you are already running an X server, use a different display, for example {{ic|Xorg :2 -configure}}.}}
  
# xorgcfg -textmode
+
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.
  
If you want to set up mouse wheel support, see [[Get All Mouse Buttons Working]].
+
{{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.}}
  
===Monitor Settings===
+
== Input devices ==
  
Depending on your hardware, Xorg may fail to detect your monitor capabilities correctly, or you may simply wish to use a lower resolution than your monitor is capable of. You might want to look up the following values in your monitor's manual before setting them.
+
For input devices the X server defaults to the libinput driver ({{Pkg|xf86-input-libinput}}), but {{Pkg|xf86-input-evdev}} and related drivers are available as alternative.[https://www.archlinux.org/news/xorg-server-1191-is-now-in-extra/]
The following settings are specified in the Monitor section:
 
  
====Horizontal Sync====
+
[[Udev]], which is provided as a systemd dependency, will detect hardware and both drivers will act as hotplugging input driver for almost all devices, as defined in the default configuration files {{ic|10-quirks.conf}} and {{ic|40-libinput.conf}} in the {{ic|/usr/share/X11/xorg.conf.d/}} directory.
  
  HorizSync 28-64
+
After starting X server, the log file will show which driver hotplugged for the individual devices (note the most recent log file name may vary):
 +
  $ grep -e "Using input driver " Xorg.0.log
  
====Refresh Rate====
+
If both do not support a particular device, install the needed driver from the {{Grp|xorg-drivers}} group. The same applies, if you want to use another driver.
  
VertRefresh 60
+
To influence hotplugging, see [[#Configuration]].
  
The following are specified in the Screen section:
+
For specific instructions, see also the [[libinput]] article, the following pages below, or the [https://fedoraproject.org/wiki/Input_device_configuration Fedora wiki] entry for more examples.
  
====Colour Depth====
+
=== Mouse acceleration ===
  
Depth 24
+
See [[Mouse acceleration]].
  
====Resolution====
+
=== Extra mouse buttons ===
  
Modes "1280x1024" "1024x768" "800x600"
+
See [[Mouse buttons]].
  
=== Keyboard Settings ===
+
=== Touchpad ===
  
Xorg may fail to detect your keyboard correctly. This might give problems with your keyboard layout or keyboard model not being set correctly.
+
See  [[libinput]] or [[Synaptics]].
  
To see a full list of keyboard models, layouts, variants and options, open.
+
=== Touchscreen ===
  
 +
See [[Touchscreen]].
  
/usr/share/X11/xkb/rules/xorg.lst
+
=== Keyboard settings ===
  
==== Keyboard Layout ====
+
See [[Keyboard configuration in Xorg]].
  
To change the keyboard layout, use the XkbLayout option in the keyboard InputDevice section. For example, if you have a keyboard with English layout:
+
== Monitor settings ==
  
Option "XkbLayout" "gb"
+
=== Getting started ===
  
To be able to easily switch keyboard layouts, for example between a US and a Swedish layout use this instead:
+
{{Note|Newer versions of Xorg are auto-configuring, you should not need to use this.}}
  
Option "XkbLayout" "us, se"
+
First, create a new config file, such as {{ic|/etc/X11/xorg.conf.d/10-monitor.conf}}.
Option "XkbOptions" "grp:caps_toggle"
 
  
This makes your Caps Lock key switch between the different layouts. This is mainly useful if you run don't run a Desktop Environment which takes care of keyboard layouts for you.
+
{{hc|/etc/X11/xorg.conf.d/10-monitor.conf|<nowiki>
 +
Section "Monitor"
 +
    Identifier            "Monitor0"
 +
EndSection
  
==== Keyboard Model ====
+
Section "Device"
 +
    Identifier            "Device0"
 +
    Driver                "vesa" #Choose the driver used for this monitor
 +
EndSection
  
To change the keyboard model, use the XkbModel option in the keyboard
+
Section "Screen"
InputDevice section. For example, if you have a Microsoft Wireless Multimedia Keyboard:
+
    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
 +
    EndSubSection
 +
EndSection
 +
</nowiki>}}
  
Option "XkbModel" "microsoftmult"
+
{{Note|By default, Xorg needs to be able to detect a monitor and will not start otherwise. A workaround is to create a configuration file such as the example above and thus avoid auto-configuring. A common case where this is necessary is a headless system, which boots without a monitor and starts Xorg automatically, either from a [[Automatic login to virtual console|virtual console]] at [[Start X at login|login]], or from a [[display manager]].}}
  
===Display Size/DPI===
+
=== Multiple monitors ===
  
In order to get correct sizing for fonts the display size must be set for your desired DPI. In the section <code>"Monitor"</code> put in your display size in mm:
+
See main article [[Multihead]] for general information.
  
Section "Monitor"
+
See also GPU-specific instructions:
    ...
+
* [[NVIDIA#Multiple monitors]]
  DisplaySize 336 252 # 96 DPI @ 1280x960
+
* [[Nouveau#Dual head]]
    ...
+
* [[AMD Catalyst#Double Screen (Dual Head / Dual Screen / Xinerama)]]
EndSection
+
* [[ATI#Multihead setup]]
  
 +
==== More than one graphics card ====
  
The formula for calculating the DisplaySize values is Width x 25.4 / DPI and Height x 25.4 / DPI. If you're running Xorg with a resolution of 1024x768 and want a DPI of 96, use 1024 x 25.4 / 96 and 768 x 25.4 / 96. Round numbers down.
+
You must define the correct driver to use and put the bus ID of your graphic cards.
  
# calc: (x|y)pixels * 25.4 / dpi
+
{{bc|
# DisplaySize 168 126 # 96 DPI @ 640x480
+
Section "Device"
# DisplaySize 210 157 # 96 DPI @ 800x600
+
    Identifier            "Screen0"
# DisplaySize 269 201 # 96 DPI @ 1024x768
+
    Driver                "nouveau"
# DisplaySize 302 227 # 96 DPI @ 1152x864
+
    BusID                  "PCI:0:12:0"
# DisplaySize 336 252 # 96 DPI @ 1280x960
+
EndSection
# DisplaySize 336 269 # 96 DPI @ 1280x1024 (non 4:3 aspect)
 
# DisplaySize 370 277 # 96 DPI @ 1400x1050
 
# DisplaySize 420 315 # 96 DPI @ 1600x1200
 
# DisplaySize 506 315 # 96 DPI @ 1920x1200
 
  
 +
Section "Device"
 +
    Identifier            "Screen1"
 +
    Driver                "radeon"
 +
    BusID                  "PCI:1:0:0"
 +
EndSection
 +
}}
  
For nVidia drivers you may have to disable automatic detection of DPI to set it manually. There is also an easier way to set DPI on these cards. Either or both of the following lines can be set in the device section for your nVidia card.
+
To get your bus ID:
  
  Option  "UseEdidDpi" "false"
+
{{hc|<nowiki>$ lspci | grep VGA</nowiki>|<nowiki>
  Option  "DPI" "96 x 96"
+
01:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce 9600M GT] (rev a1)
 +
</nowiki>}}
  
 +
The bus ID here is 1:0:0.
  
Results can be checked by issuing the following command, which should return 96x96 dots per inch if you set DPI @ 96.
+
=== Display size and DPI ===
  
$ xdpyinfo | grep -B1 dot
+
{{Accuracy|1=Xorg always sets dpi to 96. See [https://bugs.freedesktop.org/show_bug.cgi?id=23705 this], [https://bugs.freedesktop.org/show_bug.cgi?id=41115 this] and finally [http://pastebin.com/vtzyBK6e this].}}
  
===Proprietary Drivers===
+
The DPI of the X server is determined in the following manner:
 +
# The -dpi command line option has highest priority.
 +
# If this is not used, the DisplaySize setting in the X config file is used to derive the DPI, given the screen resolution.
 +
# If no DisplaySize is given, the monitor size values from [[wikipedia:Display_Data_Channel|DDC]] are used to derive the DPI, given the screen resolution.
 +
# If DDC does not specify a size, 75 DPI is used by default.
  
If you wish to use third-party graphics drivers, do check first that the X server runs OK first. Xorg should run smoothly without official drivers, which are typically needed only for advanced features such as 3D-accelerated rendering for games, dual-screen setups, and TV-out. Refer to the [[NVIDIA]] and [[ATI]] wikis for help with driver installation.
+
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. <s>When the Xorg server knows the physical screen size, it will be able to set the correct DPI depending on resolution size.</s>
  
===Fonts===
+
To see if your display size and DPI are detected/calculated correctly:
  
There some tips for setting up fonts in [[Xorg Font Configuration]].
+
$ xdpyinfo | grep -B2 resolution
  
=== Sample Xorg.conf Files ===
+
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.
Anyone who has an Xorg.conf file written up that works, go ahead and post a link to it here for others to look at!  Please don't inline the entire conf file; upload it somewhere else and link. Thanks!
 
* Shadowhand (nv and nvidia drivers): http://people.os-zen.net/shadowhand/configs/xorg.conf
 
* Cerebral (fglrx and radeon drivers): http://www.student.cs.uwaterloo.ca/~tjwillar/configs/xorg.conf
 
* raskolnikov (via unichrome and synaptics drivers): http://athanatos.free.fr/Arch/xorg.conf
 
* Leigh (Three independent screens - Three nvidia cards): http://files.myopera.com/allisonleigh/linuxbackup/xorg.conf
 
  
==Running Xorg==
+
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 (adjust identifier to your xrandr output) :
  
This is done simply by typing:
+
{{bc|
 +
Section "Monitor"
 +
    Identifier            "DVI-D-0"
 +
    DisplaySize            286 179    # In millimeters
 +
EndSection
 +
}}
  
  $ startx
+
If you only want to enter the specification of your monitor '''without''' creating a full xorg.conf create a new config file. For example ({{ic|/etc/X11/xorg.conf.d/90-monitor.conf}}):
  
The default X environment is rather bare, and you will typically seek to install window managers or desktop environments to supplement X.
+
{{bc|
 +
Section "Monitor"
 +
    Identifier            "<default monitor>"
 +
    DisplaySize            286 179    # In millimeters
 +
EndSection
 +
}}
  
To test the config file you have created:
+
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):
  
  $ X -config ''<your config file>''
+
  $ echo 'scale=5;sqrt(1280^2+800^2)' | bc  # 1509.43698
  
If a problem occurs, then view the log at <tt>/var/log/Xorg.0.log</tt>. Be on the lookout for any lines beginning with ''(EE)'' which represent errors, and also ''(WW)'' which are warnings that could indicate other issues.
+
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):
  
'''*Please Note*'''
+
$ echo 'scale=5;(13.3/1509)*1280*25.4' | bc  # 286.43072
Using startx requires a ''~/.xinitrc'' file, so that X knows what to run when it startsYour best option is to copy ''/etc/skel/.xinitrc'' to your home directory and edit it. Comment out the 'exec' lines you don't want, and add or uncomment one for the WM you want to use. If you are using GNOME it is best to start GNOME through gdm to avoid HAL permission problems.
+
  $ echo 'scale=5;(13.3/1509)*800*25.4| bc  # 179.01920
  
In addition, you can also install twm and xterm (via pacman), which will be used as a fallback if ~/.xinitrc does not exist (as stated in /etc/X11/xinit/xinitrc).
+
{{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.}}
  
==X startup (/usr/bin/startx) tweaking==
+
==== Setting DPI manually ====
For X's option reference see
 
  
$ man Xserver
+
{{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.}}
  
The following options have to be appended to the variable "defaultserverargs" in the /usr/bin/startx file.
+
For RandR compliant drivers (for example the open source ATI driver), you can set it by:
  
prevent X from listening on tcp:
+
  $ xrandr --dpi 144
  -nolisten tcp
 
getting rid of the gray weave pattern while X is starting and let X set a black root window:<br>
 
-br
 
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 "ServerCmd" in the /opt/kde/share/config/kdm/kdmrc file. By default kdm options are
+
{{Note|Applications that comply with the setting will not change immediately. You have to start them anew.}}
 
 
  ServerCmd=/usr/bin/X -br -nolisten tcp
 
  
== Changes with modular Xorg ==
+
See [[Execute commands after X start]] to make it permanent.
  
=== Most Common Packages ===
+
===== Proprietary NVIDIA driver =====
  
Make sure you install drivers for mouse, keyboard and videocard. For mouse and keyboard, '''xf86-input-keyboard''' and '''xf86-input-mouse''' should get installed. Other '''xf86-input-*''' packages are available for different input devices.
+
DPI can be set manually if you only plan to use one resolution ([http://pxcalc.com/ DPI calculator]):
  
For the videocard, find out which driver is required and install the right '''xf86-video-*''' package. ATI and Nvidia users may wish to install the non-free drivers for their hardware instead ([[NVIDIA]], [[ATI]]).
+
{{bc|
 +
Section "Monitor"
 +
    Identifier            "Monitor0"
 +
    Option                "DPI" "96 x 96"
 +
EndSection
 +
}}
  
To install all drivers in one run, the '''xorg-input-drivers''' and '''xorg-video-drivers''' are available.
+
You can manually set the DPI adding the options below on {{ic|/etc/X11/xorg.conf.d/20-nvidia.conf}} (inside '''Device''' section):
  
=== OpenGL 3D Acceleration ===
+
Option              "UseEdidDpi" "False"
 +
Option              "DPI" "96 x 96"
  
X.Org 7.0 on Arch Linux uses a modular design for mesa, the OpenGL rendering system. Several implementations are available:
+
===== Manual DPI Setting Caveat =====
* libgl-dri: Open-source DRI OpenGL implementation. Falls back to software rendering when no DRI driver is installed
+
GTK very often overrides the server's DPI via the optional Xresource {{ic|Xft.dpi}}. To find out whether this is happening to you, check with:
* some other driver providing libGL (ati, nvidia)
 
  
When pacman installs an application that needs mesa, it will install one of these packages. To be sure about the right library for your setup, install the library you want prior to installing Xorg. Installing the right package afterwards is also possible, though this gives some dependency errors sometimes, which can be ignored with the -d switch.
+
$ xrdb -query | grep dpi
  
=== Glxgears and Glxinfo ===
+
With GTK library versions since 3.16, when this variable is not otherwise explicitly set, GTK sets it to 96. To have GTK apps obey the server DPI you may need to explictly set Xft.dpi to the same value as the server. The Xft.dpi resource is the method by which some desktop environments optionally force DPI to a particular value in personal settings. Among these are KDE and TDE.
  
These apps are included in the mesa package.
+
=== Display Power Management ===
  
=== Changed paths (and configuration) ===
+
[[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 this entry for additional upgrade info:''' http://www.archlinux.org/blog/2006/01/02/how-to-upgrade-xorg/
+
== Composite ==
  
Modular X.Org 7 installs everything in <code>/usr</code>, where the older versions installed in <code>/usr/X11R6</code>. Several configuration files need updates:
+
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: [[Wikipedia:Compositing window manager|compositing window manager]]
* ''/etc/X11/xorg.conf''
 
** Fontpaths live in /usr/share/fonts now
 
** RGB database is in /usr/share/X11/rgb
 
** module path is /usr/lib/xorg/modules
 
  
Also note that some X configuration tools might stop working. The easiest way to configure X.org is by installing the correct driver packages and running ''Xorg -configure'', which results in a <code>/root/xorg.conf.new</code> which only needs modification in the resolutions, mouse configuration and keyboard layouts.
+
Some window managers (e.g. [[Compiz]], [[Enlightenment]], KWin, Marco, Metacity, Muffin, Mutter, [[Xfwm]]) do compositing on their own. For other window managers, a standalone composite manager can be used.
  
Some packages have hard-coded references to <code>/usr/X11R6</code>. These packages need fixing. In the meantime, look what packages install files in <code>/usr/X11R6</code>, uninstall those, make a symlink from <code>/usr</code> to <code>/usr/X11R6</code> and reinstall the affected packages. Another option is to move the contents of <code>/usr/X11R6</code> to <code>/usr</code> and make the symlink.
+
=== List of composite managers ===
  
Or you can just add a second module path via <code/>ModulePath  "/usr/X11R6/lib/modules"</code>
+
* {{App|[[Compton]]|Compositor (a fork of xcompmgr-dana)|https://github.com/chjj/compton|{{Pkg|compton}}}}
This works e.g. for Nvidia 76.76
+
* {{App|[[Xcompmgr]]|Composite window-effects manager|http://cgit.freedesktop.org/xorg/app/xcompmgr/|{{Pkg|xcompmgr}}}}
 +
* {{App|Unagi|Modular compositing manager which aims written in C and based on XCB|http://projects.mini-dweeb.org/projects/unagi|{{AUR|unagi}}}}
  
== Troubleshooting ==
+
== Tips and tricks ==
 +
 
 +
=== Nested X session ===
 +
 
 +
{{Expansion|mention [[Awesome#Using_Xephyr|xephyr]]}}
 +
 
 +
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 {{Pkg|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 {{Pkg|xorg-xinput}} package.
 +
 
 +
Find the name or ID of the device you want to disable:
  
=== Xorg "can't see" the resolutions your monitor supports ===
+
$ xinput
I found myself in a situation where if i used one of my monitors(a gnr ts902) Xorg would only present me with the options 640x480 and 320x480 which ofcourse was less than i desired. After a lot of research i found through read-edid(in aur) that part of my EDID was corrupt and so i could only read my HorizSync with read-edid. This fortunately was enough and after adding the right Horisync line to the xorg.conf's Monitor section(didn't have to add VertRefresh...) I restarted X to see the right resolution :)
 
  
note: I'm not sure:
+
For example in a Lenovo ThinkPad T500, the output looks like this:
  
  Option "ModeValidation" "NoEdidModes"
+
{{hc|$ xinput|<nowiki>
  Option   "UseEdid" "false"
+
⎡ 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)]
 +
</nowiki>}}
  
in Device section in xorg config are needed aswell, to lazy now to test without them :)
+
Disable the device with {{ic|xinput --disable ''device''}}, where ''device'' is the device ID or name of the device you want to disable. In this example we will disable the Synaptics Touchpad, with the ID 10:
  
=== Keyboard Problems ===
+
$ xinput --disable 10
  
Auto-generated xorg.conf files may cause you problems. If you cannot get to tty1 by holding CTRL-ALT and pressing F1 or cannot get the £ sign for gb people, check to see if the following entries are in your /etc/X11/xorg.conf:
+
To re-enable the device, just issue the opposite command:
  
  Option "XkbLayout"  "uk"        #"uk" is not a real layout, look in /usr/share/X11/xkb/symbols/ for a list of real ones.
+
  $ xinput --enable 10
Option "XkbRules"  "xfree86"    #this should be "xorg"
 
Option "XkbVariant" "nodeadkeys" #This line is also known to cause the problems described, try commenting it out.
 
  
To switch between layouts with Alt+Shift:
+
Alternatively using the device name, the command to disable the touchpad would be:
Option "XkbOptions" "grp:alt_shift_toggle,grp_led:scroll"
 
  
===A Quick Fix for the Bitstream-Vera Conflict===
+
$ xinput --disable "SynPS/2 Synaptics TouchPad"
If you see a message that ttf-bitstream-vera conflicts with xorg:
 
#Exit the pacman session by answering no.
 
#Run <code>pacman -Rd xorg</code>
 
#Run <code>pacman -Syu</code>
 
#Run <code>pacman -S xorg</code>
 
#Update your paths in /etc/X11/xorg.conf
 
  
===A Quick Fix for file conflicts in /usr/include===
+
=== Killing application with hotkey ===
If you see messages about file conflicts in /usr/include/X11 and /usr/include/GL:
+
Run script on hotkey:
#Run <code>rm /usr/include/{GL,X11}</code>
 
#Run <code>pacman -Su</code>
 
The symlinked directories removed by this operation are replaced by real directories in the new xorg package, causing these file conflicts to appear.
 
  
=== libgl-dri conflicts ===
+
#!/bin/bash
 +
windowFocus=$(xdotool getwindowfocus);
 +
pid=$(xprop -id $windowFocus | grep PID);
 +
kill -9 $pid
  
If you get a message similar to:
+
Deps: {{Pkg|xorg-xprop}}, {{Pkg|xdotool}}
:: libgl-dri conflicts with nvidia-legacy. Remove nvidia-legacy? [Y/n]
 
this is due to the multiple OpenGL implementations explained in the OpenGL section above - pacman is attempting to install libgl-dri to satisfy this dependency, but also trying to upgrade your existing video driver, and they conflict.  To solve, try:
 
  
* Updating your video driver before a full system update:
+
=== Block TTY access ===
# pacman -S nvidia-legacy
 
# pacman -Syu
 
  
Or, if that doesn't work,
+
To block tty access when in an X add the following to [[#Configuration|xorg.conf]]:
* Remove your existing video driver, do the update, then reinstall your driver:
+
{{bc|Section "ServerFlags"
# pacman -Rd nvidia-legacy
+
    Option "DontVTSwitch" "True"
# pacman -Syu
+
EndSection}}
# pacman -S nvidia-legacy
 
:: nvidia-legacy conflicts with libgl-dri. Remove libgl-dri? [Y/n] '''Y'''
 
  
=== Mouse wheel not working ===
+
=== Prevent a user from killing X ===
The "Auto" protocol doesn't seem to work properly in Xorg 7 any more.  In the InputDevice section for your mouse, change:
 
Option        "Protocol" "auto"
 
to
 
Option        "Protocol" "IMPS/2"
 
or
 
Option        "Protocol" "ExplorerPS/2"
 
  
=== Extra mouse buttons not working ===
+
To prevent a user from killing when it is running add the following to [[#Configuration|xorg.conf]]:
USB Mice users should read [[Get_All_Mouse_Buttons_Working]].
+
{{bc|Section "ServerFlags"
 +
    Option "DontZap"      "True"
 +
EndSection}}
  
Intellimouse (ExplorerPS/2) users might find their scroll and side buttons aren't behaving as they used to.  Previously xorg.conf needed:
+
== Troubleshooting ==
Option      "Buttons" "7"
 
Option      "ZAxisMapping" "6 7"
 
and users also had to run xmodmap to get the side buttons working with a command like:
 
xmodmap -e "pointer = 1 2 3 6 7 4 5"
 
Now xmodmap is no longer required. Instead, make xorg.conf look like this:
 
Option      "Buttons" "5"
 
Option      "ZAxisMapping" "4 5"
 
Option      "ButtonMapping" "1 2 3 6 7"
 
and the side buttons on a 7-button Intellimouse will work like they used to, without needing to run xmodmap.
 
  
===Keyboard problems===
+
=== General ===
Some keyboard layouts have changed. I wondered why:
 
* I wasn't able to Ctrl+Alt+Fx to switch to console
 
* I wasn't able to use layouts
 
The problem was that the ''sk_qwerty'' layout doesn't exist anymore. I had to replace
 
Option        "XkbLayout" "us,sk_qwerty"
 
with
 
Option        "XkbLayout" "us,sk"
 
Option        "XkbVariant" ",qwerty"
 
  
Another thing to look for if your keyboard isn't properly functioning is the XkbRules option:<br>
+
If a problem occurs, view the log stored in either {{ic|/var/log/}} or, for the rootless X default since v1.16, in {{ic|~/.local/share/xorg/}}. [[GDM]] users should check the [[systemd]] journal. [https://bbs.archlinux.org/viewtopic.php?id=184639]
You'll need to change
 
Option        "XkbRules" "xfree86"
 
to
 
Option        "XkbRules" "xorg"
 
  
==== AltGR (Compose Key) not working properly ====
+
The logfiles are of the form {{ic|Xorg.n.log}} with {{ic|n}} being the display number. For a single user machine with default configuration the applicable log is frequently {{ic|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:  
 
If, after the update, you can't use the AltGr key as expected any more, try adding this to your keyboard section:
 
Option      "XkbOptions" "compose:ralt"
 
  
This is not the correct way to activate the AltGr Key on a German keyboard (for example, to use the '|' and '@' keys on German keyboards).
+
{{hc|1=$ grep -e Log -e tty Xorg.0.log|2=[    40.623] (==) Log file: "/home/archuser/.local/share/xorg/Xorg.0.log", Time: Thu Aug 28 12:36:44 2014
Just choose a valid keyboard variant for it to work again, for example (the example is for a German keyboard):
+
[    40.704] (--) controlling tty is VT number 1, auto-enabling KeepTty}}
Option      "XkbLayout" "de"
 
Option      "XkbVariant" "nodeadkeys"
 
  
The solutions above don't work on an Italian keyboard. To activate the AltGr key on an Italian keyboard make sure you have the following lines set up properly:
+
* In the logfile then be on the lookout for any lines beginning with {{ic|(EE)}}, which represent errors, and also {{ic|(WW)}}, which are warnings that could indicate other issues.
  Driver          "kbd"
 
  Option          "XkbRules"      "xorg"
 
  Option          "XkbVariant"    ""
 
  
This might still not be enough for a swedish keyboard. Try the above, but with lv3 instead of compose. (Thank you wyvern!)
+
* If there is an ''empty'' {{ic|.xinitrc}} file in your {{ic|$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 {{ic|Xorg.0.log}}. Simply deleting it will get it running with a default X environment.
That is:
+
* If the screen goes black, you may still attempt to switch to a different virtual console (e.g. {{ic|Ctrl+Alt+F2}}), and blindly log in as root. You can do this by typing {{ic|root}} (press {{ic|Enter}} after typing it) and entering the root password (again, press {{ic|Enter}} after typing it).
  Option "XkbLayout" "se"
 
  Option "XkbVariant" "nodeadkeys"
 
  Option "XkbOptions" "lv3:ralt_switch"
 
  
==== Can't set qwerty layouts using the setxkbmap command ====
+
: You may also attempt to kill the X server with:
 +
: {{bc|# pkill X}}
 +
: If this does not work, reboot blindly with:
 +
: {{bc|# reboot}}
  
After the update, there aren't qwerty layouts as for example sk_qwerty. If you want to switch your present keyboard layout to any qwerty keyboard layout use this command:
+
*Check specific pages in [[:Category:Input devices]] if you have issues with keyboard, mouse, touchpad etc.
$ setxkbmap NAME_OF_THE_LAYOUT qwerty
+
*Search for common problems in [[ATI]], [[Intel]] and [[NVIDIA]] articles.
e.g.: for sk_qwerty use:
 
$ setxkbmap sk qwerty
 
  
After the update, trying the above command I had this message "Error loading new keyboard description".
+
=== Black screen, No protocol specified.., Resource temporarily unavailable for all or some users ===
I find out that the xserver doesn't have the rights to write, execute, read in the directory /var/tmp
 
So give the permissions to that directory. Restart the xserver and you will have your deadkeys back!
 
Don't believe? Try out the code e.g.: it layout
 
$ setxkbmap -layout it
 
  
==== Setup French Canadian (old ca_enhanced) layout ====
+
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.
  
With Xorg7, "ca_enhanced" is no more.  You have to do a little trick to get the same layout that you are used to:
+
=== DRI with Matrox cards stopped working ===
Switch the old:
 
        Option          "XkbLayout"    "ca_enhanced"
 
To:
 
        Option          "XkbLayout"    "ca"
 
        Option          "XkbVariant"    "fr"
 
  
It will be similar with other layout, I presume.  You can refer to Gentoo HowTo there: http://www.gentoo.org/proj/en/desktop/x/x11/modular-x-howto.xml
+
If you use a Matrox card and DRI stopped working after upgrading to Xorg, try adding the line:
  
 +
Option "OldDmaInit" "On"
  
 +
to the Device section that references the video card in {{ic|xorg.conf}}.
  
=== Missing libraries ===
+
=== Frame-buffer mode problems ===
* '''Help!  I get an error message running my favourite app saying "libXsomething" doesn't exist!'''<br>
 
In most cases, all you need to do is take the name of the library (eg libXau.so.1), convert it all to lowercase, remove the extension, and pacman for it:
 
# pacman -S libxau
 
  
This will install the library you're missing, and all will be well again!
+
If X fails to start with the following log messages,
  
=== Some packages fail to build and complain about missing X11 includes ===
+
{{bc|<nowiki>
 +
(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
  
Just reinstall the packages xproto and libx11, even if they are already installed.
+
Fatal server error:
 +
Cannot run in framebuffer mode. Please specify busIDs for all framebuffer devices
 +
</nowiki>}}
  
=== Unable to load font '(null)' ===
+
[[Uninstall]] the {{pkg|xf86-video-fbdev}} package.
* '''Some programs don't work and say unable to load font `(null)'.'''<br>
+
 
These packages would like some extra fonts. Some programs only work with bitmap fonts.
+
=== Program requests "font '(null)'" ===
Two major packages with bitmap fonts are available, xorg-fonts-75dpi and xorg-fonts-100dpi. You don't need both; one should be enough. To find out which one would be better in your case, try this:
+
 
 +
* Error message: "''unable to load font `(null)'.''"
 +
Some programs only work with bitmap fonts. Two major packages with bitmap fonts are available, {{Pkg|xorg-fonts-75dpi}} and {{Pkg|xorg-fonts-100dpi}}. You do not need both; one should be enough. To find out which one would be better in your case, try {{ic|xdpyinfo}} from {{Pkg|xorg-xdpyinfo}}, like this:
  
 
  $ xdpyinfo | grep resolution
 
  $ xdpyinfo | grep resolution
  
and grab what is closer to you (75 or 100 instead of XX)
+
and use what is closer to the shown value.
 +
 
 +
=== Recovery: disabling Xorg before GUI login ===
  
# pacman -S xorg-fonts-XXdpi
+
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.
  
=== KDE Taskbar/Desktop Icons Broken ===
+
* Change default target to rescue.target. See [[systemd#Change default target to boot into]].
* '''KDE taskbar doesn't work and the desktop icons disappear'''<br>
+
* 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. Follow the [[Installation_guide#Format the partitions|installation guide]] about how to mount and chroot into the installed Arch Linux. Alternatively try to switch into another [[tty]] with {{ic|Ctrl+Alt}} + function key (usually from {{ic|F1}} to {{ic|F7}} depending on which is not used by X), login as root and follow steps below.
Install the packages libxcomposite and libxss. It will be fine.
 
  
# pacman -S libxcomposite libxss
+
Depending on setup, you will need to do one or more of these steps:
  
=== Updating from testing version to extra (missing files) ===
+
* [[Disable]] the [[display manager]].
 +
* Disable the [[start X at login|automatic start of the X]].
 +
* Rename the {{ic|~/.xinitrc}} or comment out the {{ic|exec}} line in it.
  
If you've updated from Xorg 7 in testing to Xorg 7 in extra and are finding that many files seem to be missing (including startx, /usr/share/X11/rgb.txt, and others), you may have lost many files due to the xorg-clients package splitting from a single package into many smaller sub packages. <br>
+
=== X clients started with "su" fail ===
  
You need to reinstall all the packages that are dependencies of xorg-clients:
+
If you are getting "Client is not authorized to connect to server", try adding the line:
# pacman -S xorg-apps xorg-font-utils xorg-res-utils xorg-server-utils \
 
          xorg-twm xorg-utils xorg-xauth xorg-xdm xorg-xfs xorg-xfwp \
 
          xorg-xinit xorg-xkb-utils xorg-xsm
 
  
This should fix the problem.
+
session        optional        pam_xauth.so
  
=== Problem with MIME types in various desktop environments ===
+
to {{ic|/etc/pam.d/su}} and {{ic|/etc/pam.d/su-l}}. {{ic|pam_xauth}} will then properly set environment variables and handle {{ic|xauth}} keys.
  
If you noticed icons missing and can't click-open files in desktop environments, add the following lines to /etc/profile or your preferred init script and reboot.
+
=== X failed to start: Keyboard initialization failed ===
XDG_DATA_DIRS=$XDG_DATA_DIRS:/usr/share
 
export XDG_DATA_DIRS
 
  
=== DRI stops working with Matrox cards ===
+
If the filesystem (specifically {{ic|/tmp}}) is full, {{ic|startx}} will fail. {{ic|/var/log/Xorg.0.log}} will end with:
  
If you use a Matrox card and DRI stops working after upgrading to xorg7, try adding the line
+
{{bc|<nowiki>
Option "OldDmaInit" "On"
+
(EE) Error compiling keymap (server-0)
to the Device section that references the video card in xorg.conf.
+
(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
 +
</nowiki>}}
 +
 
 +
Make some free space on the relevant filesystem and X will start.
 +
 
 +
=== Rootless Xorg ===
 +
 
 +
Xorg may run with standard user privileges with the help of {{man|8|systemd-logind}}, see [https://fedoraproject.org/wiki/Changes/XorgWithoutRootRights] and {{Bug|41257}}. The requirements for this are:
 +
 
 +
* Starting X via [[xinit]]; display managers are not supported
 +
* [[Kernel mode setting]]; implementations in proprietary display drivers fail [http://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/xorg-wrapper.c#n222 auto-detection] and require manually setting {{ic|1=needs_root_rights = no}} in {{ic|/etc/X11/Xwrapper.config}}.
 +
 
 +
If you do not fit these requirements, re-enable root rights in {{ic|/etc/X11/Xwrapper.config}}:
 +
 
 +
{{hc|/etc/X11/Xwrapper.config|2=
 +
needs_root_rights = ''yes''}}
 +
 
 +
See also {{man|1|Xorg.wrap}} and [[Systemd/User#Xorg as a systemd user service]].
 +
 
 +
[[GDM]] also runs Xorg without root privileges by default when [[Kernel mode setting]] is used.
 +
 
 +
==== Broken redirection ====
  
=== Cannot start any clients under Xephyr ===
+
While user Xorg logs are stored in {{ic|~/.local/share/xorg/Xorg.log}}, they do not include the output from the X session. To re-enable redirection, start X with the {{ic|-keeptty}} flag:
  
The client connections are rejected by the X server's security mechanism, you can find a complete explanation and solution in [http://wiki.debian.org/XStrikeForce/FAQ#howtoxnest].
+
exec startx -- -keeptty > ~/.xorg.log 2>&1
  
=== Cannot start X clients as root using "su" ===
+
Or copy {{ic|/etc/X11/xinit/xserverrc}} to {{ic|~/.xserverrc}}, and append {{ic|-keeptty}}. See [https://bbs.archlinux.org/viewtopic.php?pid=1446402#p1446402].
  
If you're getting "Client is not authorized to connect to server", try adding the line
+
=== A green screen whenever trying to watch a video===
  
  session        optional        pam_xauth.so
+
Your color depth is set wrong. It may need to be 24 instead of 16, for example.
  
to the file /etc/pam.d/su.
+
=== SocketCreateListener error ===
pam_xauth will properly set environment variables and handle xauth keys.
 
  
== Links ==
+
If X terminates with error message "SocketCreateListener() failed", you may need to delete socket files in {{ic|/tmp/.X11-unix}}. This may happen if you have previously run Xorg as root (e.g. to generate an {{ic|xorg.conf}}).
See also:
 
  
* [[Enabling a DM]]
+
== See also ==
* [[Start X at boot]]
 
* [[Xorg Font Configuration]]
 
* Proprietary Video Drivers
 
** [[ATI]]
 
** [[NVIDIA]]
 
* [[Desktop Environment]]
 
** [[KDE]]
 
** [[GNOME]]
 
** [[Xfce]]
 
** [[Enlightenment]]
 
** [[Fluxbox]]
 
External Links:
 
  
* [http://en.wikipedia.org/wiki/X.Org_Server X.org Wikipedia Article]
+
* [https://magcius.github.io/xplain/article/ Xplain] - In-depth explanation of the X Window System
* [http://wiki.x.org/wiki/ X.org]
 

Revision as of 05:50, 29 June 2018

ro:Xorg

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 (commonly referred as simply X) is the most popular display server 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.

Installation

Xorg can be installed with the xorg-server package.

Additionally, some packages from the xorg-apps group are necessary for certain configuration tasks, they are pointed out in the relevant sections.

Finally, an xorg group is also available, which includes Xorg server packages, packages from the xorg-apps group and fonts.

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

Driver installation

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

Xorg searches for installed drivers automatically:

  • If it cannot find the specific driver installed for the hardware (listed below), it first searches for fbdev (xf86-video-fbdev).
  • If that is not found, it searches for vesa (xf86-video-vesa), the generic driver, which handles a large number of chipsets but does not include any 2D or 3D acceleration.
  • If vesa is not found, Xorg will fall back to kernel mode setting, which includes GLAMOR acceleration (see modesetting(4)).

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:

Brand Type Driver OpenGL OpenGL (Multilib) Documentation
AMD/
ATI
Open source xf86-video-amdgpu mesa lib32-mesa AMDGPU
xf86-video-ati ATI
Proprietary catalystAUR catalyst-libglAUR lib32-catalyst-libglAUR AMD Catalyst
Intel Open source xf86-video-intel mesa lib32-mesa Intel graphics
Nvidia Open source xf86-video-nouveau mesa lib32-mesa Nouveau
Proprietary nvidia nvidia-utils lib32-nvidia-utils NVIDIA
nvidia-390xx nvidia-390xx-utils lib32-nvidia-390xx-utils
nvidia-340xx nvidia-340xx-utils lib32-nvidia-340xx-utils
Note:

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. The exceptions to this rule are recent GPUs (especially Nvidia GPUs), that are not supported by the open source drivers.

AMD

GPU architecture Radeon cards Open-source driver Proprietary driver
GCN 4
and newer
various AMDGPU AMDGPU PRO
GCN 3 AMDGPU Catalyst /
AMDGPU PRO
GCN 2 AMDGPU* / ATI Catalyst
GCN 1 AMDGPU* / ATI Catalyst
TeraScale 2&3 HD 5000 - HD 6000 ATI Catalyst
TeraScale 1 HD 2000 - HD 4000 Catalyst legacy
Older X1000 and older not available
*: Experimental

Running

Display manager

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

Manually

To start the X server without a display manager, see xinit.

Configuration

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 in xorg.conf(5), 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. Note that on conflicting configuration, the file read last will be processed. For that reason the most generic configuration files should be ordered first by name. The configuration entries in the xorg.conf file are processed at the end.

For option examples to set, see also the fedora wiki.

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.

Tip: If you are already running an X server, use a different display, for example Xorg :2 -configure.

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.

Input devices

For input devices the X server defaults to the libinput driver (xf86-input-libinput), but xf86-input-evdev and related drivers are available as alternative.[1]

Udev, which is provided as a systemd dependency, will detect hardware and both drivers will act as hotplugging input driver for almost all devices, as defined in the default configuration files 10-quirks.conf and 40-libinput.conf in the /usr/share/X11/xorg.conf.d/ directory.

After starting X server, the log file will show which driver hotplugged for the individual devices (note the most recent log file name may vary):

$ grep -e "Using input driver " Xorg.0.log

If both do not support a particular device, install the needed driver from the xorg-drivers group. The same applies, if you want to use another driver.

To influence hotplugging, see #Configuration.

For specific instructions, see also the libinput article, the following pages below, or the Fedora wiki entry for more examples.

Mouse acceleration

See Mouse acceleration.

Extra mouse buttons

See Mouse buttons.

Touchpad

See libinput or Synaptics.

Touchscreen

See Touchscreen.

Keyboard settings

See 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.

/etc/X11/xorg.conf.d/10-monitor.conf
Section "Monitor"
    Identifier             "Monitor0"
EndSection

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

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
    EndSubSection
EndSection
Note: By default, Xorg needs to be able to detect a monitor and will not start otherwise. A workaround is to create a configuration file such as the example above and thus avoid auto-configuring. A common case where this is necessary is a headless system, which boots without a monitor and starts Xorg automatically, either from a virtual console at login, or from a display manager.

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"
EndSection

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

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 (adjust identifier to your xrandr output) :

Section "Monitor"
    Identifier             "DVI-D-0"
    DisplaySize             286 179    # In millimeters
EndSection

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
EndSection

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"
EndSection

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

Option              "UseEdidDpi" "False"
Option              "DPI" "96 x 96"
Manual DPI Setting Caveat

GTK very often overrides the server's DPI via the optional Xresource Xft.dpi. To find out whether this is happening to you, check with:

$ xrdb -query | grep dpi

With GTK library versions since 3.16, when this variable is not otherwise explicitly set, GTK sets it to 96. To have GTK apps obey the server DPI you may need to explictly set Xft.dpi to the same value as the server. The Xft.dpi resource is the method by which some desktop environments optionally force DPI to a particular value in personal settings. Among these are KDE and TDE.

Display Power Management

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.

Composite

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

Some window managers (e.g. Compiz, Enlightenment, KWin, Marco, Metacity, Muffin, Mutter, Xfwm) do compositing on their own. For other window managers, a standalone composite manager can be used.

List of composite managers

  • Compton — Compositor (a fork of xcompmgr-dana)
https://github.com/chjj/compton || compton
  • Xcompmgr — Composite window-effects manager
http://cgit.freedesktop.org/xorg/app/xcompmgr/ || xcompmgr
  • Unagi — Modular compositing manager which aims written in C and based on XCB
http://projects.mini-dweeb.org/projects/unagi || unagiAUR

Tips and tricks

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.

Find the name or 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, where device is the device ID or name of the device 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

Alternatively using the device name, the command to disable the touchpad would be:

$ xinput --disable "SynPS/2 Synaptics TouchPad"

Killing application with hotkey

Run script on hotkey:

#!/bin/bash
windowFocus=$(xdotool getwindowfocus);
pid=$(xprop -id $windowFocus | grep PID);
kill -9 $pid

Deps: xorg-xprop, xdotool

Block TTY access

To block tty access when in an X add the following to xorg.conf:

Section "ServerFlags"
    Option "DontVTSwitch" "True"
EndSection

Prevent a user from killing X

To prevent a user from killing when it is running add the following to xorg.conf:

Section "ServerFlags"
    Option "DontZap"      "True"
EndSection

Troubleshooting

General

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/. GDM users should check the systemd journal. [2]

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.

DRI with Matrox cards stopped working

If you use a Matrox card and DRI stopped 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 the xf86-video-fbdev package.

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 xdpyinfo from xorg-xdpyinfo, like this:

$ xdpyinfo | grep resolution

and use what is closer to the shown value.

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. Follow the installation guide about how to mount and chroot into the installed Arch Linux. Alternatively try to switch into another tty with Ctrl+Alt + function key (usually from F1 to F7 depending on which is not used by X), login as root and follow steps below.

Depending on setup, you will need to do one or more of these steps:

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 and /etc/pam.d/su-l. pam_xauth will then properly set environment variables and handle xauth keys.

X failed to start: Keyboard initialization failed

If the filesystem (specifically /tmp) 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 the relevant filesystem and X will start.

Rootless Xorg

Xorg may run with standard user privileges with the help of systemd-logind(8), see [3] and FS#41257. The requirements for this are:

  • Starting X via xinit; display managers are not supported
  • Kernel mode setting; implementations in proprietary display drivers fail auto-detection and require manually setting needs_root_rights = no in /etc/X11/Xwrapper.config.

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

/etc/X11/Xwrapper.config
needs_root_rights = yes

See also Xorg.wrap(1) and Systemd/User#Xorg as a systemd user service.

GDM also runs Xorg without root privileges by default when Kernel mode setting is used.

Broken redirection

While user Xorg logs are stored in ~/.local/share/xorg/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

Or copy /etc/X11/xinit/xserverrc to ~/.xserverrc, and append -keeptty. See [4].

A green screen whenever trying to watch a video

Your color depth is set wrong. It may need to be 24 instead of 16, for example.

SocketCreateListener error

If X terminates with error message "SocketCreateListener() failed", you may need to delete socket files in /tmp/.X11-unix. This may happen if you have previously run Xorg as root (e.g. to generate an xorg.conf).

See also

  • Xplain - In-depth explanation of the X Window System