where is the list of installed packages kept?

stan stanb at panix.com
Sun Jan 21 12:20:56 UTC 2007


On Sat, Jan 20, 2007 at 11:44:56AM -0800, Mitch Contla wrote:
> Derek Broughton said the following on 01/20/2007 10:14 AM:
> > stan wrote:
> >
> >   
> >> On Fri, Jan 19, 2007 at 03:05:05PM -0800, Mitch Contla wrote:
> >>     
> >>> stan said the following on 01/19/2007 12:24 PM:
> >>>       
> >>>> I'm rebuilding a machine, and I forget to get a list of the installed
> >>>> packages on the original one. I do howeverr have a tarball of the whole
> >>>> root filesystem on that machine.
> >>>>
> >>>> Where in that can I look for the list of installed .debs?
> >>>>
> >>>>   
> >>>>         
> >>> A quick look at some Debian docs, and a poke around my system looks like
> >>> package information is contained in /var/lib/dpkg/status. Once you
> >>> un-tar the file, you could try something like:
> >>>
> >>> $ cat /var/lib/dpkg/status | grep -B1 'ok installed' > selections
> >>>
> >>> >From there you could use sed an create something that could be recovered
> >>> using:
> >>>
> >>> $ sudo dpkg --set-selections < myselections
> >>> $ sudo apt-get -u dselect-upgrade
> >>>
> >>> See the Debian Reference; specifically: 6.3.4 Recover package selection
> >>> data and 6.4.9 Record/copy system configuration.
> >>>
> >>> Of course, others may know an easier way. Good Luck.
> >>>       
> >
> > That's best (or Peter's method) if you don't already have a list. 
> > Unfortunately everything is marked as manually installed.
> >
> > I run this in cron.weekly:
> >  aptitude search '~i !~M' | tr -s ' ' | cut -f 2 -d ' '  \
> >   >/etc/apt/installed.txt
> >
> > That creates a list of all the packages that have not been automatically
> > installed as dependencies.  When I built a new machine, I used:
> >
> >  $ sudo dpkg --set-selections < /etc/apt/installed.txt
> >  $ sudo aptitude install
> >
> > Now, if I remove any of these packages, their dependencies will be removed
> > automatically if not needed.
> >   
> I agree this might be a better alternative *if* the original system is
> available. Based on the original post, it appeared to me that the system
> was "rebuilt" with the original OS existing only as an archive of the
> file system. I think that limits the options.

For the record, Your assumption here is correct.

-- 
Unix is very simple, but it takes a genius to understand the simplicity.
(Dennis Ritchie)




More information about the ubuntu-users mailing list