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):
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" EndSubSection EndSection
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:
Use the tail or grep command to view log file:
tail -f /var/log/Xorg.2.log grep 'something' /var/log/Xorg.2.log
- Xorg wiki
- man page - xorg.conf
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop