Xorg
Related articles
- Autostarting
- Display manager
- Window manager
- Font configuration
- Cursor themes
- Desktop environment
- Wayland
- xinit
- xrandr
- XDMCP 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.
- If it cannot find the specific driver installed for the hardware (listed below), it first searches for fbdev (xf86-video-fbdev), which does not include any 2D or 3D acceleration.
- 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 ).
- For Intel graphics on 4th generation and above, see Intel graphics#Installation for available drivers.
- For NVIDIA Optimus enabled laptop which uses an integrated video card combined with a dedicated GPU, see NVIDIA Optimus.
- Classic OpenGL (non-Gallium3D) drivers or Intel Gen2 and Gen3 (Mesa 22.0 and higher have dropped support for i915 classic driver)
- *: Experimental
- steamos-compositor-plus — Valve's compositor, with some added tweaks and fixes.
- Run startx as a subprocess of the login shell; run directly and do not use .
- Ensure that Xorg uses virtual terminal for which permissions were set, i.e. passed by logind in via .xserverrc.
- If using certain proprietary display drivers, kernel mode setting auto-detection will fail. In such cases, you must set in .
- In the logfile then be on the lookout for any lines beginning with
(EE)
, which represent errors, and also , which are warnings that could indicate other issues. - If there is an empty file in your , 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 . 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+F6
), and blindly log in as root. You can do this by typing (press after typing it) and entering the root password (again, press after typing it). - You may also attempt to kill the X server with:
- If this does not work, reboot blindly with:
- Change default target to . 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 to depending on which is not used by X), login as root and follow steps below. - Disable the display manager.
- Disable the automatic start of X.
- Rename the or comment out the
exec
line in it. - Xplain - In-depth explanation of the X Window System
- Prepare for LPIC-1 exam 2 - topic 106.1: X11 - briefly covers architecture, #Configuration, desktop environments, remote usage, Wayland.
- Gentoo:Xorg/Guide#Configuration
Xorg (commonly referred to 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.
For the alternative and potential successor, see Wayland.
Installation
Xorg can be installed with the package.
Additionally, some packages from the group are necessary for certain configuration tasks. They are pointed out in the relevant sections.
Finally, an group is also available, which includes Xorg server packages, packages from the group and fonts.
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 the graphics card (the Subsystem output shows the specific model):
$ lspci -v | grep -A1 -e VGA -e 3DThen, install an appropriate driver. You can search the package database for a complete list of open-source video drivers:
$ pacman -Ss xf86-videoXorg searches for installed drivers automatically:
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 | AMDGPU | |||
ATI | |||||
Proprietary | AMDGPU PRO | ||||
Intel | Open source | 1 | or mesa-amber3 | Intel graphics | |
NVIDIA | Open source | Nouveau2 | |||
Proprietary | nvidia | NVIDIA2 | |||
lib32-nvidia-390xx-utilsAUR |
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) not supported by open source drivers.
AMD
For a translation of model names (e.g. Radeon RX 6800) to GPU architectures (e.g. RDNA 2), see wikipedia:List of AMD graphics processing units.
GPU architecture | Open-source driver | Proprietary driver |
---|---|---|
RDNA and later | AMDGPU | AMDGPU PRO |
GCN 3 and later | ||
GCN 1&2 | AMDGPU* / ATI | not available |
TeraScale and older | ATI | not available |
Running
The command is usually not run directly. Instead, the X server is started with either a display manager or xinit.
Configuration
Xorg uses a configuration file called and files ending in the suffix for its initial setup: the complete list of the folders where these files are searched can be found in , together with a detailed explanation of all the available options.
Using .conf files
The directory stores host-specific configuration. You are free to add configuration files there, but they must have a suffix: the files are read in ASCII order, and by convention their names start with (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 configuration file. Note that on conflicting configuration, the file read last will be processed. For this reason, the most generic configuration files should be ordered first by name. The configuration entries in the file are processed at the end.
For option examples to set, see Fedora:Input device configuration#xorg.conf.d.
Using xorg.conf
Xorg can also be configured via /etc/X11/xorg.conf
or . You can also generate a skeleton for with:
This should create a file in that you can copy over to /etc/X11/xorg.conf
.
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 AMDGPU PRO, for more details.
Input devices
For input devices the X server defaults to the libinput driver (), but and related drivers are available as alternative.
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 and 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.logIf 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 Fedora:Input device configuration for more examples.
Input identification
Mouse acceleration
See Mouse acceleration.
Extra mouse buttons
See Mouse buttons.
Touchpad
Touchscreen
See Touchscreen.
Keyboard settings
Monitor settings
Manual configuration
For a headless configuration, the driver is necessary; install it and create a configuration file, such as the following:
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 (in decimal notation).
To get your bus IDs (in hexadecimal):
The bus IDs here are and 1:0:0
.
Display size and DPI
By default, Xorg always sets DPI to 96 since 2009 (see ). A change was made with version 21.1 to provide proper DPI auto-detection, but reverted (see ).
The DPI of the X server can be set with the command line option.
Having the correct DPI is helpful 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 see if your display size and DPI are correct:
$ xdpyinfo | grep -B2 resolutionCheck that the dimensions match your display size.
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):
If you only want to enter the specification of your monitor without creating a full xorg.conf, create a new configuration file. For example (/etc/X11/xorg.conf.d/90-monitor.conf
):
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.43698This 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.01920Setting DPI manually
For RandR compliant drivers (for example the open source ATI driver), you can set it by:
$ xrandr --dpi 144To make it permanent, see Autostarting#On Xorg startup.
Proprietary NVIDIA driver
You can manually set the DPI by adding the option under the or section:
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:
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 explicitly 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 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. For more information, see Wikipedia: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
Tips and tricks
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 | Also contains screen scraping tools. Cannot simulate and more. | ||||
xdo | xdo(1) | Small X utility to perform elementary actions on windows. | |||
xdotool | Very buggy and not in active development, e.g: has broken CLI parsing. | ||||
xvkbd | Virtual keyboard for Xorg, also has the option for sending characters. | ||||
AutoKey | autokey-qtAUR | documentation | Higher-level, powerful macro and scripting utility, with both Qt and Gtk front-ends. |
See also Clipboard#Tools and an overview of X automation tools.
Nested X session
To run a nested session of another desktop environment:
$ /usr/bin/Xnest :1 -geometry 1024x768+0+0 -ac -name Windowmaker & wmaker -display :1This will launch a Window Maker session in a 1024 by 768 window within your current X session.
This needs the package to be installed.
A more modern way of doing a nested X session is with Xephyr.
Starting an application without a window manager
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 package.
Find the name or ID of the device you want to disable:
$ xinputFor 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 , 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 10To re-enable the device, just issue the opposite command:
$ xinput --enable 10Alternatively 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/sh windowFocus=$(xdotool getwindowfocus) pid=$(xprop -id "$windowFocus" | grep PID) kill -9 "$pid"Dependencies: ,
See also #Killing an application visually.
Block TTY access
To block tty access when in an X add the following to xorg.conf:
This can be used to help restrict command line access on a system accessible to non-trusted users.
Prevent a user from killing X
To prevent a user from killing X when it is running add the following to xorg.conf:
Killing an application visually
When an application is misbehaving or stuck, instead of using or killall
from a terminal and having to find the process ID or name, allows to click on said application to close its connection to the X server. Many existing applications do indeed abort when their connection to the X server is closed, but some can choose to continue.
Rootless Xorg
Xorg may run with standard user privileges instead of root (so-called "rootless" Xorg). This is a significant security improvement over running as root. Note that some popular display managers do not support rootless Xorg (e.g. LightDM or XDM).
You can verify which user Xorg is running as with .
See also , , Systemd/User#Xorg as a systemd user service, Fedora:Changes/XorgWithoutRootRights and FS#41257.
Using xinitrc
To configure rootless Xorg using xinitrc:
Using GDM
GDM will run Xorg without root privileges by default when kernel mode setting is used.
Session log redirection
When Xorg is run in rootless mode, Xorg logs are saved to . However, the stdout and stderr output from the Xorg session is not redirected to this log. To re-enable redirection, start Xorg with the flag and redirect the stdout and stderr output to a file:
startx -- -keeptty >~/.xorg.log 2>&1Alternatively, copy /etc/X11/xinit/xserverrc
to , and append . See .
Xorg as Root
As explained above, there are circumstances in which rootless Xorg is defaulted to. If this is the case for your configuration, and you have a need to run Xorg as root, you can configure to require root:
Troubleshooting
General
If a problem occurs, view the log stored in either or, for the rootless X default since v1.16, in . GDM users should check the systemd journal.
The logfiles are of the form with being the display number. For a single user machine with default configuration the applicable log is frequently , 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:
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 section that references the video card in .
Frame-buffer mode problems
X fails to start with the following log messages:
To correct, uninstall the xf86-video-fbdev package.
Program requests "font '(null)'"
Error message: .
Some programs only work with bitmap fonts. Two major packages with bitmap fonts are available, xorg-fonts-75dpi and . You do not need both; one should be enough. To find out which one would be better in your case, try from , like this:
$ xdpyinfo | grep resolutionand 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.
Depending on setup, you will need to do one or more of these steps:
X clients started with "su" fail
If you are getting , try adding the line:
session optional pam_xauth.soto /etc/pam.d/su
and . will then properly set environment variables and handle keys.
X failed to start: Keyboard initialization failed
If the filesystem (specifically ) is full, will fail. 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.
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 , you may need to delete socket files in . This may happen if you have previously run Xorg as root (e.g. to generate an ).
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:rootThat line can also be used to give access to X to a different user than root.
Xorg-server Fatal server error: (EE) AddScreen/ScreenInit
If the Xorg server is not working randomly and in the Xorg log you see:
systemd-logind: failed to take device /dev/dri/card0: Operation not permitted ... AddScreen/ScreenInit failed for driver 0Then, this problem may be caused by systemd issue 13943. Set up early KMS start.