When run apt-cacher-ng, and client will apper message like this and failed to download packages via apt-cacher-ng
E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/c/curl/libcurl3-gnutls_7.81.0-1ubu
ntu1.15_arm64.deb 503 Connection closed, check DlMaxRetries [IP: 192.168.1.254 3142]
The reason is the system file open limit, it needs to modify it, it needs to modify file /etc/security/limits.conf and add those lines
apt-cacher-ng soft nofile 102400
apt-cacher-ng hard nofile 102400
If your system is heavy loading server, it can increase those numbers, and not existed the system cat /proc/sys/fs/nr_open setting.
Write the limit nofile to /etc/init.d/apt-cacher-ng doesn’t work for me.
ref.
Unable to download anything from apt-cacher-ng proxy
Increase max open files for Ubuntu/Upstart (initctl)
js290
in /etc/apt-cacher-ng/acng.conf:
DnsCacheSeconds: -1
# DlMaxRetries: 2
If DlMaxRetries is default to 2, make sure ACNG is not caching DNS for the backend servers, i.e. force ACNG to do another DNS lookup for potentially different server that will not cause a http 503 error.