Les en-têtes de apt-cacher ne sont pas forcément récupérés correctement et plantent alors le programme de nettoyage. Dans ce cas, le message d'erreur est :
Error: cannot open ../headers/debian_dists_stretch_main_binary-amd64_Packages.gz for locking: No such file or directory

Il est possible d'utiliser le script suivant pour générer les fichiers avant de lancer le nettoyage :
#!/bin/bash
touch /var/cache/apt-cacher/headers/security.debian.org_dists_{wheezy,jessie,stretch}_updates_InRelease
touch /var/cache/apt-cacher/headers/security.debian.org_dists_{wheezy,jessie,stretch}_updates_{main,non-free}_binary-{i386,amd64}_Packages{.bz2,.gz,}
touch /var/cache/apt-cacher/headers/security.debian.org_dists_{wheezy,jessie,stretch}_updates_{main,non-free}_source_Sources.{bz2,gz}
touch /var/cache/apt-cacher/headers/cric_dists_testing_Release{.gpg,}
touch /var/cache/apt-cacher/headers/cric_dists_testing_main_binary-{i386,amd64}_Packages{.bz2,.gz,}
touch /var/cache/apt-cacher/headers/proxmox_debian_dists_{jessie,stretch}_InRelease
touch /var/cache/apt-cacher/headers/proxmox_debian_dists_{jessie,stretch}_pve-no-subscription_binary-{i386,amd64}_Packages{.bz2,.gz,}
touch /var/cache/apt-cacher/headers/fournier38_dists_testing_Release{.gpg,}
touch /var/cache/apt-cacher/headers/fournier38_dists_testing_main_binary-{i386,amd64}_Packages{.bz2,.gz,}
touch /var/cache/apt-cacher/headers/dell_repo_community_ubuntu_dists_precise_Release{.gpg,}
touch /var/cache/apt-cacher/headers/dell_repo_community_ubuntu_dists_precise_openmanage_binary-{i386,amd64}_Packages{.bz2,.gz,}
touch /var/cache/apt-cacher/headers/ubuntu_dists_{precise,precise-updates,precise-backports}_{main,universe,restricted,multiverse}_Release{.gpg,}
touch /var/cache/apt-cacher/headers/ubuntu_dists_{precise,precise-updates,precise-backports}_{main,universe,restricted,multiverse}_source_Sources.bz2
touch /var/cache/apt-cacher/headers/ubuntu_dists_{precise,precise-updates,precise-backports}_{main,universe,restricted,multiverse}_binary-{i386,amd64}_Packages{.bz2,.gz,}
touch /var/cache/apt-cacher/headers/ubuntu_dists_{precise,precise-updates,precise-backports}_{main,universe,restricted,multiverse}_i18n_Index
touch /var/cache/apt-cacher/headers/ubuntu_dists_{precise,precise-updates,precise-backports}_{main,universe,restricted,multiverse}_i18n_Translation-en.bz2
touch /var/cache/apt-cacher/headers/debian_dists_{jessie,jessie-updates,stretch,stretch-updates,wheezy-backports,wheezy,wheezy-updates}_{main,non-free,contrib}_Release{.gpg,}
touch /var/cache/apt-cacher/headers/debian_dists_{jessie,jessie-updates,stretch,stretch-updates,wheezy-backports,wheezy,wheezy-updates}_{main,non-free,contrib}_source_Sources.{bz2,gz}
touch /var/cache/apt-cacher/headers/debian_dists_{jessie,jessie-updates,stretch,stretch-updates,wheezy-backports,wheezy,wheezy-updates}_{main,non-free,contrib}_binary-{i386,amd64}_Packages{.bz2,.gz,}
touch /var/cache/apt-cacher/headers/debian_dists_{jessie,jessie-updates,stretch,stretch-updates,wheezy-backports,wheezy,wheezy-updates}_{main,non-free,contrib}_i18n_Index
touch /var/cache/apt-cacher/headers/debian_dists_{jessie,jessie-updates,stretch,stretch-updates,wheezy-backports,wheezy,wheezy-updates}_{main,non-free,contrib}_i18n_Translation-en.bz2
touch /var/cache/apt-cacher/headers/debian_dists_{jessie,jessie-updates,stretch,stretch-updates,wheezy-backports,wheezy,wheezy-updates}_{main,non-free,contrib}_binary-{i386,amd64}_Packages.diff_{.bz2,.gz}
chown www-data:www-data /var/cache/apt-cacher/headers/*