Restoring your previous xorg.conf file

Resurrecting your xserver by restoring your previous xorg.confA few days ago I installed Cedega on my portable with Ubuntu Linux installed on it. After installation I customized the application options / preferences and ran the test utility. The test revealed that my 3D Acceleration wasn’t working. I found that a crucial part to have working so I started fixing it.After a while I made a mistake and my (already highly customized) xorg.conf got re-written by all kinds of default settings. Since the xserver uses the file in order to start-up correctly you can imagine that my xserver crashed.In Ubuntu Linux the xorg.conf file makes a backup of it’s current state before it accepts getting edited or rewritten. This does not apply when you edit xorg.conf yourself though (editing with Vi or Gedit). So I got an backup waiting to be restored, with all my setting related to resolution, drivers, AIXGL/Compiz and so on. I’ll use my own example in order to explain how you can restore the previous xorg.conf file.After I rebooted Ubuntu Linux started up correctly until it came across xserver section. There the xserver crashed and I was presented with a terminal screen which kindly asked for my username.I logged in with my normal account and entered:

djons@tosh-empire:/$ cd /

This command brings you to the root of your system. If you enter:

djons@tosh-empire:/$ dir

You will see you are at the beginning point of the system.We need to proceed towards the xorg.conf location. Hit the following path in order to get there:

djons@tosh-empire:/$ cd /etc/X11

Note that X11 is with a capital X. All Linux distributions, UNIX variations and thus also Mac OS X feature this.When you are in the X11 directory you will see a file structure similar to this:

djons@tosh-empire:/etc/X11$ dirapp-defaults gdm xorg.conf Xsession.dapplnk rgb.txt xorg.conf~ Xsession.optionsconfig susewm xorg.conf.20060807011320 Xwrapper.configcursors X Xresourcesdefault-display-manager xinit xserverfonts xkb Xsession

You should pinpoint two files, they are the files with which we are going work:

xorg.confxorg.conf.?????????????

The question marks represents year, month, day and some more info. But the date is the most important since you can easily pick the most current back-upped version of xorg.conf before things went sour. So now it’s time to replace our corrupt xorg.conf with a previous working version.First of all we have to delete the current corrupted xorg file. To make this happen do the following terminal work:

djons@tosh-empire:/etc/X11$ sudo rm xorg.conf

Now we have to rename the back-upped version in order to get our installation working with icons and mouse. Do the following terminal work:

djons@tosh-empire:/etc/X11$ sudo mv xorg.conf.????????????? xorg.conf

We’re done. The only thing you have to do is restart your machine and wait till it’s done booting up the installation. In order to get your machine rebooting hit the on/off switch once or use the following command:

djons@tosh-empire:/etc/X11$ sudo shutdown -r now


35 thoughts on “Restoring your previous xorg.conf file

  1. I just effed up my xorg.conf a few days ago. The fact that you posted this not too long ago, and the chance I stumbled across your site is incredible. Thanks so much!!

    🙂

  2. I effed up my xorg several times in an attempt to correct an error and then again and again i effed it up, with the help of friends and family we all had a go at effing it up, but this little solution resolved it and now I have become the guru of linux in my family!
    I had just reached the stage where I lost hope and was contaplating returning to MS but this solution restored my love and pasion for linux.
    Long live opensource!

  3. Not sure if there’s a reason not to use it, but sudo cp /etc/X11/xorg.conf.?????.. /etc/X11/xorg.conf works as well.

  4. djons Man you are a real life saver. You are a very kind and good person. Your advice and easy to follow instructions have just saved and restored my beloved ubuntu (in just 1 minute) after I totally messed trying to install the latest ATI driver using envy (beware everyone if it tells you that your card is not supported).

    I can’t possibly thank you enough.

    Thanks a million man 🙂

  5. Great fix! Kubuntu would work great for a few days and then for no reason boot into a command line mode. I searched the internet for a while, but I couldn’t find anything that restored my GUI, until now. Thanks.

  6. You just saved my butt. Like everybody else, I screwed up my xorg.conf and was left with just a terminal window. Luckily the most recent backup I had was just a week ago, so I swapped it out and everything is working again. Thanks!

  7. Thank a lot! A real life Savior !!!

    I am a newb to linux, been using it for a week, and i’ve been trying to make my dual monitor display to work with the second monitor as an extension of the first one, by default it is working but as a mirror of the first screen…. so i messed up with my xorg.conf file and it wouldn’t boot anymore until i got your precious help!

    Thanks again,
    A Humble Nux Newbie

  8. Have you been able to fix the cedega – intel 855GM issue. I have a system that is comparable to yours and I can’t seem to get the 3D Accelleration working.

    Would you be so kind to post your xorg.conf file, or mail it to me?

    Thanks a lot!

  9. Wooow this was a real life saver!!!!
    I have added hope in Ubuntu because it is so easy to restore just by following your tutorial!!!
    thankyou so much

  10. I just totally screwed up Xubuntu I’d just installed on an old laptop. After installing Xubuntu decided to use a totally non standard H/V rate (the laptop’s TFT showed a quarter of the desktop in the bottom right hand corner of the screen with bits of the rest of the desktop in the wrong places, and when plugging in an external monitor that just come up with the message “Attention! Incorrect Horiz / Vert Frequency”. I then booted up Knoppix which worked fine (which I would use if Knoppix included the drivers for the AccessRunner USB ADSL modem, but unfortunatly it doesnt!), and copied /etc/X11/xorg.conf into /mnt/hda1/etc/X11/xorg.conf replacing the existing file. I thought this should work – oops nope I was wrong – all I got when rebooting with Xubuntu is it keep whinging that it’s missing the default font “fixed”, tried # out all the references to fonts – nothing, tried deleting Xorg.conf – same problem, tried to use dbpkg-reconfigure to reconfigure it still the same problem. In the end have given up and resorted to re-installing the entire linux distro again (grr…), this method does seem a really good way, but by using the CP command in another linux unfortunatly it over-wrote the xorg.conf file without bothering to create a backup (oh well I’ve learned from my mistake – keep xorg.conf safe!

  11. Thankyouthankyouthankyou….

    I am having an absolute nightmare trying to install and get a sensible screen resolution for my Nvidia GTX 7800 ~ and messing with my xorg.conf file with only half the requisite knowledge seems to have been a mistake! 🙂

  12. Thank you.

    Next, maybe a tutorial on how to properly write resolutions?

    I used the “cp” instead of “mv” so I still have a good backup of my .failsafe file

    Thanks again!

  13. thank you so much. I thought I was going to have to reinstall ubuntu. I lost the setting after extending the desktop onto a second monitor. thank you, thank you, thank you. 🙂

  14. I’m not sure exactly why but this blog is loading very slow for me.

    Is anyone else having this issue or is it a issue on my end?
    I’ll check back later on and see if the problem
    still exists.

  15. You’re so interesting! I don’t believe I’ve read through a single thing like that before.
    So good to find another person with some original thoughts on this topic.
    Seriously.. thanks for starting this up. This website is one thing that’s needed on the web,
    someone with a bit of originality!

Leave a reply to Ernestine Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.