when APT is looking for the wrong version of a package

I just set up my new Linode today, and got hit with a strange error: for certain packages (or dependencies), when I tried to install them, the package manager (apt-get or aptitude, I tried both) would look for the wrong version and complain about not finding it. For example, "aptitude install libpq4" yielded the error message Failed to fetch http://ftp.us.debian.org/debian/pool/main/p/postgresql-8.1/libpq4_8.1.8-1_i386.deb: 404 Not Found [IP: 35.9.37.225 80] … but when I went to that directory in a Web browser or searched on packages.debian.org, I saw that the most recent version of libpq4 was 8.1.11_0etch1. "aptitude update" did nothing to solve the problem.

I noticed that the offending version numbers were stored in the file "/var/lib/apt/lists/ftp.us.debian.orgdebiandistsstablemainbinary-i386Packages". Finally (after backing up my /var partition), I moved that file over to /var/tmp and ran "aptitude update" again, which finally did update things so that I could load the right versions.

Investigating more closely: the Packages file that had been preinstalled on the disk image had a timestamp of "Feb 26 08:52" (not sure how that happened…) but the one that had been freshly downloaded had a timestamp of "Feb 16 09:19". I could have made the same repair by running "touch" to roll back the file's time stamp and then running "aptitude update".

So, as Arlo Guthrie said, because you yourself may be in a similar situation (and because Googling for my particular combination of error messages didn't give me much of a clue), I thought I'd tell the story of how I recovered from it.

5 Replies

You did update apt, right?

$ sudo apt-get update

@sethg:

So, as Arlo Guthrie said, because you yourself may be in a similar situation (and because Googling for my particular combination of error messages didn't give me much of a clue), I thought I'd tell the story of how I recovered from it.
Could this have happened because you were in group w?

irgeek: I did "apt-get update" as well as "aptitude update", also "…upgrade", and "…dist-upgrade". I even tried "aptitude reinstall apt".

pclissold: One unusual thing that I did as soon as I got the machine is to create a new partition and then copy all of /var onto it. I'm wondering if that did something to screw up the timestamps.

@sethg:

pclissold: One unusual thing that I did as soon as I got the machine is to create a new partition and then copy all of /var onto it. I'm wondering if that did something to screw up the timestamps.
I'm afraid I was attempting humour, rather than help:

@Arlo Guthrie:

And I proceeded to tell him the story of the twenty seven eight-by-ten colour glossy pictures with the circles and arrows and the paragraph on the back of each one, and he stopped me right there and said, "Kid, I want you to go and sit down on that bench that says Group W …. NOW kid!!"

And I, I walked over to the, to the bench there, and there it is: Group W's where they put you if you may not be moral enough to join the army after committing your special crime, ….

@sethg:

One unusual thing that I did as soon as I got the machine is to create a new partition and then copy all of /var onto it. I'm wondering if that did something to screw up the timestamps.

Quite possibly. Did you use the -p or -a arguments when copying? (-p is short for –preserve=mode,owner,timestamps, -a is short for -dpR)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct