14

Is it possible to make apt update flush information/re-download information?

apt update does not suggest any additional arguments when tab-tabbing in the CLI and returns with E: The update command takes no arguments when adding garbage to see what happens.

Also, Debian's apt man-page did not provide any helpful clues: https://manpages.debian.org/buster/apt/apt.8.en.html

I made it work with the following steps, which seems like a bit of a workaround:

1: move away /etc/apt/sources.list.d/*.list files

2: run apt update; this appears to flush the cache of repositories that is no longer found in a .list file

3: move back /etc/apt/sources.list.d/*.list files

4: run apt update again; with this, information is downloaded from the repositories

Is there any way to do this without juggling .list files?

1 Answer 1

19

Yes, you can clear apt’s index by deleting all the files in /var/lib/apt/lists:

sudo rm /var/lib/apt/lists/*_* 

(all index files have underscores in their names, none of the directories in /var/lib/apt/lists do).

4
  • I will try this out as soon as I get a chance. Can you say anything additional as to whether this approach is recommended by the creators of apt - with a link to further information if possible? Or is it more of a homegrown solution? Commented Mar 28, 2020 at 14:58
  • 1
    Can confirm that this works as expected for my case. I did a bit more digging in the apt documentation and the closest I found to a mention of something similar to what is need was in the feature wishlist, and was apparently not very well received: bugs.debian.org/cgi-bin/bugreport.cgi?bug=873689 Commented Mar 30, 2020 at 13:42
  • Yes, I dug through the docs and couldn’t find anything... Commented Mar 30, 2020 at 13:44
  • If you are running apt upgrade and get 404 errors, this fix also works to solve that problem. Commented Jun 16, 2023 at 16:58

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.