≡ Menu

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/xorg.conf.new
# 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:

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 3 comments… add one }
  • uteck May 18, 2010, 10:18 am

    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 am

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

    • dfense December 1, 2010, 5:17 pm

      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.

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , , , , , , , , , , , , , , ,