Reinstalling a system from package list?

Tom H tomh0665 at
Wed Apr 14 19:15:52 UTC 2010

On Wed, Apr 14, 2010 at 2:46 PM, Rashkae <ubuntu at> wrote:
> Maxime Alarie wrote:
>> Im just  curious if there is a way to reinstall a system from  the
>> output of dpkg -list
>> Let's say I have a crash, I reinstall the base system and then want to
>> reinstall all the packages I had  before the crash... I, like many
>> others I'm sure,  usually Install a system then proceed to install other
>> packages  along the way to suit  my  needs. But we do not keep a trace
>> of those  small packages installed for this dependency or that small
>> program we want to try..


You can use "dpkg -l" as shown in the link above or
Dump the package selection states to a file with
dpkg --get-selections > instselect.txt
Transfer that file to the new box and install the packages with
dpkg --clear-selections
dpkg --set-selections < instselect.txt

AFAIK, these two methods do not preserve the status
automatically-installed packages; everything ends up being registered
as a manual install.

I have not tried the following but it should preserve the automatic states.

Select the packages that are installed but not installed automatically with
aptitude search -F "%p" '~i!~M' > instman.txt
Transfer that file to the new box  and install the packages with
aptitude install `cat  instman.txt`
The previously-automatically-installed packages should be pulled in

More information about the ubuntu-users mailing list