How can I revert to a saved xorg.conf file from the terminal?

Asked by Nate King on 2007-03-18

My X server is not configured correctly and I need to revert to a saved xorg.conf. I am positive I made backups, but when I type in

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.mysave

It asks me for my password then dosen't do anything. Then, when I type in

sudo cp /etc/X11/xorg.conf.bak /etc/X11/xorg.conf

I get

cp: cannot stat ' /etc/x11/xorg.conf.bak ' : No such file or directory

What have I done wrong? Is there any other way to revert to a saved xorg.conf?

I feel bad asking this question again, but I havent found an answer anywhere I've looked. This is the third time I've tried to install beryl, and everytime I've made changes to the xorg.conf as discribed here:

I get the error that my X server is not configured correctly. In the past I have just re-installed ubuntu (I'm a new user and have not had it installed very long, reinstalling is not that big of a deal) but I'd like to avoid that if all possible.

Thanks for your help.

Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Solved by:
Nate King
Last query:
Last reply:
Mike Dahlgren (dahlgren) said : #1

The reason why it is saying "No such file or directory" is because you have no file on your computer called "/etc/X11/xorg.conf.bak". If you ran the backup previously as stated then the file that you are trying to restore from is called /etc/X11/xorg.conf.mysave. The way you would restore it would then be to issue the following:

 sudo /etc/X11/xorg.conf.mysave /etc/X11/xorg.conf

  This should ask you if it ok to over wright the current copy. If you are sure that's what you want to do, then hit "y", and restart X or the whole machine and you will be back in business.

   Good luck,
        ~ Mike

Nate King (nate7679) said : #2

I get this error when entering the command you gave me:

sudo: /etc/X11/xorg.conf.mysave: command not found

Simon Jenkinson (sjenks) said : #3

The command should be

sudo cp /etc/X11/xorg.conf.mysave /etc/X11/xorg.conf


Nate King (nate7679) said : #4

When I typed the command in, it asked me for my password then did nothing. When I rebooted it said that my x server was not configured correctly.

If it helps, at end of the X server output it says:

Fatal server error: no screens found

Carles Oriol (carlesoriol) said : #5

Press Ctrl + Alt + F1

Log in text mode


  sudo dpkg-reconfigure xserver-xorg

Benoit Malet (benoit-malet) said : #6

Hello !

When I look to the command you entered, it seems that you messed up with the order for the arguments of cp ... The correct syntax is "cp existing_file destination" ...

When I look at the first command you issued, I think that you overwrited your backuped file with your misconfigured one ...

It is normal that you don't see anything while copying ... If you want something displayed on screen, use cp -v (v stands for verbose)

So, I think you'll have to make as Carles suggested: sudo dpkg-reconfigure xserver-xorg

That should give you a basic (but working) xorg.conf file.


Nate King (nate7679) said : #7

Okay, I tried restoring my X server by going through the setup and I was able to do it correctly. At the end it said

xserver-xorg postinst warning: overwriting possibly-customized configuration file; backup in /etc/X11/xorg.conf.20070319071951

Is that saying that a backup was overwritten, or have I already overwritten all of those? I know I made atleast two.

But now that I have the GUI restored, will it be easier to overwrite the xorg.conf file with a backed up one, assuming I still have a backup?

Carles Oriol (carlesoriol) said : #8

you have them all.

Nate King (nate7679) said : #9

Alright, so should I look for my backed up copies in the /etc/X11/ directory? And then should I just open my xorg.conf and copy in the text from a backed up configuration file?

Also, what should I do in the future when installing beryl to avoid this problem? The guide instructed me to do this:

Add this to xorg.conf "Screen" section

# Enable 32-bit ARGB GLX Visuals
    Option "AddARGBGLXVisuals" "True"

# If you are using an older version of compiz that
# does not support rendering into the Composite
# Overlay Window, you will need to disable clipping
# of GLX rendering to the X Root window with this
# option, or you will get a blank screen after
# starting compiz:
    Option "DisableGLXRootClipping" "True"

Add this to xorg.conf "Device" section

Option "TripleBuffer" "true"

I added that in to the correct sections, with the spacing and everything, but every time I do that it gives me a problem.

Nate King (nate7679) said : #10

I tried

sudo cp /etc/X11/xorg.conf.mysave /etc/X11/xorg.conf

from the terminal with the GUI loaded, but when I reloaded the X server it gave me the same error that I need to reconfigure it.

Also, how come Beryl is installed and is able to run with this partially functioning X server?

Mike Dahlgren (dahlgren) said : #11

The problem seems that we don't know exactly what the backup copies of your xorg.conf file are. The best way is to list the content in the folder with the foolowing command:

ls /etc/X11/

or for just the xorg files with:

ls /etc/X11/xorg*

Even better you can see when they were last changed with

ls -alh /etc/X11/xorg*

Then choose the correct one and "copy" it with the cp command to where it should be with:

sudo cp /etc/X11/xorg.conf.(something) /etc/X11/xorg.conf

          ~ Mike

Best Nate King (nate7679) said : #12

Sorry for taking so long to respond.

That seemed to work. I found the backup I made right after I installed my Nvidia drivers, copied it over, and my x server started correctly.

Thank you all for your help

Nate King (nate7679) said : #13

Sorry for taking so long to respond.

That seemed to work. I found the backup I made right after I installed my Nvidia drivers, copied it over, and my x server started correctly.

Thank you all for your help