saving package list

Sundar Nagarajan sundar.personal at gmail.com
Sun Aug 31 19:08:09 BST 2008


Paul Hurley wrote:
> Does anyone know how to derive a list of installed packages directly 
> from the filesystem, not from a working system.  My Laptop died 
> recently, and I can extract the hard drive and mount it, but I can't 
> boot that installation.  Ideally I'd like to extract the list of 
> installed packages from it to install elsewhere ?
> 
> Thanks
> 
> Paul.
> 

Paul,

if your HDD is OK, and the contents of /var/lib/dpkg is fine, you can 
mount that directory and run:

dpkg --admindir=<DIR> --get-selections |  cut -d '	' -f1

to get the list of packages listed as installed by the dpkg database in 
<DIR>.

Note that <DIR> is a placeholder to be replaced by the directory where 
you mounted your old /var/lib/dpkg. Also note that the character between 
  single quotes after cut -d is a TAB > (enter it using CRTL-V, CTRL-TAB 
on the command line).

I haven't tried this myself - just found it listed in the dpkg man page.

If there are known differences between your old installed version and 
the version you are running to recover the list of installed packages, 
it should be fairly easy to run this command with ad without the 
--admindir option to compare the differences and be convinced that it's 
working correctly.

Sundar




More information about the kubuntu-users mailing list