33

I am using ubuntu 20.04.3 LTS on my system . I've an error for 2 days. I couldnt update-upgrade or package install on my system I get below 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 ?

Error404
  • 6,920
  • 1
  • 26
  • 50
gogogo
  • 433
  • 1
  • 3
  • 6
  • 4
    Why do you have `old-releases` in your sources? Focal is hardly an "old release" ... – matigo Jan 05 '22 at 14:59
  • Does this answer your question? [How do I restore the default repositories?](https://askubuntu.com/questions/124017/how-do-i-restore-the-default-repositories) Your sources.list is messed up. Just reset them, and then re-add any repos your really need after, like for VS Code – cocomac Jan 05 '22 at 15:01
  • @cocomac No, I try every step but it doesnt work. – gogogo Jan 05 '22 at 15:01
  • @matigo I dont know :/ how can I solve this? – gogogo Jan 05 '22 at 15:04
  • 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 05 '22 at 15:08
  • Does this answer your question? [\*Error\* for Sudo apt-get update on ubuntu 20.04](https://askubuntu.com/questions/1372928/error-for-sudo-apt-get-update-on-ubuntu-20-04) – N0rbert Jan 05 '22 at 15:13
  • Do you remember who and why changed "archive" to "old-releases" for supported 20.04 LTS (focal) release? Both team-gcc-arm-embedded and ~terry.guo do not provide packages for 20.04, you have to disable them. – N0rbert Jan 05 '22 at 15:14
  • @N0rbert It's clear that they've updated from an old release to 20.04 using the `sed` command. So, maybe they were on 17.04 and replaced the codename to focal in their sources.list. – Error404 Jan 05 '22 at 15:21
  • I dont know but my friends have same issue although they have different ubuntu versions (16.04, 18.0 , 20.04). Is this problem cause of the region? – gogogo Jan 06 '22 at 06:24
  • @gogogo Did you try my answer? What is the result of `apt update` now? – Error404 Jan 06 '22 at 08:39
  • 1
    I did all things I get below lines output: Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease Hit:3 http://archive.ubuntu.com/ubuntu focal-security InRelease Hit:4 http://archive.canonical.com/ubuntu focal InRelease Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease Reading package lists... Done – gogogo Jan 06 '22 at 08:41
  • 1
    @gogogo Great! Seems the problem is solved. You can run `sudo apt update` to look for upgradeable packages. – Error404 Jan 06 '22 at 09:38
  • 5
    Does this answer your question? [How can I fix a 404 Error when using a PPA or updating my package lists?](https://askubuntu.com/questions/65911/how-can-i-fix-a-404-error-when-using-a-ppa-or-updating-my-package-lists) – muru Jan 06 '22 at 10:04
  • You can use http://old-releases.ubuntu.com/ubuntu for older versions – Ajouve Dec 05 '22 at 17:52

1 Answers1

71

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
    

Now there should be no errors.

Error404
  • 6,920
  • 1
  • 26
  • 50