Xorg.conf Repair

by Devnet

If you're like me, you change things constantly in your Linux desktop. I'm always entering and tweaking .conf files to see what I can do and where the limits of things might be. In my attempt yesterday to get my EXACT monitor supported in PCLinuxOS, I hosed my xorg.conf file, which is where all the Xsession settings (or Xwindows session) are stored (like mouse, keyboard, monitor, and graphics driver settings). Since I hosed this up, my graphical user interface and window manager would not start. So I was dropped to login via the shell. This might be daunting for some new users in Linux so I figured I'd write up this little how-to that would get them back on their feet.

First, don't be intimidated by the shell. It's more powerful than a cmd (command) line in windows and you'll have complete control of your computer from the confines of this awesome tool. Plus, you're about 15-20 seconds away from having your desktop back up and running by executing only a few commands.

In order to fix your xorg.conf file, it's important that you become root; so login as root and let's fix your xorg.conf file in four commands.

Editor's note: If you have an always-on Internet connection, it might be wise to disconnect that cable from your computer while you perform these steps.

First, let's get to the right directory to work with xorg.conf:

[root@lostmain ~] cd /etc/X11

Next, let's remove all xorg.conf files and any backups (usually saved as xorg.conf.old or xorg.conf.bak) with the next command:

[root@lostmain X11] rm -f xorg.conf*

The -f flag forces the deleting of the files without prompting and the * means that we'll delete any file that starts with xorg.conf. That means xorg.conf.bak and xorg.conf.old will be deleted right along with our original xorg.conf file as well. Now let's fix this by using the shell PCLinuxOS Control Center. That's right, you don't have to have KDE fired up and running to access the PCLinuxOS Control Center; you can do it right here:

[root@lostmain X11] pcc

Now go into hardware and configure the display. When choosing a monitor, the quickest and easiest way to get back into a GUI is to use a "Generic" setting. I chose Generic 1280X1024 @ 76 for my Samsung Syncmaster 710N 17" LCD screen. Next up, If you have the ATI or Nvidia driver installed, it will ask you if you'd like to use it (choose yes). It will then ask if you'd like to change any options; the default is usually OK. Now it will take you in to test the configuration. If you see the rainbow test screen, you're set. If not, you'll have to change things (normally resolution) until you're able to see it. The test screen will ask you if you'd like to use the settings it's using to test the screen; hit yes (it might be "OK", I'm going from memory here) and you'll be dropped right back to the shell.

Now we could start kdm/xdm and an Xsession here, but it's much easier for new users to simply reboot so:

[root@lostmain X11] reboot

Next time you start up things should be back to normal. Isn't it nice to be able to have quick resolutions to many Linux problems via the PCLinuxOS Control Center? What a great tool!

That was one of the main reasons I chose PCLinuxOS over other desktops. It has the PCLinuxOS Control Center available for me to configure samba, groupware, LDAP, Printers, etc. Pretty much anything I need to configure in Linux is ready and waiting for me in this fantastic control center. It usually puts new users at ease as well, since they're used to the control panel in Windows. I know when I was first introduced to Linux I noted that there was not a central place where I could control all things Linux (although /etc in Slackware is handy ). Plus, if you're missing anything, send a quick word to the developers and chances are you'll see it included very soon. So get used to that PCLinuxOS Control Center!

Remember that you can call it via the shell using the pcc command. Hopefully, this little tip has been helpful to you.