Quantcast
Channel: Debian User Forums
Viewing all articles
Browse latest Browse all 3567

General Questions • [Solved] sudo apt upgrade errors

$
0
0
I restored my original sources.list file as suggested and things are still working fine.
Thanks for your feedback an confirmation.
May you please recap the cause and the preferred solution ?
Hello @Aki, of course.

When we run apt update, APT compares the local Release files in /var/lib/apt/lists/ with the remote Release files on the server.
APT does this simply by comparing the timestamps of the Release files. Only timestamps are taken into account, this relies on a simple HTTP mechanism, not, for example, file checksums.
If the local Release file is older than the remote file, APT downloads the new Release file and then the Package files. The timestamp of these local files is that of the server.

If APT downloads a new Release file but for some reason does not download the corresponding Package files, the old Package files remain until a new Release file on the server (with a newer timestamp than the local one) gives a chance to correct the situation, there is no checking mechanism (I point out that why-pkg -x detects this situation). This isn't really a problem for repositories that change frequently like the security repository, but it is for repositories like the main repository that may remain unchanged for weeks or even months.

This is the direct cause of problems like the one in this topic. The root cause, however, is still unknown. What causes APT to fail to download (or maybe, more likely, copy from a temporary location?) Package files after successfully downloading a Release file? And this without triggering an error or warning? Hard to know without being able to reproduce the problem.

The root cause is difficult to know, the direct cause is easier to find, and the solution, once the problem is detected, is really simple. Anything that can trigger a normal sequence, that is, make APT download the Release file which should be followed by the download of the Package files:
  • touch the relevant Release file with an older date than the one on the server should work according to the above observation (not confirmed though)
  • rm the relevant Release file
  • mv /var/lib/apt/lists/ /var/lib/apt/lists-BACK/
  • apt distclean (apt >= 2.7.8 i.e. currently in testing and unstable)
  • as seen in this thread, by modifying the source of the relevant Release file
Solutions 3 and 4 are probably the simplest for those who don't want to delve further. I'm interested in feedback on solution 1. Solution 5 is probably not really wanted.

Statistics: Posted by fabien — 2024-10-15 21:59 — Replies 11 — Views 392



Viewing all articles
Browse latest Browse all 3567

Trending Articles