Why is apt-cache so slow?

Posted by Damn Terminal on Ask Ubuntu See other posts from Ask Ubuntu or by Damn Terminal
Published on 2014-06-06T17:32:46Z Indexed on 2014/06/11 3:47 UTC
Read the original article Hit count: 251

Filed under:
|

After upgrade to Trusty (14.04) from Saucy (13.10), all apt operations are very slow. Even those that do not include downloading anything, or connecting to any servers. For example, displaying the apt policy

# time apt-cache policy 

[...]

real    0m8.951s
user    0m5.069s
sys     0m3.861s

takes almost ten seconds! Mostly a weird lag right after issuing the command. And it's the same even if I issue the same command again.

On another system it doesn't take a tenth of a second

real    0m0.096s
user    0m0.070s
sys     0m0.023s

The other system is a little beefier but there was no noticeable difference before the upgrade.

It's the same with apt-get, anything apt-related. How do I find out the source of this lag and fix it?

Additional info:

# cat /etc/nsswitch.conf 

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat

hosts:          files dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

BTW is my understanding of how apt-cache works correct? It doesn't make any network connections when I run apt-cache policy, right?

In case I'm wrong and it matters, here are my sources https://gist.github.com/anonymous/02920270ff68e23fc3ec

© Ask Ubuntu or respective owner

Related posts about apt

Related posts about 14.04