0

Each time I run apt update or with the -m option(a.k.a --fix-missing) I see that apt-file is trying to update its cache too.I have a slow internet connection and it takes so much to download more than 100MB of apt-file caches and when I'm in a hurry this is quite annoying.Is there any way to disable that temporarily?

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Parsa Mousavi
  • 1,020
  • 2
  • 14
  • 27

2 Answers2

2

Is there any way to disable that temporarily?

To prevent apt update from downloading Contents files temporarily, with apt-file’s default configuration, run it as follows:

sudo apt -o Acquire::IndexTargets::deb::Contents-deb::DefaultEnabled=false update

It may be more convenient to revert apt-file to its old behaviour, i.e. only have it update Contents files using apt-file update explicitly; to do so, run

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

See also /usr/share/doc/apt-file/README.md.gz on your system for details of the download trade-offs.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
0

Just found the solution.There's a file named 50apt-file.conf(50 is not important,that's just for taking priorities into account) in the /etc/apt/apt.conf.d directory in ubuntu.

Here's an excerpt of its contents:

Acquire::IndexTargets {
...
...
    # Configuration for downloading Contents files for
    # debian-installer packages (udebs).
    deb::Contents-udeb  {
        MetaKey "$(COMPONENT)/Contents-udeb-$(ARCHITECTURE)";
        ShortDescription "Contents-udeb-$(ARCHITECTURE)";
        Description "$(RELEASE)/$(COMPONENT) $(ARCHITECTURE) Contents (udeb)";

        flatMetaKey "Contents-udeb-$(ARCHITECTURE)";
        flatDescription "$(RELEASE) Contents (udeb)";
        KeepCompressed "true";
        PDiffs "true";
        DefaultEnabled "false";
    };
...
...
};

Moving that file temporarily to another directory gets the job done.Hope it helps the future readers.

Parsa Mousavi
  • 1,020
  • 2
  • 14
  • 27
  • 2
    `sudo sh /usr/share/doc/apt-file/examples/apt-file-2-update.sh --install` – nobody Jul 26 '20 at 10:38
  • @nobody Yeah that's a cleaner solution.Feel free to post it as an answer. – Parsa Mousavi Jul 26 '20 at 10:42
  • Feel free to change your answer or go to https://askubuntu.com/questions/1152885/updating-package-index-is-very-slow-due-to-large-contents-entries for upvote; we find the solution together. – nobody Jul 26 '20 at 18:53