[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg --getselections, apt, and update-menus



Joachim Trinkwitz <jtr@uni-bonn.de> wrote:
>cjw44@flatline.org.uk (Colin Watson) writes:
>> I don't think that's what Sean meant. If, in dselect, you use '-' to
>> mark a package for removal - or use 'apt-get remove' - then a package's
>> configuration files won't be removed, and some state about the package
>> will remain in the system. However, if you use '_' in dselect, or
>> 'apt-get --purge remove', then the package's configuration files will be
>> removed too, and /var/lib/dpkg/status will forget that it ever existed.
>
>Getting OT: That's not quite correct. The `Package:', `Status:',
>`Priority:' and `Section:' entries of a purged package remains
>forever, so the status file grows on and on over the years and keeps
>even entries of packages which no longer exists.

Oops, yes, I must have got confused about that; sorry for the
misinformation. In fact, looking at the source, 'dpkg --get-selections'
simply lists the desired state of all packages except those which are
already in the not-installed state.

>I wonder if this slows down the installation process and if `purging'
>the status file from those purged package entries would help, but I
>didn't dare that as yet.

You could try 'dpkg --forget-old-unavail', which removes entries from
the status file which are not installed and no longer available. On my
system that only reduced the size of the status file by about 30K, but
the last time I ran that command was only a few months ago.

I suspect that reading the status file doesn't actually take all that
long; the most time-consuming part (though I've never profiled it to
find out) is probably reading the lists of files in each package to make
sure they aren't accidentally overwritten. Since each package's file
list is kept in a separate file in /var/lib/dpkg/info, it takes a lot of
system calls to do this, which is slow. Also, /var/lib/dpkg/info is very
large on most systems, and the ext2 filesystem searches through such
directories linearly (hence slowly).

-- 
Colin Watson                                     [cjw44@flatline.org.uk]



Reply to: