#1031283 apt-cacher-ng: 503 errors while installing many packages

Package:
apt-cacher-ng
Source:
apt-cacher-ng
Description:
caching proxy server for software repositories
Submitter:
Blomley, Edmund (IBPT)
Date:
2025-08-18 18:21:01 UTC
Severity:
normal
#1031283#5
Date:
2023-02-14 14:50:59 UTC
From:
To:
Dear Maintainer,

With the above version of apt-cacher-ng we encounter a bug while installing
packages. (In our scenario the apt-cacher-ng itself runs in a Docker image
based on ubuntu:jammy-20230126 (22.04 LTS)).

The below error message happens for many packages (below is a more complete
log):

E: Failed to fetch
http://archive.ubuntu.com/ubuntu/pool/main/a/automake-1.16/automake_1.16.1-4
ubuntu6_all.deb  503  Connection closed, check DlMaxRetries [IP: x.x.x.x
3142]

This occurs reproducibly in scenarios where many packages will be installed
at a time (in our case while building docker images). This behaviour is not
100% reproducible and might not occur if only a low number of packages is
being installed. It also sometimes works without issues for a large number
of packages. But most of the times starts failing after 40-60 packages.

The only reliable workaround we found was "downgrading" the apt-cacher-ng
version to 3.6.4 (based on Debian 11, docker image
debian:bullseye-20230208). There is also an open bug report on the ubuntu
bug tracker:
https://bugs.launchpad.net/ubuntu/+source/apt-cacher-ng/+bug/1960264 but it
does not only occur with PPAs, but also regular repositories.

Below is the more detailed log for a situation with a low amount of packages
being installed.

