Backup and Restore list of installed packages and APT sources
A slight variation on Installing packages by importing the list with dpkg --set-selections should do the trick.
Save the list of packages on your reference system:
dpkg --get-selections > packages.lst
Then install packages based on that list on your target system, after updating the list of available packages:
dpkg --merge-avail <(apt-cache dumpavail)
dpkg --clear-selections
dpkg --set-selections < packages.lst
apt-get dselect-upgrade
Related videos on Youtube
Community
Updated on September 18, 2022Comments
-
Community over 1 year
I commonly reinstall Ubuntu and back up my APT stuff [sources, keys and installed package lists] using the tutorial at https://askubuntu.com/a/99151/371765. However I commonly also remove software such as totem, transmission, unity scopes, etc.
When the install has finished and I restore my APT sources, keys, and installed packages from the previous install, I find I get the following:
- I get a warning saying
dpkg: warning: package not in database at line ###: vlc
[vlc is an example, it could behtop
oriotop
]. I think it does this warning for every package to restore in the universe repos, however I am not too sure. - Anything uninstalled [totem, transmission, firefox, simple-scan, etc] on the previous system stays installed on the new system.
How can I make it so that anything uninstalled from the previous system gets uninstalled on the new system during installation of other packages [eg vlc]?
I have a made a start with diff plans, however when trying to convert version numbers to the word "test" [for testing purposes] in the Ubuntu 14.04.2 manifest, it converts all of the line and not a portion of it.
-
terdon about 9 yearsPlease don't cross-post. Thanks for pointing it out but please delete the copies from AU and SU.
- I get a warning saying
-
Admin about 9 yearsI'll try that the next time I (re)install Ubuntu/Ubuntu distro
-
Admin about 9 yearsWhen running
sudo dpkg --merge-avail <(apt-cache dumpavail)
[sudo needed for write access], this error comes up:Updating available packages info, using /dev/fd/63. dpkg: error: failed to open package info file /dev/fd/63 for reading: No such file or directory
. Any ideas why? Freshly installed system. EDIT: The third command does what 1. says in the question, probably because the first command failed. -
Stephen Kitt about 9 yearsYou need to run the command substitution within the same shell as
dpkg
, so either become root beforehand, or runsudo bash -c "dpkg --merge-avail <(apt-cache dumpavail)"
. -
cmcginty almost 6 yearsI was looking for a way to do a partial list. This is NOT it.