0

I am running Ubuntu 20.04. I connect to internet via mobile phone with monthly data limit. When I run

apt update

it fetches about 60 MB data from repositories. Is there a way to only fetch the diff between previous running of apt update?

EDIT:

sudo apt update 
Hit:1 http://archive.canonical.com/ubuntu focal InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-security InRelease [109 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main Sources [364 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/multiverse Sources [9,912 B]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/restricted Sources [10.1 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/universe Sources [146 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [795 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main Translation-en [192 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates amd64 Contents (deb) [29.7 MB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [143 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [21.3 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [736 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [152 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [16.9 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-updates/multiverse Translation-en [5,076 B]
Get:19 http://archive.ubuntu.com/ubuntu focal-security/universe Sources [42.9 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-security/main Sources [122 kB]   
Get:21 http://archive.ubuntu.com/ubuntu focal-security/restricted Sources [8,960 B]
Get:22 http://archive.ubuntu.com/ubuntu focal-security/main amd64 Packages [480 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal-security/main Translation-en [105 kB]
Get:24 http://archive.ubuntu.com/ubuntu focal-security amd64 Contents (deb) [23.6 MB]
Get:25 http://archive.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [120 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal-security/restricted Translation-en [17.6 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [532 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [532 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal-security/universe Translation-en [74.5 kB]

Take a look at these :

Get:12 http://archive.ubuntu.com/ubuntu focal-updates amd64 Contents (deb) [29.7 MB]

Get:24 http://archive.ubuntu.com/ubuntu focal-security amd64 Contents (deb) [23.6 MB]
7
  • 60 MB? The official repositories' Packages and Release files only total about 15MB or so (compressed).
    – muru
    Feb 1, 2021 at 11:08
  • @muru I updated my question and posted apt update result.
    – kenn
    Feb 1, 2021 at 11:39
  • sudo apt purge apt-file
    – nobody
    Feb 1, 2021 at 11:45
  • @nobody, right I have installed apt-file but I need it.
    – kenn
    Feb 1, 2021 at 11:49
  • 1
    Please try this. askubuntu.com/questions/1152885/… I have no Idea what debian makes different from ubuntu. there I habe apt-file and never such large download size.
    – nobody
    Feb 1, 2021 at 12:00

1 Answer 1

2

As @nobody has alluded to, these big files that you’re downloading are coming from apt-file. Based on the docs, you can configure this by modifying the /etc/apt/apt.conf.d/50apt-file.conf file and running /usr/share/doc/apt-file/examples/apt-file-2-update.sh.

From there, you can set up a local cache for these .deb files with something like:

$ mkdir -p ~/.cache/apt-file ~/.config
$ touch ~/.cache/apt-file/dpkg-status
$ sed '/^Dir::State/ d; /^Dir::Cache/ d;' \
       /usr/share/doc/apt-file/examples/apt-file.conf \
       > ~/.config/apt-file.conf
$ cat <<EOF >> ~/.config/apt-file.conf
       Dir::State "$HOME/.cache/apt-file";
       Dir::Cache "$HOME/.cache/apt-file";
       Dir::State::status "$HOME/.cache/apt-file/dpkg-status";

From there you could update the apt-file cache independently from apt by calling:

$ apt-file -c ~/.config/apt-file.conf update

This was taken directly from the manpage, so some tweaking may be required.

2
  • 1
    Thank you @Matigo. Running sudo sh /usr/share/doc/apt-file/examples/apt-file-2-update.sh --install works. I just tried apt update, it only fetched 900KB of data.
    – kenn
    Feb 1, 2021 at 12:53
  • Running apt-file -c ~/.config/apt-file.conf update gave errors: Reading package lists... Error! E: List directory /$HOME/.cache/apt-file/lists/partial is missing. - Acquire (2: No such file or directory) E: flAbsPath on /$HOME/.cache/apt-file/$HOME/.cache/apt-file/dpkg-status failed - realpath (2: No such file or directory) E: Could not open file - open (2: No such file or directory) E: Problem opening E: The package lists or status file could not be parsed or opened.
    – kenn
    Feb 1, 2021 at 13:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .