3

Is there a way to make my system go back to how it was when first installed ubuntu without doing the standard installation again? I want my packages, repositories, configuration files to go back to how it was when ubuntu 12.04 LTS was first installed.

Is that possible?

Wolfer
  • 2,174

1 Answers1

1

Edit:

Sadly dpkg or apt dosn't keep a log of what packages were installed / removed and when, as far as I know. The best shot here is to look through your .bash_history and try to find what you modifyed. (You do know that dpkg -l will show you all packages that are installed configured etc. right?)

To properly purge a package use:

apt-get remove --purge <package>

To reconfigure ALL packages on your system use the following command (as root):

dpkg -l | cut -d " " -f3 | xargs dpkg-reconfigure

Be aware that this will possibly take some time.

These tools are capable of getting a lot of configuration "reseted" but they are incapable of magic. If you messed up your system really bad then the best solution sometimes is to back-up everything and reinstall.


You can use dpkg-reconfigure <package-name> to "reset" most packages to their defaults; but no-one knows what you installed with your systems main install except you.

You could search for which packages a "default" installation puts on your machine and remove everything else, but then again we can't know what you installed with your system's base install.

Wolfer
  • 2,174
  • But my system knows what packages are installed into it. Can I at least run some commands to reconfigure all of them? My problem is that some configuration files that I deleted manually don't get created again. I tried all apt-get commands, purge, autoclean install(again) but they just refuse to be recreated. Is there a solution to that? (pretty annoying) P.S dpkg-reconfigure postgresql, postgresql is the annoying package, didn't do it. – Not Amused Jan 23 '13 at 19:57
  • Did you try to purge / reinstall postgre? (You'll want to back up the databses you have before that.) – Wolfer Jan 23 '13 at 20:13
  • Also you might search for your missing config and re-create it manually (restarting postgres after it). It's pretty voodoo, but it might work. – Wolfer Jan 23 '13 at 20:19
  • I did try purge/re-install. As I said I tried all I know with apt-get. I will now try the second option you listed in your edit. – Not Amused Jan 23 '13 at 20:25
  • root@pcomp:/home/deus# dpkg -l | cut -d " " -f3 | xargs dpkg-reconfigure dpkg-query: error: package name in specifier 'Desired=Unknown/Install/Remove/Purge/Hold' is illegal: character =' not allowed (only letters, digits and characters-+._') /usr/sbin/dpkg-reconfigure: Desired=Unknown/Install/Remove/Purge/Hold is not installed – Not Amused Jan 23 '13 at 20:29
  • 1
    Apt does log the history in /var/log/apt/history*: http://askubuntu.com/questions/21657/show-apt-get-installed-packages-history-via-commandline – Takkat Jan 23 '13 at 21:37