[...]
0 upgraded, 63 newly installed, 0 to remove and 4 not upgraded.
Need to get 26.7 MB of archives.
After this operation, 133 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libssl1.1
amd64 1.1.1f-1ubuntu2.17 [1322 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libpython3.8-minimal amd64 3.8.10-0ubuntu1~20.04.6 [717 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libexpat1
amd64 2.2.9-1ubuntu0.6 [74.6 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
python3.8-minimal amd64 3.8.10-0ubuntu1~20.04.6 [1901 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/main amd64 python3-minimal
amd64 3.8.2-0ubuntu2 [23.6 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/main amd64 mime-support all
3.64ubuntu1 [30.6 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/main amd64 libmpdec2 amd64
2.4.2-3 [81.1 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/main amd64 readline-common all
8.0-4 [53.5 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 libreadline8 amd64
8.0-4 [131 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libsqlite3-0 amd64 3.31.1-4ubuntu0.5 [549 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libpython3.8-stdlib amd64 3.8.10-0ubuntu1~20.04.6 [1675 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8
amd64 3.8.10-0ubuntu1~20.04.6 [387 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal/main amd64 libpython3-stdlib
amd64 3.8.2-0ubuntu2 [7068 B]
Get:14 http://archive.ubuntu.com/ubuntu focal/main amd64 python3 amd64
3.8.2-0ubuntu2 [47.6 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
perl-modules-5.30 all 5.30.0-9ubuntu0.3 [2739 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal/main amd64 libgdbm6 amd64
1.18.1-5 [27.4 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal/main amd64 libgdbm-compat4
amd64 1.18.1-5 [6244 B]
Get:18 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libperl5.30
amd64 5.30.0-9ubuntu0.3 [3951 kB]
Get:19 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 perl amd64
5.30.0-9ubuntu0.3 [224 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 openssl
amd64 1.1.1f-1ubuntu2.17 [622 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
ca-certificates all 20211016ubuntu0.20.04.1 [141 kB]
Get:22 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
python3-pkg-resources all 45.2.0-1ubuntu0.1 [130 kB]
Get:23 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libkrb5support0 amd64 1.17-6ubuntu4.2 [31.0 kB]
Get:24 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libk5crypto3 amd64 1.17-6ubuntu4.2 [80.0 kB]
Get:25 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libkeyutils1 amd64 1.6-6ubuntu1.1 [10.3 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libkrb5-3
amd64 1.17-6ubuntu4.2 [330 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libgssapi-krb5-2 amd64 1.17-6ubuntu4.2 [121 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal/main amd64 libpsl5 amd64
0.21.0-1ubuntu1 [51.5 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libbrotli1
amd64 1.0.7-6ubuntu0.1 [267 kB]
Get:30 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libroken18-heimdal amd64 7.7.0+dfsg-1ubuntu1.4 [42.5 kB]
Get:31 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libasn1-8-heimdal amd64 7.7.0+dfsg-1ubuntu1.4 [181 kB]
Get:32 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libheimbase1-heimdal amd64 7.7.0+dfsg-1ubuntu1.4 [30.4 kB]
Get:33 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libhcrypto4-heimdal amd64 7.7.0+dfsg-1ubuntu1.4 [88.1 kB]
Get:34 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libwind0-heimdal amd64 7.7.0+dfsg-1ubuntu1.4 [47.7 kB]
Get:35 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libhx509-5-heimdal amd64 7.7.0+dfsg-1ubuntu1.4 [107 kB]
Get:36 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libkrb5-26-heimdal amd64 7.7.0+dfsg-1ubuntu1.4 [207 kB]
Get:37 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libheimntlm0-heimdal amd64 7.7.0+dfsg-1ubuntu1.4 [15.1 kB]
Get:38 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libgssapi3-heimdal amd64 7.7.0+dfsg-1ubuntu1.4 [96.5 kB]
Get:39 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libsasl2-modules-db amd64 2.1.27+dfsg-2ubuntu0.1 [14.7 kB]
Get:40 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libsasl2-2
amd64 2.1.27+dfsg-2ubuntu0.1 [49.3 kB]
Get:41 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libldap-common all 2.4.49+dfsg-2ubuntu1.9 [16.6 kB]
Get:42 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libldap-2.4-2 amd64 2.4.49+dfsg-2ubuntu1.9 [155 kB]
Get:43 http://archive.ubuntu.com/ubuntu focal/main amd64 libnghttp2-14 amd64
1.40.0-1build1 [78.7 kB]
Get:44 http://archive.ubuntu.com/ubuntu focal/main amd64 librtmp1 amd64
2.4+20151223.gitfa8646d.1-2build1 [54.9 kB]
Get:45 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libssh-4
amd64 0.9.3-2ubuntu2.2 [170 kB]
Get:46 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libcurl4
amd64 7.68.0-1ubuntu2.15 [235 kB]
Get:47 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 curl amd64
7.68.0-1ubuntu2.15 [161 kB]
Get:48 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
libcurl3-gnutls amd64 7.68.0-1ubuntu2.15 [232 kB]
Get:49 http://archive.ubuntu.com/ubuntu focal/main amd64 liberror-perl all
0.17029-1 [26.5 kB]
Get:50 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 git-man all
1:2.25.1-1ubuntu3.8 [886 kB]
Get:51 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 git amd64
1:2.25.1-1ubuntu3.8 [4538 kB]
Err:52 http://archive.ubuntu.com/ubuntu focal/main amd64 libassuan0 amd64
2.5.3-7ubuntu2
  503  Connection closed, check DlMaxRetries [IP: x.x.x.x 3142]
Ign:53 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpgconf
amd64 2.2.19-3ubuntu2.2
Ign:54 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpg amd64
2.2.19-3ubuntu2.2
Err:55 http://archive.ubuntu.com/ubuntu focal/main amd64 pinentry-curses
amd64 1.1.0-3build1
  503  Connection closed, check DlMaxRetries [IP: x.x.x.x 3142]
Err:56 http://archive.ubuntu.com/ubuntu focal/main amd64 libnpth0 amd64
1.6-1
  503  Connection closed, check DlMaxRetries [IP: x.x.x.x 3142]
Ign:57 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpg-agent
amd64 2.2.19-3ubuntu2.2
Get:58 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64
python-pip-whl all 20.0.2-5ubuntu1.7 [1805 kB]
Ign:59 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
python3-lib2to3 all 3.8.10-0ubuntu1~20.04
Ign:60 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
python3-distutils all 3.8.10-0ubuntu1~20.04
Get:61 http://archive.ubuntu.com/ubuntu focal-updates/main amd64
python3-setuptools all 45.2.0-1ubuntu0.1 [330 kB]
Get:62 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64
python3-wheel all 0.34.2-1ubuntu0.1 [23.9 kB]
Get:63 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64
python3-pip all 20.0.2-5ubuntu1.7 [230 kB]
Get:53 http://security.ubuntu.com/ubuntu focal-updates/main amd64 gpgconf
amd64 2.2.19-3ubuntu2.2 [124 kB]
Get:54 http://security.ubuntu.com/ubuntu focal-updates/main amd64 gpg amd64
2.2.19-3ubuntu2.2 [482 kB]
Get:57 http://security.ubuntu.com/ubuntu focal-updates/main amd64 gpg-agent
amd64 2.2.19-3ubuntu2.2 [232 kB]
Get:59 http://security.ubuntu.com/ubuntu focal-updates/main amd64
python3-lib2to3 all 3.8.10-0ubuntu1~20.04 [76.3 kB]
Get:60 http://security.ubuntu.com/ubuntu focal-updates/main amd64
python3-distutils all 3.8.10-0ubuntu1~20.04 [141 kB]
Fetched 26.6 MB in 1s (19.6 MB/s)
E: Failed to fetch
http://archive.ubuntu.com/ubuntu/pool/main/liba/libassuan/libassuan0_2.5.3-7
ubuntu2_amd64.deb  503  Connection closed, check DlMaxRetries [IP: x.x.x.x
3142]
E: Failed to fetch
http://archive.ubuntu.com/ubuntu/pool/main/p/pinentry/pinentry-curses_1.1.0-
3build1_amd64.deb  503  Connection closed, check DlMaxRetries [IP: x.x.x.x
3142]
E: Failed to fetch
http://archive.ubuntu.com/ubuntu/pool/main/n/npth/libnpth0_1.6-1_amd64.deb
503  Connection closed, check DlMaxRetries [IP: x.x.x.x 3142]
E: Unable to fetch some archives, maybe run apt-get update or try with
--fix-missing?

#1031283#10
Date:
2025-07-19 12:41:00 UTC
From:
To:
Hi,

I have also run into this when using deb.debian.org as a package source, switching to a direct mirror (for me, linuxsoft.cern.ch/debian ) fixed this.

Hope this helps,

Cheers,
Nikos

#1031283#15
Date:
2025-08-18 16:23:09 UTC
From:
To:
Dear Maintainer,

my observation is independently of the repository.
That bug exists at least since 1 or 2 years.

apt-cacher-ng runs for about 10 minutes, then that error 503 occurs, when running an "apt update" or "apt upgrade".
It seems to be unpredictably and randomly.

Running "systemctl restart apt-cacher-ng.service" and starting apt again helps for about the next 10 minutes.
If the uprade process lasts longer, we have to repeat that many times.
After some circles we are successfully with the upgrade process.

#1031283#20
Date:
2025-08-18 16:32:31 UTC
From:
To:
Fehl:4 http://192.168.0.10:3142/deb.opera.com/opera-stable stable InRelease
  503  Cannot allocate memory [IP: 192.168.0.10 3142]
Fehl:1 http://192.168.0.10:3142/brave-browser-apt-nightly.s3.brave.com stable InRelease
  503  Cannot allocate memory [IP: 192.168.0.10 3142]