How to repair a broken xorg.conf

by Sysero

Note: I wrote this short "How To" with the very new Linux user in mind. Many others have posted similar easy fixes for this same problem to help out our new friends. I just wanted to share one that I use in a friendly tutorial format. Feel free to add to this "How To" tutorial in any way you all see fit! Cheers!

Help!

Sooner or later it's going to happen. You're as happy as a clam with your shiny new PCLinuxOS install. You can't wait to get home from work to play some more. You arrive, run to the PC, you start it up and suddenly you see a bunch of confusing words on the screen, something about xorg.conf and then this appears:

"Dropping you to a limited shell."

No familiar login screen; no fancy desktop you spent hours making just right; no really cool wallpaper; just a flashing cursor and a login prompt. You'll be saying: "Great. What happened?!? Things were fine when I shut down last night. Now what?!?" (Well ok, maybe not that phrase exactly, but perhaps something containing stronger language and a flurry of colorful metaphors.)

Anyway, here's what happened. To put it as confusingly as possible, a misconfiguration occurred within xorg.conf preventing the KDE interface from loading. Huh?

What we mean here is that something inside of a file called xorg.conf is messed up and needs to be fixed. There are several ways to fix it. I'm going to show you the one I've used a few times. Write it down too. You'll have a quick fix handy.

What's xorg.conf?

Normally, xorg.conf is a happy little file that's quite content to go about it's day and not bother you. It's true. Trust me, I'm really good friends with it. It resides on your PC in the directory: /etc/X11 and its job is making sure that your configuration is correct so that Linux can open KDE and your desktop. Sometimes, xorg.conf also lives with it's father, xorg.conf.old in this directory. His job is to make lasagna for his son and sit around watching TV, waiting for something to go wrong. When it does, like any concerned father, he can fix things. But there's one catch: You have to tell him to fix things. That's what we're going to learn today: How to put xorg.conf.old into action. But, how did xorg.conf get so confused and messed up?

It gets messed up for one reason or another, especially when you play around with your video card configuration. Let's get underway and make a backup copy of your good, working xorg.conf so it will be there in case the inevitable should strike tomorrow. You know what they say: An ounce of prevention is worth two pounds fifty on the open market, or... something like that.

Backing up xorg.conf

Log out and log back into KDE as root for a moment. Click on your "Home" icon. To the far left you will see a vertical bar with a star, a clock, a house, a globe, a red folder, a red flag and a computer. Click on the red folder. Now you see the root folder menu. Double click on "etc." Scroll down and double click on "X11". Now look around for xorg.conf. Chances are, xorg.conf.old is there, but, just to be sure that you have a working, uncorrupted backup copy, let's replace it.

Left click once on xorg.conf.old. Now right click on it, and choose "Delete". Next left click once on xorg.conf and then right click on it, and choose "Copy". Now then, select "Edit" from the menu above and then "Paste Clipboard Contents". A box will pop up saying the file already exists and asks if you would like to rename it. Rename it to:

xorg.conf.old

All done. You have a working backup copy. Next, let's learn how to use xorg.conf.old when something bad happens. Continuing on from the example above: "Dropping you to a limited shell." You are now faced with the login prompt.

Repairing xorg.conf

(Write the following down for future use)

At the login prompt, type:

root

Hit "Enter" then type your root password.

Hit "Enter" again. Now you are logged in as root. Now type:

cd etc/X11

Hit "Enter". Now type:

touch xorg.conf.old

Hit "Enter". Now type:

mv xorg.conf.old xorg.conf

Hit "Enter". It will ask if you want to overwrite the file. Type:

y

Hit "Enter". All done. Now simply reboot your computer by typing either:

reboot

or

shutdown -r now

After reboot, log in and continue to enjoy this great Linux distro!

Top