39

For the last week or more, running sudo apt-get update culminates in error:

Reading package lists... Done
E: Failed to fetch http://au.archive.ubuntu.com/ubuntu/dists/xenial/main/dep11/Components-amd64.yml  
Could not open file /var/lib/apt/lists/partial/au.archive.ubuntu.com_ubuntu_dists_xenial_main_dep11_Components-amd64.yml.gz - open (13: Permission denied) [IP: 202.158.214.106 80]
E: Failed to fetch http://au.archive.ubuntu.com/ubuntu/dists/xenial-backports/main/dep11/icons-64x64.tar  Could not open file /var/lib/apt/lists/partial/au.archive.ubuntu.com_ubuntu_dists_xenial-backports_main_dep11_icons-64x64.tar.gz - open (13: Permission denied) [IP: 202.158.214.106 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.

Entering either of the 2 specified urls into a browser address bar results in a 'File not found' (404) error - but if I append .gz to both addresses, then the respective files can be downloaded.

However, having downloaded the 2 files, I then don't know how (or if) I can utilize them.

Seeking advice on how best to proceed.

Zanna
  • 70,465
sisyphus
  • 391

2 Answers2

57

The contents of that directory are partially downloaded lists (perhaps APT was interrupted?) which can be safely removed.

Start a root shell, being aware that you now have permission to do all kinds of damage to your system, so be careful (we need to do this because sudo rm errors out)

sudo -i

Remove the contents of the directory (type carefully) and exit the root shell:

rm /var/lib/apt/lists/partial/*
exit  

Then run an APT update to regenerate the package lists and check the problem is gone:

sudo apt update
Zanna
  • 70,465
  • @Zana On my system, removing the files in /var/lib/apt/lists/partial/ didn't solve the pb. I had to remove the /var/lib/apt/lists/partial/ directory. The sudo apt update recreates it anyway. – SebMa Mar 17 '20 at 11:16
  • 1
    Neither of these fixed my problem - had to do one level higher as mentioned here https://askubuntu.com/a/454899/839600 – Dave Griffiths Mar 27 '20 at 11:35
  • @DaveGriffiths good to know - I wonder if things have changed... not sure how to investigate it – Zanna Mar 27 '20 at 15:56
  • This should be built into apt-get update – abaelter Apr 14 '20 at 10:33
9

Solution nearest to @Zanna answer But include save old APT lists folder as backup first before delete partial file from APT lists folder.

First clean APT

sudo apt-get clean

Make backup APT list folder

sudo cp -r /var/lib/apt/lists /var/lib/apt/lists.old

Remove partial folder from APT List folder

sudo rm -rf /var/lib/apt/lists/partial/

Then clean and update APT

sudo apt-get clean
sudo apt-get update

Source from Ubuntu form post