Difference between revisions of "Xorg"

From ArchWiki
Jump to navigation Jump to search
(Undo revision 577927 by Ashark (talk) - xf86-video-amdgpu is open source, AMDGPU PRO is already linked from #AMD)
(Tag: Undo)
 
(625 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]]
{{i18n|Xorg}}
+
[[da:Xorg]]
 +
[[de:X]]
 +
[[el:Xorg]]
 +
[[es:Xorg]]
 +
[[fr:Xorg]]
 +
[[it:Xorg]]
 +
[[ja:Xorg]]
 +
[[nl:Xorg]]
 
[[pl:Xorg]]
 
[[pl:Xorg]]
[[fr:Xorg]]
+
[[pt:Xorg]]
 +
[[ru:Xorg]]
 +
[[uk: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 https://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.
 +
 
 +
'''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 [https://www.x.org/wiki/ Xorg website] for more details.
 +
 
 +
== Installation ==
 +
 
 +
Xorg can be [[install]]ed with the {{Pkg|xorg-server}} package.
 +
 
 +
Additionally, some packages from the {{Grp|xorg-apps}} group are necessary for certain configuration tasks, they are pointed out in the relevant sections.
 +
 
 +
Finally, an {{Grp|xorg}} group is also available, which includes Xorg server packages, packages from the {{Grp|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'' ({{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}}).
 +
 
 +
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:
 +
 
 +
{| class="wikitable"  style="text-align:center"
 +
|-
 +
! Brand !! Type !! Driver !! OpenGL !! OpenGL ([[multilib]]) !! Documentation
 +
|-
 +
! rowspan="2" | AMD / ATI
 +
| rowspan="2" | Open source || {{Pkg|xf86-video-amdgpu}} || rowspan="2" | {{Pkg|mesa}} || rowspan="2" | {{Pkg|lib32-mesa}} || [[AMDGPU]]
 +
|-
 +
| {{Pkg|xf86-video-ati}} || [[ATI]]
 +
|-
 +
! Intel
 +
| Open source || {{Pkg|xf86-video-intel}} || {{Pkg|mesa}} || {{Pkg|lib32-mesa}} || [[Intel graphics]]
 +
|-
 +
! rowspan="4" | 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}}
 +
|}
 +
 
 +
{{Note|
 +
* 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.
 +
}}
 +
 
 +
Other video drivers can be found in the {{Grp|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 ===
 +
 
 +
{| class="wikitable"  style="text-align:center"
 +
|-
 +
! 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
  
{{Article summary start}}
+
== Running ==
{{Article summary text|An all-inclusive overview about installing and managing Xorg}}
 
{{Article summary heading|Overview}}
 
{{Article summary text|{{Graphical user interface overview}}}}
 
{{Article summary heading|Related}}
 
{{Article summary wiki|ATI}}
 
{{Article summary wiki|Intel}}
 
{{Article summary wiki|NVIDIA}}
 
{{Article summary end}}
 
  
'''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 [[Wikipedia:X.Org Server|Xorg]] Wikipedia article or visit the [http://www.x.org/wiki/ Xorg website] for more details.
+
The {{man|1|Xorg}} command is usually not run directly, instead the X server is started with either a [[display manager]] or [[xinit]].
  
==Installing==
+
== Configuration ==
  
First, fully update your system
+
{{Note|Arch supplies default configuration files in {{ic|/usr/share/X11/xorg.conf.d/}}, and no extra configuration is necessary for most setups.}}
# pacman -Syu
 
  
Then you can install the Xorg base packages:
+
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.
# pacman -S xorg-server xorg-xinit xorg-utils xorg-server-utils
 
  
For basic Xorg functionality you may also want to install some other packages:
+
=== Using .conf files ===
# pacman -S xorg-twm xorg-xclock xterm
 
  
Since v.1.8, Xorg-server '''doesn't need HAL for hardware access'''. Udev can detect your hardware itself.
+
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.  
  
You can remove HAL from your startup daemon in {{filename|/etc/rc.conf}} without problem if you don't have any other app installed in your system that requires HAL to be running.
+
For option examples to set, see also the [https://fedoraproject.org/wiki/Input_device_configuration#xorg.conf.d Fedora wiki].
Moreover, the settings that were located in the {{filename|/etc/X11/xorg.conf}} file, can be found now in the files located in the {{filename|/etc/X11/xorg.conf.d/}} directory.
 
  
Udev should be capable of detecting your hardware without problems and evdev (xf86-input-evdev) is the modern, hotplugging input driver for almost all devices so in most cases, installing input drivers is not needed.
+
=== Using xorg.conf ===
  
If evdev doesn't support your device, install the needed driver from the '''xorg-input-drivers''' group.
+
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:
  
Xorg-server can be initiated by the '''startx''' command. You should only use it in case you have properly edited the ~/.'''xinitrc''' file.
+
# Xorg :0 -configure
  
{{Note|In case you are using a Desktop Environment (GNOME, KDE etc), you are encouraged to use a DM (KDM, GDM etc), which will manage the, possible, DE specific apps and libs which should be preloaded.}}
+
This should create a {{ic|xorg.conf.new}} file in {{ic|/root/}} that you can copy over to {{ic|/etc/X11/xorg.conf}}.
  
==Configuring==
+
{{Tip|If you are already running an X server, use a different display, for example {{ic|Xorg :2 -configure}}.}}
  
Configuration files are located in {{filename|/etc/X11/xorg.conf.d/}}.
+
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.
  
You should have {{filename|10-evdev.conf}} which manages the keyboard, the mouse, the touchpad and the touchscreen.
+
{{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.}}
You are free to create new config files, but they must start with '''XX-''' (where XX is a number) and have a '''.conf''' suffix (10 read before 20 for example).
 
  
===Touchpad/Synaptics===
+
== Input devices ==
  
If you have a laptop, you need to install the touchpad driver.
+
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/]
# pacman -S xf86-input-synaptics
 
  
After installation, you can find {{filename|10-synaptics.conf}} in the {{filename|/etc/X11/xorg.conf.d}} directory. It is safe to comment out/delete the "InputClass" line regarding the  touchpad in {{filename|10-evdev.conf}}.
+
[[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.
  
===Graphics card and driver===
+
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):
The default graphics driver is Vesa (xf86-video-vesa), which handles a large number of chipsets but does not include any 2d or 3d acceleration. To enable graphics acceleration, you will need to install and use the driver specific to your graphics card.
+
  $ grep -e "Using input driver " Xorg.0.log
  
First, identify your card:
+
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.
$ lspci | grep VGA
 
  
Then, install an appropriate driver. You can ''search'' for these packages with the following command:
+
To influence hotplugging, see [[#Configuration]].  
# pacman -Ss xf86-video
 
  
Common drivers (open source):
+
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.
*nvidia: xf86-video-nouveau (see [[Nouveau]])
 
*intel: xf86-video-intel (see [[Intel]])
 
*ati: xf86-video-ati (see [[ATI]])
 
<!--add more drivers with links to wiki pages here-->
 
  
====Proprietary drivers====
+
=== Input identification ===
  
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. See [[NVIDIA]] and [[ATI]].
+
See [[Keyboard input#Identifying keycodes in Xorg]].
  
=====Nvidia=====
+
=== Mouse acceleration ===
  
During the installation of the proprietary [[NVIDIA]] driver, a config file ('''20-nvidia.conf''') will be installed in the {{filename|/etc/X11/xorg.conf.d}} directory. It allows Xorg to use nvidia's driver at Xorg start.
+
See [[Mouse acceleration]].
  
===Monitor settings===
+
=== Extra mouse buttons ===
  
==== Getting started ====
+
See [[Mouse buttons]].
  
{{Note|This step is OPTIONAL and shouldn't be done unless you know what you are doing.}}
+
=== Touchpad ===
{{Note|This step is '''NOT OPTIONAL''' if using dual monitors or the nouveau driver. See [[Nouveau#Configuration]].}}
 
  
First, create a new config file, for example, {{filename|/etc/X11/xorg.conf.d/10-monitor.conf}}.
+
See [[libinput]] or [[Synaptics]].
  # nano /etc/X11/xorg.conf.d/10-monitor.conf
 
Copy and paste the following code.
 
  
<pre>
+
=== Touchscreen ===
Section "Monitor"
 
    Identifier    "Monitor0"
 
EndSection
 
  
Section "Device"
+
See [[Touchscreen]].
    Identifier    "Device0"
 
    Driver        "vesa" #Choose the driver used for this monitor
 
EndSection
 
  
Section "Screen"
+
=== Keyboard settings ===
    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
 
</pre>
 
  
====Multiple monitors/Dual screen====
+
See [[Keyboard configuration in Xorg]].
  
=====Nvidia=====
+
== Monitor settings ==
To activate dual screen support, you just need to edit the {{filename|10-monitor.conf}} file which you made before.
 
  
Per each physical monitor, add one Monitor, Device, and Screen Section entry, and then a ServerLayout section to manage it.  Be advised that when Xinerama is enabled, the Nvidia proprietary driver automatically disables compositing.  If you desire compositing, you should comment the Xinerama line in "ServerLayout" out and use Twinview (see below) instead.
+
=== Manual configuration ===
  
<pre>
+
{{Note|
Section "ServerLayout"
+
* Newer versions of Xorg are auto-configuring, so manual configuration should not be needed.
    Identifier    "DualSreen"
+
* If Xorg is unable to detect any monitor or to avoid auto-configuring, a configuration file can be used. 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]].
    Screen      0 "Screen0"
+
}}
    Screen      1 "Screen1" RightOf "Screen0" #Screen1 at the right of Screen0
 
    Option        "Xinerama" "1" #To move windows between screens
 
EndSection
 
  
Section "Monitor"
+
For a headless configuration the {{pkg|xf86-video-dummy}} driver is necessary; [[install]] it and create a configuration file, such as the following:
    Identifier    "Monitor0"
 
    Option        "Enable" "true"
 
EndSection
 
  
 +
{{hc|/etc/X11/xorg.conf.d/10-headless.conf|
 
Section "Monitor"
 
Section "Monitor"
    Identifier     "Monitor1"
+
        Identifier "dummy_monitor"
    Option         "Enable" "true"
+
         HorizSync 28.0-80.0
 +
        VertRefresh 48.0-75.0
 +
        Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118
 
EndSection
 
EndSection
  
 
Section "Device"
 
Section "Device"
    Identifier     "Device0"
+
        Identifier "dummy_card"
    Driver         "nvidia"
+
        VideoRam 256000
    Screen        0
+
        Driver "dummy"
 
EndSection
 
EndSection
  
Section "Device"
+
Section "Screen"
    Identifier    "Device1"
+
        Identifier "dummy_screen"
    Driver         "nvidia"
+
        Device "dummy_card"
    Screen         1
+
        Monitor "dummy_monitor"
 +
         SubSection "Display"
 +
         EndSubSection
 
EndSection
 
EndSection
 +
}}
 +
 +
=== Multiple monitors ===
  
Section "Screen"
+
See main article [[Multihead]] for general information.
    Identifier    "Screen0"
+
 
    Device        "Device0"
+
See also GPU-specific instructions:
    Monitor        "Monitor0"
 
    DefaultDepth    24
 
    Option        "TwinView" "0"
 
    SubSection "Display"
 
        Depth          24
 
        Modes          "1280x800_75.00"
 
    EndSubSection
 
EndSection
 
  
Section "Screen"
+
* [[NVIDIA#Multiple monitors]]
    Identifier    "Screen1"
+
* [[Nouveau#Dual head]]
    Device        "Device1"
+
* [[AMD Catalyst#Double Screen (Dual Head / Dual Screen / Xinerama)]]
    Monitor        "Monitor1"
+
* [[ATI#Multihead setup]]
    DefaultDepth  24
 
    Option        "TwinView" "0"
 
    SubSection "Display"
 
        Depth          24
 
    EndSubSection
 
EndSection
 
</pre>
 
  
======TwinView======
+
==== More than one graphics card ====
You want only one big screen instead of two. Set the TwinView argument to 1.  This option should be used instead of Xinerama (see above), if you desire compositing.
 
Option "TwinView" "1"
 
  
======Using Nvidia Settings======
+
You must define the correct driver to use and put the bus ID of your graphic cards.
You can also use the Nvidia-settings tool, with this method you will use the proprietary software Nvidia provides with their drivers. Simply open the settings as Root, then configure how you wish, and then save the configuration to /etc/X11/xorg.conf.d/10-monitor.conf .
 
  
=====More than one graphic card=====
+
{{bc|
You must define the good driver to use and put the ID bus of your graphic cards.
 
<pre>
 
 
Section "Device"
 
Section "Device"
     Identifier     "Screen0"
+
     Identifier             "Screen0"
     Driver         "nouveau"
+
     Driver                 "nouveau"
     BusID           "PCI:0:12:0"
+
     BusID                 "PCI:0:12:0"
 
EndSection
 
EndSection
  
 
Section "Device"
 
Section "Device"
     Identifier     "Screen1"
+
     Identifier             "Screen1"
     Driver         "radeon"
+
     Driver                 "radeon"
     BusID           "PCI:1:0:0"
+
     BusID                 "PCI:1:0:0"
 
EndSection
 
EndSection
</pre>
+
}}
 +
 
 +
To get your bus ID:
  
To get your ID bus :
+
{{hc|$ lspci {{!}} grep VGA|
$ lspci | grep VGA
+
01:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce 9600M GT] (rev a1)
01:00.0 VGA compatible controller: nVidia Corporation G96 [GeForce 9600M GT] (rev a1)
+
}}
  
The ID bus here is 1:0:0.
+
The bus ID here is 1:0:0.
  
====Display Size and DPI ====
+
=== Display size and DPI ===
  
'''Q:''' How does the Xorg server calculate DPI? <br />
+
{{Accuracy|1=Xorg always sets dpi to 96. See [https://bugs.freedesktop.org/show_bug.cgi?id=23705 this], [https://gitlab.freedesktop.org/xorg/xserver/issues/253 this] and finally [https://pastebin.com/vtzyBK6e this].}}
'''A:''' The DPI of the X server is determined in the following manner:
 
  
# The -dpi command line option has highest priority.
+
The DPI of the X server is determined in the following manner:
# 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 DDC are used to derive the DPI, given the screen resolution.
+
# The {{ic|-dpi}} command line option has highest priority.
 +
# If this is not used, the {{ic|DisplaySize}} setting in the X config file is used to derive the DPI, given the screen resolution.
 +
# If no {{ic|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 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 [http://en.wikipedia.org/wiki/Display_Data_Channel DDC].  When the Xorg server knows the physical screen size, it will be able to set the correct DPI depending on resolution size.
+
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>
  
 
To see if your display size and DPI are detected/calculated correctly:
 
To see if your display size and DPI are detected/calculated correctly:
  
  $ xdpyinfo | grep dimensions
+
  $ xdpyinfo | grep -B2 resolution
$ xdpyinfo | grep "dots per inch"
 
  
 
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.
 
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:
+
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) :
  
<pre>
+
{{bc|
 
Section "Monitor"
 
Section "Monitor"
     Identifier "Monitor0"
+
     Identifier             "DVI-D-0"
     DisplaySize 286 179    # In millimeters
+
     DisplaySize             286 179    # In millimeters
 
EndSection
 
EndSection
</pre>
+
}}
  
If you only want to enter the specification of your monitor WITHOUT creating a full xorg.conf instead, first create a new config file, for example, {{filename|/etc/X11/xorg.conf.d/90-monitor.conf}}.
+
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}}):
# nano /etc/X11/xorg.conf.d/10-monitor.conf
 
Copy and paste the following code:
 
  
<pre>
+
{{bc|
 
Section "Monitor"
 
Section "Monitor"
     Identifier "<default monitor>"
+
     Identifier             "<default monitor>"
     DisplaySize 286 179    # In millimeters
+
     DisplaySize           286 179    # In millimeters
 
EndSection
 
EndSection
</pre>
+
}}
  
 
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):
 
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
+
  $ 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):
 
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):
  
<pre>
+
$ echo 'scale=5;(13.3/1509)*1280*25.4' | bc  # 286.43072
echo 'scale=5;(13.3/1509)*1280*25.4' | bc  # 286.43072
+
$ echo 'scale=5;(13.3/1509)*800*25.4' | bc # 179.01920
echo 'scale=5;(13.3/1509)*800*25.4' | bc   # 179.01920
+
 
</pre>
+
{{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.}}
  
{{Note|This calculation works for most monitor sizes; 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 ====
  
DPI can be set manually if you only plan to use one resolution:
+
{{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.}}
  
<pre>
+
For RandR compliant drivers (for example the open source ATI driver), you can set it by:
Section "Monitor"
 
    Identifier "Monitor0"
 
    Option  "DPI" "96 x 96"
 
EndSection
 
</pre>
 
  
If, for some odd reason, the nvidia drivers don't set the correct DPI, you can turn off auto-detection:
+
$ xrandr --dpi 144
  
Option  "UseEdidDpi" "false"
+
{{Note|Applications that comply with the setting will not change immediately. You have to start them anew.}}
  
For RandR compliant drivers, you can set it by:
+
See [[Execute commands after X start]] to make it permanent.
  
xrandr --dpi 96
+
===== Proprietary NVIDIA driver =====
  
See [[Execute commands after X start]] to make it permanent.
+
DPI can be set manually if you only plan to use one resolution ([https://www.pxcalc.com/ DPI calculator]):
  
====DPMS====
+
{{bc|
 +
Section "Monitor"
 +
    Identifier            "Monitor0"
 +
    Option                "DPI" "96 x 96"
 +
EndSection
 +
}}
  
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]]
+
You can manually set the DPI adding the options below on {{ic|/etc/X11/xorg.conf.d/20-nvidia.conf}} (inside '''Device''' section):
  
===Disabling Input Hot-plugging===
+
Option              "UseEdidDpi" "False"
Since version''' 1.8''' Xorg-server uses udev for device detection. The following will disable the use of udev.
+
Option              "DPI" "96 x 96"
  
Section "ServerFlags"
+
===== Manual DPI Setting Caveat =====
    Option "AutoAddDevices" "False"
 
EndSection
 
{{Warning|This will disable Xorg hot-plugging for '''all''' input devices and revert to the same behavior as xorg-server 1.4. It is much more convenient to let udev configure your devices. '''Therefore, disabling hot-plugging is not recommended!'''}}
 
  
===InputClasses ===
+
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:
'''Taken from: https://fedoraproject.org/wiki/Input_device_configuration'''
 
  
InputClasses are a new type of configuration section that does not apply to a single device but rather to a class of devices, including hotplugged devices. An InputClass section's scope is limited by the ''matches'' specified &ndash; to apply to an input device, all matches must apply to a device. An example InputClass section is provided below:
+
$ xrdb -query | grep dpi
  
<pre>
+
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]].
Section "InputClass"
 
    Identifier      "touchpad catchall"
 
    MatchIsTouchpad "on"
 
    Driver          "synaptics"
 
EndSection
 
</pre>
 
  
The next snippet might also be helpful:
+
=== Display Power Management ===
<pre>
 
Section "InputClass"
 
        Identifier "evdev touchpad catchall"
 
        MatchIsTouchpad "on"
 
        MatchDevicePath "/dev/input/event*"
 
        Driver "evdev"
 
EndSection
 
</pre>
 
  
If this snippet is present in the {{Filename|xorg.conf}} or xorg.conf.d, any touchpad present in the system is assigned the synaptics driver. Note that due to precedence order (alphanumeric sorting of xorg.conf.d snippets) the Driver setting overwrites previously set driver options &ndash; the more generic the class, the earlier it should be listed. The default snippet shipped with the xorg-x11-drv-Xorg package is {{Filename|00-evdev.conf}} and applies the evdev driver to all input devices.
+
[[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.
  
The match options specify which devices a section may apply to. To match a device, all match lines must apply. The following match lines are supported (with examples):
+
== Composite ==
* {{Codeline|MatchIsPointer}}, {{Codeline|MatchIsKeyboard}}, {{Codeline|MatchIsTouchpad}}, {{Codeline|MatchIsTouchscreen}}, {{Codeline|MatchIsJoystick}} &ndash; boolean options to apply to a group of devices.
 
* {{Codeline|MatchProduct "foo&#124;bar"}}: match any device with a product name containing either "foo" or "bar"
 
* {{Codeline|MatchVendor "foo&#124;bar&#124;baz"}}: match any device with a vendor string containing either "foo", "bar", or "baz"
 
* {{Codeline|MatchDevicePath "/dev/input/event*"}}: match any device with a device path matching the given patch (see fnmatch(3) for the allowed pattern)
 
* {{Codeline|MatchTag "foo&#124;bar"}}: match any device with a tag of either "foo" or "bar". Tags may be assigned by the config backend &ndash; udev in our case &ndash; to label devices that need quirks or special configuration.
 
  
An example section for user-specific configuration is:
+
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]]
  
<pre>
+
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.
Section "InputClass"
 
    Identifier    "lasermouse slowdown"
 
    MatchIsPointer "on"
 
    MatchProduct  "Lasermouse"
 
    MatchVendor    "LaserMouse Inc."
 
    Option        "ConstantDeceleration" 20
 
EndSection
 
</pre>
 
  
This section would match a pointer device containing "Lasermouse" from "Lasermouse Inc." and apply a constant deceleration of 20 on this device &ndash; slowing it down by factor 20.
+
=== List of composite managers ===
  
Some devices may get picked up by the X server when they really shouldn't be. These devices can be configured to be ignored:
+
* {{App|[[Compton]]|Compositor (a fork of xcompmgr-dana)|https://github.com/yshui/compton|{{Pkg|compton}}}}
 +
* {{App|[[Xcompmgr]]|Composite window-effects manager|https://cgit.freedesktop.org/xorg/app/xcompmgr/|{{Pkg|xcompmgr}}}}
 +
* {{App|Unagi|Modular compositing manager which aims written in C and based on XCB|https://projects.mini-dweeb.org/projects/unagi|{{AUR|unagi}}}}
  
<pre>
+
== Tips and tricks ==
Section "InputClass"
 
    Identifier    "no need for accelerometers in X"
 
    MatchProduct  "accelerometer"
 
    Option        "Ignore" "on"
 
EndSection
 
</pre>
 
  
====Example configurations====
+
{{Expansion|Mention {{Pkg|xorg-xkill}}.}}
  
The following subsections describe example configurations for commonly used configuration options. Note that if you use a desktop environment such as GNOME or KDE, options you set in the xorg.conf ''may'' get overwritten with user-specific options upon login.
+
=== Automation ===
  
=====Example: Wheel Emulation (for a Trackpoint)=====
+
This section lists utilities for automating keyboard / mouse input and window operations (like moving, resizing or raising).
  
If you own a computer with a Trackpoint (a Thinkpad for example) you can add the following to the {{Filename|xorg.conf}} to use the middle Button to emulate a mouse wheel:
+
{| class="wikitable"
 +
! Tool !! Package !! Manual !! [[Keysym]]<br>input !! Window<br>operations !! Note
 +
|-
 +
! xautomation
 +
| {{Pkg|xautomation}} || {{man|1|xte}} || {{Yes}} || {{No}} || Also contains screen scraping tools. Cannot simulate F13+.
 +
|-
 +
! xdo
 +
| {{AUR|xdo-git}} || {{man|1|xdo}} || {{No}} || {{Yes}} || Small X utility to perform elementary actions on windows.
 +
|-
 +
! xdotool
 +
| {{Pkg|xdotool}} || {{man|1|xdotool}} || {{Yes}} || {{Yes}} || [https://github.com/jordansissel/xdotool/issues Very buggy] and not in active development, e.g: has broken CLI parsing.[https://github.com/jordansissel/xdotool/issues/14#issuecomment-327968132][https://github.com/jordansissel/xdotool/issues/71]
 +
|-
 +
! xvkbd
 +
| {{AUR|xvkbd}} || {{man|1|xvkbd|url=http://t-sato.in.coocan.jp/xvkbd/#option}} || {{Yes}} || {{No}} || Virtual keyboard for Xorg, also has the {{ic|-text}} option for sending characters.
 +
|}
  
<pre>
+
See also [[Clipboard#Tools]] and [https://venam.nixers.net/blog/unix/2019/01/07/win-automation.html an overview of X automation tools].
Section "InputClass"
 
    Identifier    "Wheel Emulation"
 
    MatchIsPointer "on"
 
    MatchProduct  "TrackPoint"
 
    Option        "EmulateWheelButton" "2"
 
    Option "EmulateWheel" "on"
 
EndSection
 
</pre>
 
  
For full support of TrackPoints (including horizontal scrolling) you can use the following:
+
=== Nested X session ===
<pre>
 
Section "InputClass"
 
    Identifier "Trackpoint Wheel Emulation"
 
    MatchProduct "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint|ThinkPad USB Keyboard with TrackPoint|USB Trackpoint pointing device"
 
    MatchDevicePath "/dev/input/event*"
 
    Option "EmulateWheel" "true"
 
    Option "EmulateWheelButton" "2"
 
    Option "Emulate3Buttons" "false"
 
    Option "XAxisMapping" "6 7"
 
    Option "YAxisMapping" "4 5"
 
EndSection
 
</pre>
 
  
=====Example: Tap-to-click=====
+
{{Expansion|mention [[Awesome#Using_Xephyr|xephyr]]}}
Tap-to-click can be enabled in the mouse configuration dialog (in the touchpad tab) but if you need tapping enabled at gdm already, the following snippet does it for you:
 
<pre>
 
Section "InputClass"
 
    Identifier "tap-by-default"
 
    MatchIsTouchpad "on"
 
    Option "TapButton1" "1"
 
EndSection
 
</pre>
 
  
=====Example: Keyboard layout and model on Acer 5920G Laptop=====
+
To run a nested session of another desktop environment:
  
Keyboard model and layout may be set in the file {{filename|/etc/X11/xorg.conf.d/keyboard.conf}} or any other .conf file in the same directory.
+
$ /usr/bin/Xnest :1 -geometry 1024x768+0+0 -ac -name Windowmaker & wmaker -display :1
* {{Codeline|MatchIsKeyboard "yes"}}: set the input device to a keyboard
 
* {{Codeline|Option "XkbModel" "acer_laptop"}}: set the keyboard model to an Acer * {{Codeline|Option "XkbLayout" "be"}}: set the keyboard layout to belgian.  You may replace {{Codeline|be}} with whatever layout you have.
 
* {{Codeline|Option "XkbVariant" "sundeadkeys"}}: set the layout variant to Sun dead keys. You may omit the {{Codeline|XkbVariant}} option if you stick with the default variant.
 
laptop keyboard.  You may replace {{Codeline|acer_laptop}} with your actual keyboard layout.
 
  
Note that a list of keyboard layouts and models can be found in {{filename|/usr/share/X11/xkb/rules/base.lst}}
+
This will launch a Window Maker session in a 1024 by 768 window within your current X session.
  
<pre>
+
This needs the package {{Pkg|xorg-server-xnest}} to be installed.
Section "InputClass"
 
    Identifier            "Keyboard Defaults"
 
    MatchIsKeyboard        "yes"
 
    Option                "XkbModel" "acer_laptop"
 
    Option                "XkbLayout" "be"
 
    Option                "XkbVariant" "sundeadkeys"
 
EndSection
 
</pre>
 
  
===Keyboard settings===
+
=== Starting GUI programs remotely ===
  
Xorg may fail to detect your keyboard correctly. This might give problems with your keyboard layout or keyboard model not being set correctly.
+
See main article: [[OpenSSH#X11 forwarding]].
  
To see a full list of keyboard models, layouts, variants and options, open:
+
=== On-demand disabling and enabling of input sources ===
  
/usr/share/X11/xkb/rules/xorg.lst
+
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.
  
To set the keymap for the current Xorg session:
+
[[Install]] the {{Pkg|xorg-xinput}} package.
# setxkbmap dvorak
 
  
====Key repeat delay and rate====
+
Find the name or ID of the device you want to disable:
  
Use {{Codeline|xset r rate DELAY RATE}} to change them, then use [[xinitrc]] to make it permanent.
+
$ xinput
  
====Viewing Keyboard Settings====
+
For example in a Lenovo ThinkPad T500, the output looks like this:
  $ setxkbmap -print -verbose 10
 
<pre>
 
Setting verbose level to 10
 
locale is C
 
Applied rules from evdev:
 
model:      evdev
 
layout:    us
 
options:    terminate:ctrl_alt_bksp
 
Trying to build keymap using the following components:
 
keycodes:  evdev+aliases(qwerty)
 
types:      complete
 
compat:    complete
 
symbols:    pc+us+inet(evdev)+terminate(ctrl_alt_bksp)
 
geometry:   pc(pc104)
 
xkb_keymap {
 
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
 
        xkb_types    { include "complete"      };
 
        xkb_compat    { include "complete"      };
 
        xkb_symbols  { include "pc+us+inet(evdev)+terminate(ctrl_alt_bksp)"    };
 
        xkb_geometry  { include "pc(pc104)"    };
 
};
 
</pre>
 
  
====Setting Keyboard Layout With Hot-Plugging====
+
{{hc|$ xinput|<nowiki>
To permanently change your keyboard layout, add the following to xorg.conf:
+
⎡ Virtual core pointer                          id=2    [master pointer  (3)]
<pre>
+
⎜  ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
Section "InputClass"
+
⎜  ↳ TPPS/2 IBM TrackPoint                    id=11  [slave  pointer  (2)]
     Identifier            "Keyboard Defaults"
+
⎜  ↳ SynPS/2 Synaptics TouchPad                id=10  [slave  pointer  (2)]
     MatchIsKeyboard   "yes"
+
⎣ Virtual core keyboard                        id=3    [master keyboard (2)]
     Option           "XkbLayout" "dvorak"
+
    ↳ Virtual core XTEST keyboard              id=5    [slave  keyboard (3)]
EndSection
+
    ↳ Power Button                              id=6    [slave  keyboard (3)]
</pre>
+
    ↳ 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>}}
  
Note that this is in an InputClass Section and not the InputDevice section for the keyboard.
+
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:
  
====Setting Keyboard Layout Without Hot-Plugging (deprecated)====
+
$ xinput --disable 10
{{Note|Changing the keyboard layout through this method requires disabling input hot-plugging.}}
 
  
To change the keyboard layout, use the XkbLayout option in the keyboard InputDevice section. For example, if you have a keyboard with English (Great Britain) layout, your keyboard InputDevice section might look similar to this:
+
To re-enable the device, just issue the opposite command:
  
<pre>
+
$ xinput --enable 10
Section "InputDevice"
 
    Identifier    "Keyboard0"
 
    Driver        "kbd"
 
    Option "XkbLayout" "gb"
 
EndSection
 
</pre>
 
  
To change the keyboard model, use the XkbModel option in the keyboard InputDevice section. For example, if you have a Microsoft Wireless Multimedia Keyboard:
+
Alternatively using the device name, the command to disable the touchpad would be:
  
  Option "XkbModel" "microsoftmult"
+
  $ xinput --disable "SynPS/2 Synaptics TouchPad"
  
====Switching Between Keyboard Layouts====
+
=== Killing application with hotkey ===
To be able to easily switch keyboard layouts, modify the Options used in either of the above two methods. For example, to switch between a US and a Swedish layout using the Caps Lock key, use:
 
  
Option "XkbLayout"  "us, se"
+
Run script on hotkey:
Option "XkbOptions" "grp:caps_toggle"
 
  
This is mainly useful if you run a Desktop Environment which does not take care of keyboard layouts for you.
+
#!/bin/bash
 +
windowFocus=$(xdotool getwindowfocus);
 +
pid=$(xprop -id $windowFocus | grep PID);
 +
kill -9 $pid
  
====Disable mousekeys Permanently====
+
Deps: {{Pkg|xorg-xprop}}, {{Pkg|xdotool}}
To disable the mousekeys permanently and prevent Shift+NumLock or Shift+Alt+NumLock to enable, edit:
 
/usr/share/X11/xkb/compat/complete
 
and comment out:
 
augment "mousekeys"
 
augment "accessx(full)"
 
  
===Fonts===
+
=== Block TTY access ===
See [[Font Configuration]] for information on how to configure font rendering.
 
  
===Sample xorg.conf Files===
+
{{Expansion|Why would you want to do this?}}
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 do not in-line the entire configuration file; upload it somewhere else and link.<br />
 
'''Please post input hotplugging configurations only, otherwise note that your config is not using input hotplugging.''' (Xorg 1.8 = udev)
 
  
===== - Sample One: xorg.conf & xorg.conf.d/10-evdev.conf =====
+
To block tty access when in an X add the following to [[#Configuration|xorg.conf]]:
This is a sample configuration file using xorg.conf.d/10-evdev.conf for the keyboard layouts:<br />
 
''Note: The "InputDevice" sections are commented out, because 10-evdev.conf is taking care of them.''
 
xorg.conf: http://pastebin.com/raw.php?i=EuSKahkn
 
xorg.conf.d/10-evdev.conf: http://pastebin.com/raw.php?i=4mPY35Mw>
 
xorg.conf.d/10-monitor.conf (VMWare): http://pastebin.com/raw.php?i=fJv8EXGb
 
xorg.conf.d/10-monitor.conf (KVM): http://pastebin.com/raw.php?i=NRz7v0Kn
 
  
==Running Xorg==
+
{{bc|
 +
Section "ServerFlags"
 +
    Option "DontVTSwitch" "True"
 +
EndSection
 +
}}
  
You should add dbus to your DAEMONS array:
+
=== Prevent a user from killing X ===
  
DAEMONS=(syslog-ng '''dbus''' network crond)
+
To prevent a user from killing when it is running add the following to [[#Configuration|xorg.conf]]:
  
If you need to start dbus without rebooting, run
+
{{bc|
 +
Section "ServerFlags"
 +
    Option "DontZap"      "True"
 +
EndSection
 +
}}
  
# /etc/rc.d/dbus start
+
== Troubleshooting ==
  
Finally, start Xorg:
+
=== General ===
$ startx
 
or
 
$ xinit -- /usr/bin/X -nolisten tcp
 
  
{{Note|If you just installed Xorg, there is an empty .xinitrc file in your $HOME that you need to either delete or edit 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 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]
  
The default X environment is rather bare, and you will typically seek to install window managers or desktop environments to supplement X. A list of suitable options is present in [[Common Applications#Window Managers (WM)]].
+
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 a problem occurs, then view the log at {{Filename|/var/log/Xorg.0.log}}. Be on the lookout for any lines beginning with {{Codeline|(EE)}} which represent errors, and also {{Codeline|(WW)}} which are warnings that could indicate other issues.
+
{{hc|$ 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
 +
[    40.704] (--) controlling tty is VT number 1, auto-enabling KeepTty
 +
}}
  
===Methods for starting your Graphical Environment===
+
* 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.
What follows are a couple of methods for starting a graphical environment from the command line.
+
* 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.
{{Note|If you are using a full-blown Desktop Environment (Gnome, KDE, etc), you might be more interested in reading the wiki page dedicated to said DE.}}
+
* 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).
  
====Using runlevels====
+
: You may also attempt to kill the X server with:
By default, Linux is set up to have different [[runlevels]]. Arch boots into runlevel 3 by default. Runlevel 5 is typically used in Linux for loading X server.
+
: {{bc|# pkill -x X}}
Edit the file /etc/inittab. In the last section at the bottom of the file, uncomment the appropriate line for your desktop environment's display manager. For example, for XDM (X Display manager) it would look like this:
+
: If this does not work, reboot blindly with:
# Example lines for starting a login manager
+
: {{bc|# reboot}}
x:5:respawn:/usr/bin/xdm -nodaemon
 
#x:5:respawn:/usr/sbin/gdm -nodaemon
 
#x:5:respawn:/usr/bin/kdm -nodaemon
 
#x:5:respawn:/usr/bin/slim >/dev/null 2>&1
 
  
Now, simply start your desktop environment:
+
* Check specific pages in [[:Category:Input devices]] if you have issues with keyboard, mouse, touchpad etc.
# init 5
+
* Search for common problems in [[ATI]], [[Intel]] and [[NVIDIA]] articles.
  
====Using .xinitrc====
+
=== Black screen, No protocol specified.., Resource temporarily unavailable for all or some users ===
This method involves the most configuring.
 
  
First we need to configure ~/.xinitrc
+
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.
  
One of the main functions of this file is to dictate what '''X''' Window client is invoked with the '''/usr/bin/startx''' and/or '''/usr/bin/xinit''' program ''on a per-user basis''. (The  '''startx'''  script is merely a front end to the more versatile '''xinit''' command.) There are vast amounts of additional configurable specifications and commands that may also be added to ~/[[.xinitrc]] as you further customize your system.
+
=== DRI with Matrox cards stopped working ===
  
{{Note | '''[[.xinitrc]]''' is a so-called 'dot' (.) file. Files in a *nix filesystem which are preceded with a dot (.) are 'hidden', and will not show up with a regular 'ls' command, usually for the sake of keeping directories tidy. Dot files may be seen by issuing '''ls -a'''. The 'rc' denotes ''Run Commands'' and simply indicates that it is a configuration file. Since it controls how a program runs, it is (although historically incorrect) also said to stand for &quot;Run Control&quot;.}}
+
If you use a Matrox card and DRI stopped working after upgrading to Xorg, try adding the line:
  
The '''startx''' and '''xinit''' commands will start the '''X''' server and clients. To determine the client to run, '''startx/xinit''' will first look to parse a [[.xinitrc]] file in the user's home directory. In the absence of file ~/[[.xinitrc]], it defaults to the global xinitrc in the xinit library directory; /etc/X11/xinit/xinitrc, which defaults to using the TWM window manager. (Hence, if you invoke startx without a ~/[[.xinitrc]] file, a TWM session will start.) Further details in the [[.xinitrc]] wiki entry.
+
Option "OldDmaInit" "On"
  
Switch to your '''''normal, non-root''''' user:
+
to the Device section that references the video card in {{ic|xorg.conf}}.
  
# su - ''yourusername''
+
=== Frame-buffer mode problems ===
  
* /etc/skel/ contains files and directories to provide sane defaults for newly created user accounts. The name '''skel''' is derived from the word '''skeleton''', because the files it contains form the basic structure for users' home directories.
+
If X fails to start with the following log messages,
{{Note | This template file '''[[.xinitrc]]''' is available in the /etc/skel directory when the package '''xorg-xinit''' is installed.}}
 
  
* Sample .xinitrc provided [[Xinitrc#A_standard_.xinitrc | here]]
+
{{bc|<nowiki>
Copy the sample xinitrc file from /etc/skel/ to your home directory:
+
(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
  
$ cp /etc/skel/[[.xinitrc]] ~/
+
Fatal server error:
Edit the file:
+
Cannot run in framebuffer mode. Please specify busIDs for all framebuffer devices
$ nano ~/.xinitrc
+
</nowiki>}}
and uncomment the line that corresponds to your Desktop Environment. For example, if you use Xterm, it will look something like this:
 
  
<pre>
+
[[Uninstall]] the {{pkg|xf86-video-fbdev}} package.
#!/bin/sh
 
#
 
# ~/.xinitrc
 
#
 
# Executed by startx (run your window manager from here)
 
  
# exec gnome-session
+
=== Program requests "font '(null)'" ===
# exec startkde
 
# exec startxfce4
 
# exec wmaker
 
# exec icewm
 
# exec blackbox
 
# exec fluxbox
 
# exec openbox-session
 
# ...or the Window Manager of your choice
 
exec xterm
 
</pre>
 
  
{{Note | ''Be sure to have only '''one''' uncommented '''exec''' line in ~/.xinitrc''.}}
+
Error message: {{ic|unable to load font `(null)'}}.
  
Now we're ready to launch X. Start '''X''' as a '''normal, non-root''' user, with:
+
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:
  
  $ startx
+
  $ xdpyinfo | grep resolution
or
 
$ xinit
 
  
Your desktop should open up now. You can test your keyboard and its layout in it.  Try moving your mouse around and enjoy the view.
+
and use what is closer to the shown value.
  
If trouble with automounting is experienced, try using the following command in ~/.xinitrc instead.  (Replace "startxfce4" with the command that is appropriate for your window manager/DE.)
+
=== Recovery: disabling Xorg before GUI login ===
exec ck-launch-session startxfce4
 
This will ensure the various environment variables are set correctly by starting a clean consolekit session. ConsoleKit is a framework for keeping track of the various users, sessions, and seats present on a system. It provides a mechanism for software to react to changes of any of these items or of any of the metadata associated with them. It works in conjunction with dbus, and other tools.
 
  
==Tips and tricks==
+
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.
  
===X startup (/usr/bin/startx) tweaking===
+
* Change default target to rescue.target. See [[systemd#Change default target to boot into]].
For X's option reference see:
+
* 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.
$ man Xserver
 
  
The following options have to be appended to the variable {{Codeline|"defaultserverargs"}} in the {{Filename|/usr/bin/startx}} file:
+
Depending on setup, you will need to do one or more of these steps:
  
* Enable deferred glyph loading for 16 bit fonts:
+
* [[Disable]] the [[display manager]].
-deferglyphs 16
+
* Disable the [[start X at login|automatic start of the X]].
 +
* Rename the {{ic|~/.xinitrc}} or comment out the {{ic|exec}} line in it.
  
Note: If you start X with kdm, the startx script does not seem to be executed. X options must be appended to the variable {{Codeline|"ServerArgsLocal"}} or {{Codeline|"ServerCmd"}} in the {{Filename|/usr/share/config/kdm/kdmrc}} file. By default kdm options are:
+
=== X clients started with "su" fail ===
  ServerArgsLocal=-nolisten tcp
 
  ServerCmd=/usr/bin/X
 
  
===Virtual X session===
+
If you are getting "Client is not authorized to connect to server", try adding the line:
To start another X session in, for example, CTRL + ALT + F8, you need to type this on a console:
 
xinit /path/to/wm -- :1
 
  
Change "/path/to/wm" to your window manager start file or to your login manager like gdm, kdm, or slim.
+
session        optional        pam_xauth.so
  
===Nested X session===
+
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.
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.
+
=== X failed to start: Keyboard initialization failed ===
  
This needs the package ''xorg-server-xnest'' to be installed.
+
If the filesystem (specifically {{ic|/tmp}}) is full, {{ic|startx}} will fail. {{ic|/var/log/Xorg.0.log}} will end with:
  
==Troubleshooting==
+
{{bc|<nowiki>
===Common problems===
+
(EE) Error compiling keymap (server-0)
If Xorg will not start, the screen is completely black, the keyboard and mouse are not working, etc., first take these simple steps:
+
(EE) XKB: Could not compile keymap
*Check the log file: {{codeline|cat /var/log/Xorg.0.log}}
+
(EE) XKB: Failed to load keymap. Loading default keymap instead.
*Install input driver (keyboard, mouse, joystick, tablet, etc...):
+
(EE) Error compiling keymap (server-0)
*Finally, search for common problems in [[ATI]], [[Intel]] and [[NVIDIA]] articles.
+
(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>}}
  
===Ctrl-Alt-Backspace doesn't work===
+
Make some free space on the relevant filesystem and X will start.
There are two ways of restoring {{keypress|Ctrl}}+{{keypress|Alt}}+{{keypress|Backspace}}; with and without input-hotplugging. Using hot-plugging is recommended.
 
  
====With input hot-plugging====
+
=== Rootless Xorg ===
In most situations, using user-specific configuration might be preferred over system-wide.
 
  
{{Note|On GNOME, this system-wide setting has no effect. Every user must go to System -> Preferences -> Keyboard -> Layouts -> Options [button] -> Key sequence to kill the X server [expand with triangle on left]. Then check Ctrl + Alt + Backspace option.}}
+
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:
  
{{Note|On KDE, this system-wide setting has no effect. To restore, go to Kickoff > Computer > System Settings which will open up the System Settings window. Click on 'Regional & Language'. In this new window click the Keyboard tab and then check the box for 'Enable Keyboard layouts'. This will enable you to click on the advanced tab. In this new window, expand the entry for 'Key sequence to kill the X server' and ensure Control + Alt + Backspace is checked. Click Apply and close the System Settings window. You now have your CTRL-ALT-Backspace back in KDE.}}
+
* Starting X via [[xinit]]; display managers are not supported
 +
* [[Kernel mode setting]]; implementations in proprietary display drivers fail [https://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}}.
  
=====System-wide=====
+
If you do not fit these requirements, re-enable root rights in {{ic|/etc/X11/Xwrapper.config}}:
Add
 
Option  "XkbOptions" "terminate:ctrl_alt_bksp"
 
to InputClass as so:
 
  
<pre>
+
{{hc|/etc/X11/Xwrapper.config|2=
Section "InputClass"
+
needs_root_rights = ''yes''}}
    Identifier          "Keyboard Defaults"
 
    MatchIsKeyboard "yes"
 
    Option              "XkbOptions" "terminate:ctrl_alt_bksp"
 
EndSection
 
</pre>
 
  
=====User-specific=====
+
See also {{man|1|Xorg.wrap}} and [[Systemd/User#Xorg as a systemd user service]].
Another way is to put this line in [[xinitrc]]:
 
setxkbmap -option terminate:ctrl_alt_bksp
 
  
====Without input hot-plugging====
+
[[GDM]] also runs Xorg without root privileges by default when [[Kernel mode setting]] is used.
New Xorg disables zapping with {{Keypress|Ctrl}}+{{Keypress|Alt}}+{{Keypress|Backspace}} by default. You can enable it by adding the following line to {{Filename|/etc/X11/xorg.conf}},
 
Option  "XkbOptions" "terminate:ctrl_alt_bksp"
 
to {{codeline|InputDevice}} section for keyboard.
 
  
===Apple keyboard issues===
+
==== Broken redirection ====
:''See: [[Apple Keyboard]]''
 
  
===Touchpad tap-click issues===
+
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:
:''See: [[Synaptics]]''
 
  
===Extra mouse buttons not recognized===
+
exec startx -- -keeptty > ~/.xorg.log 2>&1
:''See: [[Get All Mouse Buttons Working]]''
 
  
===X clients started with "su" fail===
+
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 are getting "Client is not authorized to connect to server", try adding the line:
 
session        optional        pam_xauth.so
 
to {{filename|/etc/pam.d/su}}. {{codeline|pam_xauth}} will then properly set environment variables and handle {{codeline|xauth}} keys.
 
  
===Program requests "font '(null)'"===
+
=== A green screen whenever trying to watch a video===
*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
 
  
===Frame-buffer mode problems===
+
Your color depth is set wrong. It may need to be 24 instead of 16, for example.
If X fails to start with the following log messages,
 
<pre>
 
(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:
+
=== SocketCreateListener error ===
Cannot run in framebuffer mode. Please specify busIDs for all framebuffer devices
 
</pre>
 
uninstall fbdev:
 
# pacman -R xf86-video-fbdev
 
  
===DRI with Matrox cards stops working===
+
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}}).
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.
 
  
===Recovery: disabling Xorg before GUI login===
+
=== Invalid MIT-MAGIC-COOKIE-1 key when trying to run a program as root ===
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 {{filename|rc.conf}} is wrongly configured and Xorg does not recognize your mouse or keyboard input, for instance), you can accomplish this task with two methods.
 
  
*From the grub menu, you can specify the runlevel in the kernel line by adding a number to the end of the kernel line specifying the run level you want. The following example sets the run level to 3:
+
That error means that only the current user has access to the X server. The solution is to give access to root:
  kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/..ro 3
 
  
*If you have not only a faulty {{filename|rc.conf}} to make 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 live CD. Boot up the live CD and login as root. You need a mount point, such as {{filename|/mnt}}, and you need to know the name of the partition you want to mount.
+
$ xhost +si:localuser:root
  
:You can use the command,
+
That line can also be used to give access to X to a different user than root.
  # fdisk -l
 
:to see your partitions. Usually, the one you want will be resembling {{filename|/dev/sda1}}. Then, to mount this to {{filename|/mnt}}, use
 
  # mount /dev/sda1 /mnt
 
  
:Then your file-system will show up under {{filename|/mnt}}. So your {{filename|rc.conf}} file, for example, would be in {{filename|/mnt/etc/rc.conf}}. From here you can delete the {{codeline|gdm}} module to prevent Xorg from booting up normally, or make any other necessary changes.
+
== See also ==
  
==See also==
+
* [https://magcius.github.io/xplain/article/ Xplain] - In-depth explanation of the X Window System
* [[Display Manager]]
 
* [[Execute commands after X start]]
 
* [[Start X at boot]]
 
* [[Font Configuration]]
 
* Proprietary Video Drivers
 
** [[ATI Catalyst]]
 
** [[NVIDIA]]
 
* [[Desktop Environment]]
 
* [[Window Manager]]
 
* [[Get All Mouse Buttons Working]]
 

Latest revision as of 14:10, 1 August 2019

From https://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
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
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

The Xorg(1) command is usually not run directly, instead the X server is started with either a display manager or 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.

Input identification

See Keyboard input#Identifying keycodes in Xorg.

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

Manual configuration

Note:
  • Newer versions of Xorg are auto-configuring, so manual configuration should not be needed.
  • If Xorg is unable to detect any monitor or to avoid auto-configuring, a configuration file can be used. 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.

For a headless configuration the xf86-video-dummy driver is necessary; install it and create a configuration file, such as the following:

/etc/X11/xorg.conf.d/10-headless.conf
Section "Monitor"
        Identifier "dummy_monitor"
        HorizSync 28.0-80.0
        VertRefresh 48.0-75.0
        Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118
EndSection

Section "Device"
        Identifier "dummy_card"
        VideoRam 256000
        Driver "dummy"
EndSection

Section "Screen"
        Identifier "dummy_screen"
        Device "dummy_card"
        Monitor "dummy_monitor"
        SubSection "Display"
        EndSubSection
EndSection

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/yshui/compton || compton
  • Xcompmgr — Composite window-effects manager
https://cgit.freedesktop.org/xorg/app/xcompmgr/ || xcompmgr
  • Unagi — Modular compositing manager which aims written in C and based on XCB
https://projects.mini-dweeb.org/projects/unagi || unagiAUR

Tips and tricks

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

Reason: Mention xorg-xkill. (Discuss in Talk:Xorg#)

Automation

This section lists utilities for automating keyboard / mouse input and window operations (like moving, resizing or raising).

Tool Package Manual Keysym
input
Window
operations
Note
xautomation xautomation xte(1) Yes No Also contains screen scraping tools. Cannot simulate F13+.
xdo xdo-gitAUR xdo(1) No Yes Small X utility to perform elementary actions on windows.
xdotool xdotool xdotool(1) Yes Yes Very buggy and not in active development, e.g: has broken CLI parsing.[2][3]
xvkbd xvkbdAUR xvkbd(1) Yes No Virtual keyboard for Xorg, also has the -text option for sending characters.

See also Clipboard#Tools and an overview of X automation tools.

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: OpenSSH#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

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

Reason: Why would you want to do this? (Discuss in Talk:Xorg#)

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. [4]

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 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 [5] 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 [6].

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

Invalid MIT-MAGIC-COOKIE-1 key when trying to run a program as root

That error means that only the current user has access to the X server. The solution is to give access to root:

$ xhost +si:localuser:root

That line can also be used to give access to X to a different user than root.

See also

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