sudo apt-get update failing - "could not open" list file due to "permission denied"

30,330

Solution 1

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

Solution 2

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

Share:
30,330

Related videos on Youtube

sisyphus
Author by

sisyphus

Updated on September 18, 2022

Comments

  • sisyphus
    sisyphus almost 2 years

    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.

  • SebMa
    SebMa over 4 years
    @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.
  • Dave Griffiths
    Dave Griffiths over 4 years
    Neither of these fixed my problem - had to do one level higher as mentioned here askubuntu.com/a/454899/839600
  • Zanna
    Zanna over 4 years
    @DaveGriffiths good to know - I wonder if things have changed... not sure how to investigate it
  • abaelter
    abaelter about 4 years
    This should be built into apt-get update