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

Re: apt is killing my machine



On 2008-02-20 14:47 +0100, Zach wrote:

> Do you know if it's expected for installing packages to take longer
> the more total packages one has installed?

Yes.  The reason is that for every package installation dpkg has to read
the whole list of installed files from /var/lib/dpkg/info to see if a
file from the new to-be-installed package is contained in another.

> In recent months I notice
> sometimes when I install packages (sometimes one, sometimes many) the
> machine will be in nearly unusable state while it read's the package
> database.

That should not happen, though.  Does your hard disk use DMA?  If not,
then the high CPU load and long time would be understandable.

> Such as just happened:
>
> enetrek:~# apt-get upgrade
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> The following packages have been kept back:
>   mplayer
> The following packages will be upgraded:
>   linux-libc-dev
> 1 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
> Need to get 0B/720kB of archives.
> After unpacking 32.8kB disk space will be freed.
> Do you want to continue [Y/n]? Y
> (Reading database ... << At this point it hung for 20 minutes!

That's way too long, it should not need more than a minute (and normally
considerably less).

> << It then proceeded:
>
> 316137 files and directories currently installed.)

Quite a lot, consider removing some packages.  There is almost certainly
cruft which you haven't used for a long time.

> Preparing to replace linux-libc-dev 2.6.22-6 (using
> .../linux-libc-dev_2.6.22-6.lenny1_i386.deb) ...
> Setting up linux-libc-dev (2.6.22-6.lenny1) ...
> [ Rootkit Hunter version 1.3.0 ]
> File updated: searched for 151 files, found 131

I hope that Rootkit Hunter only checks the upgraded package and not the
whole disk during the upgrade!

> I'm  going to start using the time command with apt so I can get some
> hard data. My xload spiked up to near the very top for this entire
> time and then when apt finished it went back down to the bottom. I
> don't know if it is CPU or disk IO or a combination. I wonder if I can
> do anything to optimize apt so it will stop doing this?

Some tips:

- Check with hdparm that your hard disk uses DMA.
- Make sure your partitions do not fill up more than 90%, lest
  fragmentation will increase.
- Tar /var/lib/dpkg up, remove /var/lib/dpkg and restore the backup to
  defragment dpkg's database.

I'm not sure it will help much, though - your 20 minutes are really
abysmal and hard to explain.

> My machine is a P3/700MHz.

And how much RAM?  What does `free' say?

Sven


Reply to: