There is a complete background below (borne out of frustration) as to why I want to know this - but the basic question is how do I completely reset Xserver to the state it was in when I installed Ubuntu? I have searched over months for a way to do this and nothing has worked so far.

Thoughts on the general problem are also more than welcome. I am using Ubuntu-gnome 15.10. My linux/ubuntu knowledge is probably... "intermediate".

General Background

I (unfortunately) own a laptop with hybrid graphics (NVIDIA GeForce GTX 860M is the secondary GPU). This has given me no end of problems. I use Ubuntu Gnome, and have reinstalled it more times than I can count.

In the past I have tried to use the recommended Nvidia binary drivers package provided in Ubuntu. This does work initially, however, quite often a simple "apt-get upgrade" will break X and dump me at a black screen after boot. It is then almost impossible to recover as even purging all Nvidia packages and using ubuntu-drivers at the command line to change to nouveau (deleting the xorg.conf file too) doesn't seem to restore my graphics (even though that makes no sense... as surely that puts me back at the start?). I try all the available Nvidia packages (purging each time) but always end up at the black screen. I then reinstall Ubuntu Gnome and use the exact same Nvidia driver package, and it works!

This drives me insane. Purging Nvidia drivers and deleting xorg.conf doesn't seem to be enough somehow. Something about nvidia seems to linger and isn't fixed until I reinstall.


More recently I tried to install Bumblebee as a possible end to my problems (i.e. as an alternative to using the Nvidia drivers for the entire X session). I reverted my main driver to nouveau (in the additional drivers app provided in ubuntu) and installed bumblebee following the standard Ubuntu guide. It didn't work with my card ("cannot access secondary gpu could not load gpu driver"), so I tried to upgrade the Nvidia drivers that Bumblebee uses (again following the instructions). This broke X. I purged Bumblebee and all related packages and reverted to nouveau.

X is still broken! and strangly an Nvidia based xorg.conf file is being generated on each boot (I deleted it and it comes back) even though I have purged all Nvidia packages....?


As such, I want to know the most aggressive way I can simply reset Xserver and all associated packages each time this happense so I don't have to do a full reinstall. I want to know this for the future as it would be nice to at least be able to restore my system to a state where I can boot to a GUI and then try different options.


I have already seen this and this. The first is the most relevant, but doing that never works for me. Simply purging the Nvidia drivers doesn't seem to be enough. Something about Nvidia seems to linger (e.g. now when I have a magically reappearing Nvidia based xorg.conf file even though I have no nvidia packages installed).

2 Answers 2


Neither dpkg-reconfigure or X -configure have worked for me.

I had to delete my xorg.conf file and reboot the machine. After that, X seemed to automatically configure itself and I could finally see the GUI again.

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
sudo reboot
  • 1
    This worked for me. I was messing around with Graphics drivers, Window Managers, and themes. Took me two days to completely resolve these issues, this being the last one that fixed invisible JVM windows glitch.
    – chx101
    Commented Feb 6, 2022 at 13:11

Generally speaking you can reset xserver with

sudo dpkg-reconfigure xserver-xorg


sudo X -configure

But I've seen cases of people for which this didn't work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .