Linux: Configure Xorg X11 Window System

My xorg.conf file is missing as I deleted accidentally for some reason. Now, Xorg try to probe my hardware on every startup. How do I configure Xorg under Debian or any Linux distro / operating systems?

The latest X server versions are designed to work out-of-the-box, with no need to manually edit Xorg’s configuration files. However, you can use the following generic steps to edit or create xorg.conf file.

Stop X Windows Manager

First, you need to shutdown X and its manager. The simplest way to do is login to a console as root and type the following commands to stop kdm or gdm:
# /etc/init.d/kdm stop <-- stop KDE windows manager # /etc/init.d/gdm stop <-- stop Gnome windows manager # /etc/init.d/xdm stop <-- stop x windows manager

How Do I Configure X?

You can type any one of the following command:
# dpkg-reconfigure xserver-xorg
The above is Debian / Ubuntu Linux specific command. The generic command for Linux and UNIX is as follows to configure X:
# cd /etc/X11/ && Xorg -configure
Now, just follow on screen instructions to configure Xorg. You can configure Video (mostly auto detected), keyboard and so on.

Testing new config

The above command will create a new Xorg conf file. You can test with the following command:
# X -config -retro /root/
# X -config -retro /etc/X11/xorg.conf

If everything looks good, try startx to start up your X server (swtich to another virtual console (Ctrl + Alt + F2) and type the following command):
$ startx

Fine Tuning Xorg

You can edit /etc/X11/xorg.conf to make changes such as setting a new driver, adding fonts path, video resolution and so on.
# cp /etc/X11/xorg.conf /etc/X11/xorg.conf.working
# vi /etc/X11/xorg.conf

In this example, set video size to 1440x900:

Section "Screen"
  Identifier  "Default Screen"
  Device    "RadeonHD 4550"
  Monitor   "Generic Monitor"
  DefaultDepth  24  
  SubSection "Display"
    Depth   24
    Modes   "1440x900"

Save and close the file. You need to restart or reload X to see changes.

Xorg log file

You can see error or warning log file for troubleshooting purpose at the following location:

  • /var/log/Xorg.?.log

Use the tail or grep command to view log file:

tail -f /var/log/Xorg.2.log
grep 'something' /var/log/Xorg.2.log

Recommend readings:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 3 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
3 comments… add one
  • uteck May 18, 2010 @ 10:18

    Xorg has not required a config file for some time and can run just fine without it. Unless you have some special hardware that is not detected, or need some obscure option, there is no reason to make a xorg.conf file any more.

  • Slavko May 24, 2010 @ 10:52

    use HAL, or udev configuration for this… But xorg.conf is still allowed and used, only it is not needed…

    • dfense Dec 1, 2010 @ 17:17

      I’d like to force X to use my xorg.conf file, as it is normal in my circumstance a monitor is not connected at time of startup. I use kvm style switch on multiple systems.

      Anyone know how to force x to do this, and not probe at startup, as i get a failed “no screens found” message when this is the case.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum