Howto Reinstall all of currently installed packages in fresh Ubuntu install

Sponsored Link
People sometimes have to do a reinstall of their Ubuntu system for various reasons (been playing/experimenting with configuration/drivers/other packages or just because something is badly broken) but remembering all the extra packages you have installed can be a chore -- but here is the simple solution:
On your old system (assuming it is still working), start up Synaptic and go:

File-Save Markings and choose a file name along with a location (like a USB drive) that you can use when you have installed your new system and make sure you have checked “save full state, not just changes” option click on Save.

Screenshot-Save changes

This file contains a list of all your currently installed packages, and when you have installed and booted up your new system (and configured your repositories to the best for your location ) then start up Synaptic and go

File-Read Markings and point it at your saved file, and after that has completed then select Apply to kick off the download & installation of all of those packages you had installed previously!

There are also apt-get command line functions that achieve the same outcome, so those who don't have/use Synaptic can still do this.

You will still have to do any special configuration changes that you had on the old system, but at least all of the packages are now in the new system.

This is also very handy for moving to new hardware/duplicating setups etc.

Be aware that doing this between different Ubuntu versions may cause complications because some packages may not be in a later version or have different names.

Note:- Don't forget to backup your sources before you reinstall.

sudo cp /etc/apt/sources.list ~/sources.list.backup

Otherwise if you have added any PPAs or other sources, this tip won't work.

Full Credit Goes here

Sponsored Link

Related posts

25 thoughts on “Howto Reinstall all of currently installed packages in fresh Ubuntu install

  1. Oh man, this is awesome! Thanks for posting this. Very helpful as I’m installing Super Ubuntu on top of Intrepid tomorrow night and I want to be sure I get everything I had before.

    Thanks again!

  2. Seems like you have to click “Save full state, not only changes” check-box in Synaptic’s Save changes dialog-box.

  3. Thanks a lot !!!
    But, it would be great if all the packages can be taken a backup with proper dependency checks.

  4. This is one of those simple but pretty perls that made me add this RSS to my Google reader.

  5. You should really specify in the how-to that you have to check the “Save full state, not only changes” box when you save the current package list. I just tried this trick to copy my downloaded packages to a second computer and it didnt do anything. It’d have been tragic had I reformatted my computer…

  6. Now if there was only a way to backup only the ones that you’d added since a base install. So that you could use it after an upgrade and not end up pulling back in older kernels and things of that nature…

  7. There are two tools that have helped me in this situation that is worthy of mention: Remastersys and Reconstructor. Both can build a live cd/dvd off your current install in essence creating your own distro to reinstall or share with family or friends (if you choose not to backup your Home folder with all your private files of course.) The problem I found with AptonCD is it doesn’t backup my cache, so certain applications not attached to the official repos (buntu or deb) are not backed up. Hope this helps.


  8. I think APTonCD will help…

    You can burn all currently installed packages to a CD and later transfer them to the new machine 🙂


  9. How to this via apt-get?

    You mentioned that it can be done, but didn’t tell how to achieve this…

  10. Funny, usually the only reason I “re-install” Linux ever is because I have too much crap on my machine. Things that looked cool so I installed, played with it for a few days and then forgot about. I rarely want to re-install all (any?) of that stuff.

    For me at least, it is very therapeutic to “start fresh” when things get bogged down. I make sure I save off all configs (usually just keep a copy of /etc is sufficient) and re-install. The stuff I added to the system which I use all of the time will missing and obvious right off the bat. But installation is (usually) dead simple and quick with package managers they way they are today. The stuff I never touched after initial install/play time will be gone and I will be none the wiser and I get some system resources (even if it is just disk space) back that I never knew I had.

  11. Hello,

    what I use (from command line (in my backup scripts)) is this:
    dpkg --get-selections > /var/backups/dpkg-selections.txt
    debconf-get-selections > /var/backups/debconf-selections.txt

    The second line requires debconf-utils to be installed.

    after installation of a new sytem you can then simply feed them back using:
    debconf-set-selections debconf-selections.txt
    dpkg --set-selections < dpkg-selections.txt


  12. Does Jens’ idea using debconf work when upgrading? i.e. can I backup details of my currently installed packages and then reinstall them after upgrading to the latest release?

  13. As krsfer said…. you MUST check “save full state, not just changes”. I found out that simply launching Synaptic and doing the “save markings” thing but WITHOUT check marking the “save full state…” option will produce a zero byte file, totally empty. Would be quite annoying if you went to recover by reading from a zero byte file. I’d suppose that “apt-get” will need similar instructions.

    Be a good lad, add the “save full state, not just changes” information to the main article.

  14. Thanks But it does not work if packages are missing pieces, which is an ongoing issue for me.

  15. Just one problem. /etc/apt/sources.list does not contain ‘addresses’ of ppa’s. They seem to be contained as 1 line entries (e.g. deb precise main) each in their own file (e.g. alanbell-unity-precise.list) in directory /etc/apt/sources.list.d. There needs to be some means (rather than copying all these files to a home directory) of being able to recreate them if necessary from some file containing the 1 line entries (which is created by?). Any ideas?

Leave a comment

Your email address will not be published. Required fields are marked *