Maintaining all packages when reinstalling the ubuntu OS?

Tom H tomh0665 at
Thu Jul 7 17:11:13 UTC 2011

On Thu, Jul 7, 2011 at 12:40 PM, Avi <lists at> wrote:
> dpkg --get-selections > somefile
> on the current machine, and then
> apt-get update
> dpkg --set-selections < somefile
> apt-get -u dselect-upgrade
> On the new machine. This wont transfer any configuration, though.

1. If you use "dpkg --get-selections > somefile", you have to use
"dpkg --clear-selections" before "dpkg --set-selections < somefile".

2. You can transfer the package configurations with
debconf-get-selections and debconf-set-selections.

3. You can also (and preferably) use "aptitude -F '%p' search
'?narrow(?installed,!?automatic')" rather than "dpkg --get-selections"
to get the list of installed packages because that'll preserve the
"~A" flag for the packages marked as installed automatically on the
original box.

More information about the ubuntu-users mailing list