[Aptitude-devel] Package state backup/restore

J.M.Roth lists+debianuser at roth.lu
Wed Apr 22 16:16:29 UTC 2009

Hi there,

for a while now I have been thinking about how to backup/restore a system
efficienly (i.e. without having to dump *everything*, including binaires, into
the backup).
The idea that comes to mind is to somehow backup the package system's metadata
and restore it to the destination.
Then, 'aptitude install' or alike should do the trick.

Now this issue has been raised on debian-user again, and I definitely want to
get to the bottom of this.

To what we made it over there was something along the lines of 

dpkg --get-selections | awk '$2 == "install"' > packagesNG_installed
aptitude -F '%p' search '~i~M' > packagesNG_autoinstalled
debconf-get-selections | grep -Ev '^[[:space:]]*(#|$)' > packagesNG_debconf

aptitude update
aptitude upgrade
dpkg --clear-selections
dpkg --set-selections < packagesNG_installed
debconf-set-selections < packagesNG_debconf
xargs -r -- aptitude markauto < packagesNG_autoinstalled
aptitude install # maybe use -q -f -y ?

Now I haven't come to experiment on this a lot (I am currently mirroring the
needed packages to be able to do this efficiently).
Before I start, I thought asking here might help.
So: any thoughts? ;-)


More information about the Aptitude-devel mailing list