apt-cacher downloading packages from invalid proxy cache

Bug #156652 reported by Gustav H Meyer on 2007-10-24
Affects Status Importance Assigned to Milestone
apt-cacher (Ubuntu)

Bug Description

Binary package hint: apt-cacher

Thanks for everyone involved in the apt-cacher product. It certainly is a huge bandwidth saver and is definitely the way to go when having multiple debian based servers and client machines in any organisation. I'm having problems today though whereby it seems that I'm getting an invalid or incomplete version of the latest thunderbird updates from transparent proxy servers out there on the internet and I'm trying to figure out how to handle this in a proper way in future. When doing the upgrade we get the following error:

# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  mozilla-thunderbird mozilla-thunderbird-typeaheadfind
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 10.8MB/10.9MB of archives.
After unpacking 28.7kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://MYAPT.HOST.NAME edgy-updates/main mozilla-thunderbird [10.8MB]
Fetched 10.8MB in 0s (11.5MB/s)
Failed to fetch http://MYAPT.HOST.NAME:3142/apt-cacher/archive.ubuntu.com/ubuntu/pool/main/m/mozilla-thunderbird/mozilla-thunderbird_1.5.0.13+ MD5Sum mismatch
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Client machine: Ubuntu 6.10 with kernel: 2.6.17-12-generic (We're having the same issues also with gutsy)
APT-CACHER server: Ubuntu 7.04 with kernel 2.6.20-15-server

When doing an md5sum of the thunderbird package on the apt-cacher server I do indeed get a different signature from the one in the package archives.

Actually there are two issues that I'm trying to address here:

1) How to clear the cached version of a invalid package on the apt-cacher repository
2) How to force a download on the client side without downloading from cache

The first issue I have dealt with by deleting the relevant header, private and package files in the /var/cache/apt-cacher/ directories and I have even removed the cached version on our own local squid-cache proxy server. It would be nice to have a way to do this directly through a special command on the client side.

The 2nd issue I tried to deal with by specifying options to download files without caching as follows:

apt-get upgrade -o Acquire::http::No-Cache=True

Debugging this with '-o Debug::Acquire::http=True' shows the actual request as follows:

GET /apt-cacher/archive.ubuntu.com/ubuntu/pool/main/m/mozilla-thunderbird/mozilla-thunderbird_1.5.0.13+ HTTP/1.1
Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Ubuntu APT-HTTP/1.3

Doing an ngrep on the apt-cacher server shows the request passed through to the proxy server as follows:

# ngrep -d eth0 -q -t -W byline -t '^(GET|PUT|POST) ' 'host MYAPT.HOST.IP'
interface: eth0 (##.###.###.#/255.255.###.#)
filter: (ip or ip6) and ( host MYAPT.HOST.IP )
match: ^(GET|PUT|POST)

T 2007/10/24 13:55:52.226467 MY.CLIENT.IP:50530 -> MYAPT.HOST.IP:3142 [AP]
GET /apt-cacher/archive.ubuntu.com/ubuntu/pool/main/m/mozilla-thunderbird/mozilla-thunderbird_1.5.0.13+ HTTP/1.1.
Connection: keep-alive.
User-Agent: Ubuntu APT-HTTP/1.3.

T 2007/10/24 13:55:52.299239 MYAPT.HOST.IP:49303 -> MYPROXY.HOST.IP:3128 [AP]
GET http://archive.ubuntu.com/ubuntu/pool/main/m/mozilla-thunderbird/mozilla-thunderbird_1.5.0.13+ HTTP/1.1.
Keep-Alive: 300.
Connection: Keep-Alive.
Host: archive.ubuntu.com.
User-Agent: libwww-perl/5.805.

Clearly the Cache-Control and Pragma headers are not passed through to the proxy server. Doing a download via wget with the no-cache option bypasses the cache as expected and I get a proper download with the correct md5sum:

$ wget -c -S --no-cache http://archive.ubuntu.com/ubuntu/pool/main/m/mozilla-thunderbird/mozilla-thunderbird_1.5.0.13+
$ md5sum mozilla-thunderbird_1.5.0.13+
1d5f09005f41d82b1fc8de6bbbbc704e mozilla-thunderbird_1.5.0.13+

Gustav H Meyer (inetpro) wrote :

The following (perhaps temporary) fix forces the cache to refetch the object:

# diff -u /usr/share/apt-cacher/apt-cacher.orig /usr/share/apt-cacher/apt-cacher
--- /usr/share/apt-cacher/apt-cacher.orig 2007-10-24 14:57:12.000000000 +0200
+++ /usr/share/apt-cacher/apt-cacher 2007-10-24 14:48:10.000000000 +0200
@@ -1587,7 +1587,7 @@
         $response = $ua->head($url);
     else {
- $response = $ua->get($url, ':content_cb' => \&get_callback, ':read_size_hint' => $getBufLen);
+ $response = $ua->get($url, ':content_cb' => \&get_callback, ':read_size_hint' => $getBufLen, 'Cache-Control' => 'no-cache', 'Pragma' => 'no-cache');

     if($do_hopping) {

Daniel T Chen (crimsun) on 2008-11-09
Changed in apt-cacher:
importance: Undecided → Low
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers