Package: apt-cacher Version: 1.7.22 Followup-For: Bug #461758 Here's a setup I've built to optimize my network use.
I have debdelta running every couple of hours to download deltas and create proper debs in /var/cache/apt/archives/ ``` [Unit] Description=Daily debdelta activity Documentation=man:debdelta(1) ConditionACPower=true After=network.target network-online.target systemd-networkd.service NetworkManager.service connman.service [Service] Type=oneshot ExecStartPre=/usr/bin/apt update -qq ExecStart=/usr/bin/debdelta-upgrade -v ExecStartPost=/usr/bin/debdelta-upgrade -v ``` Then, I have apt-cacher's cron job, slightly modified, to periodically import .debs from /var/cache/apt/archives/ ``` Run the report generator. # Hourly. # */5 * * * * root test -x /usr/share/apt-cacher/apt-cacher-report.pl && /usr/share/apt-cacher/apt-cacher-report.pl # Run the importer. # Hourly because a debdelta service runs separately at a frequent rate @hourly root test -x /usr/share/apt-cacher/apt-cacher-import.pl && /usr/share/apt-cacher/apt-cacher-import.pl /var/cache/apt/archives/ -r # Run the cache cleaner. # Weekly (Sunday) by default, but reduce the frequency if this is too # heavy duty for you. # Add -v to send root an email showing what the script has done. # 37 4 * * sun root test -x /usr/share/apt-cacher/apt-cacher-cleanup.pl && /usr/share/apt-cacher/apt-cacher-cleanup.pl ``` From the looks of it, it all seems to be working fine. Manually running the import script tells me that it has already imported the .debs into its cache. ``` rrs@chutzpah:/var/cache/apt-cacher$ sudo /usr/share/apt-cacher/apt-cacher-import.pl /var/cache/apt/archives/ -r [sudo] password for rrs: Importing from /var/cache/apt/archives/ Hard linking or copying package files from /var/cache/apt/archives/ to /var/cache/apt-cacher /var/cache/apt-cacher/headers/gdisk_1.0.6-1_amd64.deb already exists: skipping /var/cache/apt-cacher/headers/intel-media-va-driver_21.1.0+dfsg1-1_amd64.deb already exists: skipping ...snipped... /var/cache/apt-cacher/headers/sudo_1.9.5p1-1.1_amd64.deb already exists: skipping /var/cache/apt-cacher/headers/usb.ids_2021.01.26-1_all.deb already exists: skipping Done. 0 files imported 14:04 ♒♒♒ ☺ ``` But when I run `apt upgrade` on a different machine, which talks to this proxy, the proxy doesn't seem to be offering the .debs from the cache. Instead, it downloads those .debs from the internet. I did some investigation for an example deb and I see: ``` rrs@chutzpah:/var/cache/apt-cacher$ find . | grep libavcodec58 ./packages/deb.debian.org_debian/libavcodec58_4.3.1-8_amd64.deb ./headers/libavcodec58_4.3.1-6_amd64.deb ./headers/deb.debian.org_debian/libavcodec58_4.3.1-8_amd64.deb ./headers/libavcodec58_4.3.1-7_amd64.deb 14:06 ♒♒♒ ☺ ``` Can you please explain what is the difference of the same deb in ./packages/ vs ./headers/ folder ? When I import the .deb, it is imported to ./headers/ folder. But when I do an `apt upgrade` on a different machine, the proxy doesn't offer the cache. Instead, it downloads a new copy of the deb and puts it into the ./packages/ folder. Subsequent requests for the same file do get offered from the cache. But my ultimate goal is to squeeze every bit of the network I have. And for that I would like to make use of the `debdelta` setup I outlined above. -- System Information: Debian Release: bullseye/sid APT prefers unstable APT policy: (990, 'unstable'), (500, 'testing'), (500, 'stable'), (100, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.10.0-2-amd64 (SMP w/4 CPU threads) Kernel taint flags: TAINT_USER Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages apt-cacher depends on: ii debconf [debconf-2.0] 1.5.74 ii ed 1.17-1 ii init-system-helpers 1.60 ii libdpkg-perl 1.20.7.1 ii libfilesys-df-perl 0.92-6+b6 ii libio-interactive-perl 1.022-1 ii libio-interface-perl 1.09-2 ii libipc-shareable-perl 0.61-2 ii libnetaddr-ip-perl 4.079+dfsg-1+b5 ii libsys-syscall-perl 0.25-6 ii libwww-curl-perl 4.17-7+b1 ii libwww-perl 6.52-1 ii lsb-base 11.1.0 ii perl 5.32.0-6 ii update-inetd 4.51 Versions of packages apt-cacher recommends: ii libberkeleydb-perl 0.64-1+b1 ii libio-compress-lzma-perl 2.100-1 Versions of packages apt-cacher suggests: pn libfreezethaw-perl <none> ii libio-socket-inet6-perl 2.72-2.1 -- Configuration Files: /etc/cron.d/apt-cacher changed: */5 * * * * root test -x /usr/share/apt-cacher/apt-cacher-report.pl && /usr/share/apt-cacher/apt-cacher-report.pl @hourly root test -x /usr/share/apt-cacher/apt-cacher-import.pl && /usr/share/apt-cacher/apt-cacher-import.pl /var/cache/apt/archives/ -r 37 4 * * sun root test -x /usr/share/apt-cacher/apt-cacher-cleanup.pl && /usr/share/apt-cacher/apt-cacher-cleanup.pl -- debconf information: * apt-cacher/mode: daemon

