39

I am using Ubuntu 20.04.3 LTS. I've been facing an error for 2 days that is, I can't update or upgrade or perform package installs on my system because of the following errors:

Hit:1 http://packages.microsoft.com/repos/code stable InRelease                                                                   
Hit:2 http://archive.canonical.com/ubuntu focal InRelease                                                                         
Hit:3 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease                                                              
Hit:4 http://dl.google.com/linux/chrome/deb stable InRelease                                                                      
Ign:5 http://old-releases.ubuntu.com/ubuntu focal InRelease                                                                       
Ign:6 http://old-releases.ubuntu.com/ubuntu focal-updates InRelease                                                               
Hit:7 http://ppa.launchpad.net/kicad/kicad-5.1-releases/ubuntu focal InRelease                                                    
Hit:8 https://deb.opera.com/opera-stable stable InRelease                                                                         
Hit:9 https://packages.microsoft.com/repos/vscode stable InRelease                                                                
Ign:10 http://old-releases.ubuntu.com/ubuntu focal-backports InRelease                                                            
Ign:11 http://ppa.launchpad.net/team-gcc-arm-embedded/ppa/ubuntu focal InRelease                                           
Ign:12 http://old-releases.ubuntu.com/ubuntu focal-security InRelease                                                      
Err:14 http://old-releases.ubuntu.com/ubuntu focal Release                                                                        
  404  Not Found [IP: 91.189.88.247 80]
Err:15 http://ppa.launchpad.net/team-gcc-arm-embedded/ppa/ubuntu focal Release                                                    
  404  Not Found [IP: 91.189.95.85 80]
Err:16 http://old-releases.ubuntu.com/ubuntu focal-updates Release                                                           
  404  Not Found [IP: 91.189.88.247 80]
Hit:17 https://linux-clients.seafile.com/seafile-deb/focal stable InRelease                
Err:18 http://old-releases.ubuntu.com/ubuntu focal-backports Release 
  404  Not Found [IP: 91.189.88.247 80]
Err:19 http://old-releases.ubuntu.com/ubuntu focal-security Release  
  404  Not Found [IP: 91.189.88.247 80]
Ign:13 https://launchpad.net/~terry.guo/+archive/gcc-arm-embedded focal InRelease
Err:20 https://launchpad.net/~terry.guo/+archive/gcc-arm-embedded focal Release
  404  Not Found [IP: 91.189.89.222 443]
Reading package lists... Done

How can I solve this ?

14
  • 4
    Why do you have old-releases in your sources? Focal is hardly an "old release" ... 🤔
    – matigo
    Jan 5, 2022 at 14:59
  • 1
    If @cocomac's solution did not work, then you will need to open your /etc/apt/sources.list file and fix the issue manually. Focal Fossa is not at all an "old release", so the URL naturally 404s. You will need to replace old-releases.ubuntu.com with something logical, like archive.ubuntu.com (or the one for your geographical region) 🤔
    – matigo
    Jan 5, 2022 at 15:08
  • 1
    I did all things I get below lines output: Hit:1 archive.ubuntu.com/ubuntu focal InRelease Hit:2 archive.ubuntu.com/ubuntu focal-updates InRelease Hit:3 archive.ubuntu.com/ubuntu focal-security InRelease Hit:4 archive.canonical.com/ubuntu focal InRelease Hit:5 archive.ubuntu.com/ubuntu focal-backports InRelease Reading package lists... Done
    – gogogo
    Jan 6, 2022 at 8:41
  • 1
    @gogogo Great! Seems the problem is solved. You can run sudo apt update to look for upgradeable packages.
    – Error404
    Jan 6, 2022 at 9:38
  • 5
    Does this answer your question? How can I fix a 404 Error when using a PPA or updating my package lists?
    – muru
    Jan 6, 2022 at 10:04

1 Answer 1

85

Most of the repositories and PPAs in your sources.list are no longer available and are throwing errors. I'd recommend restoring the default repositories.

  1. First, restore the default repositories using these commands:

    mkdir ~/solution
    cd ~/solution/
    
    cat << EOF > ~/solution/sources.list
    deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
    deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
    
    deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
    deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
    
    deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
    deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
    
    deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
    deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
    
    deb http://archive.canonical.com/ubuntu focal partner
    deb-src http://archive.canonical.com/ubuntu focal partner
    EOF
    
    sudo sed -i "s/focal/$(lsb_release -c -s)/" ~/solution/sources.list
    sudo rm /etc/apt/sources.list
    sudo cp ~/solution/sources.list /etc/apt/sources.list
    
  2. Remove all the PPAs in your system:

    sudo mv /etc/apt/sources.list.d/* ~/solution
    
  3. Update the repositories:

    sudo apt update
    

All set!

6
  • 2
    awesome.. finally this fixed it after almost 2 hours of trying. thank you so much!
    – supersan
    Aug 10, 2022 at 16:28
  • 1
    god bless you :))
    – CVDE
    Feb 17, 2023 at 19:46
  • At the end of your regimen, it says, "40 packages can be upgraded. Run 'apt list --upgradable' to see them." How do I proceed? Dec 30, 2023 at 23:46
  • 1
    @MichaelLevy you should upgrade those packages, run sudo apt upgrade
    – Error404
    Jan 2 at 7:43
  • Great! You saved my day Feb 25 at 8:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .