Ubuntu – Updating package index is very slow due to large ‘Contents’ entries

18.04aptupdates

When updating my package index, e.g. over apt update it always has to download some very large entries, usually 20 – 40 MB with a Contents-* prefix. This slows down the update process very much also due to the reason that it seems like these packages are fetched multiple times. Usually they are named something like Contents-i386 or Contents-amd64.

I'm absolutely not sure if this is normal, but I'm a Ubuntu user for quiet some years and can't remember, that index updates where that heavy in the past. The problem could be related to some configuration change I had to made in the past but I can't really remember what it was.

Best Answer

  • Probably, apt-file was installed at some point and its entry (or "trigger" if i can say) got set in /etc/apt/apt.conf.d/

    • You could keep apt-file and disable its config in apt, using this command:

        sudo sh /usr/share/doc/apt-file/examples/apt-file-2-update.sh --install
      

      or Manually by commenting the lines in /etc/apt/apt.conf.d/50apt-file.conf by prepending #.

      Then you can use apt update & apt-file update separately as needed (Separation of concerns).

    • Also you may tweak /etc/apt/apt-file.conf to set only needed indexes to be downloaded. Or Purge apt-file if not required any more.

    Reference: man apt-file