Search code examples
linuxubuntuapt

How to fix apt cmd when it doesn't work on ubuntu


I am an ubuntu user and after several hazard additions of external sources to my etc/apt/sources.list the software repositories files seem to be corrupted. I can no longer update without errors. I wonder how I can fix such a thing.

Here is my etc/apt/soure.list file and I have uubuntu 20.10

deb http://it.archive.ubuntu.com/ubuntu/ groovy main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ groovy main universe restricted multiverse

deb http://security.ubuntu.com/ubuntu groovy-security main universe restricted multiverse
deb-src http://security.ubuntu.com/ubuntu groovy-security main universe restricted multiverse

deb http://it.archive.ubuntu.com/ubuntu/ groovy-updates main universe restricted multiverse
deb-src http://it.archive.ubuntu.com/ubuntu/ groovy-updates main universe restricted multiverse

deb http://it.archive.ubuntu.com/ubuntu groovy-backports main restricted universe multiverse
deb-src http://it.archive.ubuntu.com/ubuntu groovy-backports main restricted universe multiverse

deb http://archive.canonical.com/ubuntu groovy partner
deb-src http://archive.canonical.com/ubuntu groovy partner

When I run sudo apt-get update I got this.

Ign :1 http://it.archive.ubuntu.com/ubuntu groovy InRelease                                             
Ign :2 http://security.ubuntu.com/ubuntu groovy-security InRelease                                      
Atteint :3 http://archive.canonical.com/ubuntu groovy InRelease       
Ign :4 http://it.archive.ubuntu.com/ubuntu groovy-updates InRelease   
Err :5 http://security.ubuntu.com/ubuntu groovy-security Release      
  404  Not Found [IP : 91.189.91.38 80]
Ign :6 http://it.archive.ubuntu.com/ubuntu groovy-backports InRelease
Err :7 http://it.archive.ubuntu.com/ubuntu groovy Release
  404  Not Found [IP : 90.147.160.70 80]
Err :8 http://it.archive.ubuntu.com/ubuntu groovy-updates Release
  404  Not Found [IP : 90.147.160.70 80]
Err :9 http://it.archive.ubuntu.com/ubuntu groovy-backports Release
  404  Not Found [IP : 90.147.160.70 80]
Lecture des listes de paquets... Fait
E: Le dépôt http://security.ubuntu.com/ubuntu groovy-security Release n'a pas de fichier Release.
N: Les mises à jour depuis un tel dépôt ne peuvent s'effectuer de manière sécurisée, et sont donc désactivées par défaut.
N: Voir les pages de manuel d'apt-secure(8) pour la création des dépôts et les détails de configuration d'un utilisateur.
E: Le dépôt http://it.archive.ubuntu.com/ubuntu groovy Release n'a pas de fichier Release.
N: Les mises à jour depuis un tel dépôt ne peuvent s'effectuer de manière sécurisée, et sont donc désactivées par défaut.
N: Voir les pages de manuel d'apt-secure(8) pour la création des dépôts et les détails de configuration d'un utilisateur.
E: Le dépôt http://it.archive.ubuntu.com/ubuntu groovy-updates Release n'a pas de fichier Release.
N: Les mises à jour depuis un tel dépôt ne peuvent s'effectuer de manière sécurisée, et sont donc désactivées par défaut.
N: Voir les pages de manuel d'apt-secure(8) pour la création des dépôts et les détails de configuration d'un utilisateur.
E: Le dépôt http://it.archive.ubuntu.com/ubuntu groovy-backports Release n'a pas de fichier Release.
N: Les mises à jour depuis un tel dépôt ne peuvent s'effectuer de manière sécurisée, et sont donc désactivées par défaut.
N: Voir les pages de manuel d'apt-secure(8) pour la création des dépôts et les détails de configuration d'un utilisateur.

I have to do a config and my apt must necessarily work well. It's been blocking me for a few days. I hope that someone can help me. Thanks.


Solution

  • Ubuntu 20.10 has been deprecated for nearly a year. You should replace it.archive.ubuntu.com with old-releases.ubuntu.com

    root@fd8c537092b2:/# grep VERSION /etc/os-release
    VERSION="20.10 (Groovy Gorilla)"
    VERSION_ID="20.10"
    VERSION_CODENAME=groovy
    
    root@fd8c537092b2:/# grep '^deb' /etc/apt/sources.list
    deb http://archive.ubuntu.com/ubuntu/ groovy main restricted
    deb http://archive.ubuntu.com/ubuntu/ groovy-updates main restricted
    deb http://archive.ubuntu.com/ubuntu/ groovy universe
    deb http://archive.ubuntu.com/ubuntu/ groovy-updates universe
    deb http://archive.ubuntu.com/ubuntu/ groovy multiverse
    deb http://archive.ubuntu.com/ubuntu/ groovy-updates multiverse
    deb http://archive.ubuntu.com/ubuntu/ groovy-backports main restricted universe multiverse
    deb http://security.ubuntu.com/ubuntu/ groovy-security main restricted
    deb http://security.ubuntu.com/ubuntu/ groovy-security universe
    deb http://security.ubuntu.com/ubuntu/ groovy-security multiverse
    
    root@fd8c537092b2:/# apt-get update
    Ign:1 http://archive.ubuntu.com/ubuntu groovy InRelease
    Ign:2 http://security.ubuntu.com/ubuntu groovy-security InRelease
    Err:3 http://security.ubuntu.com/ubuntu groovy-security Release
      404  Not Found [IP: 91.189.91.38 80]
    Ign:4 http://archive.ubuntu.com/ubuntu groovy-updates InRelease
    Ign:5 http://archive.ubuntu.com/ubuntu groovy-backports InRelease
    Err:6 http://archive.ubuntu.com/ubuntu groovy Release
      404  Not Found [IP: 185.125.190.36 80]
    Err:7 http://archive.ubuntu.com/ubuntu groovy-updates Release
      404  Not Found [IP: 185.125.190.36 80]
    Err:8 http://archive.ubuntu.com/ubuntu groovy-backports Release
      404  Not Found [IP: 185.125.190.36 80]
    Reading package lists... Done
    E: The repository 'http://security.ubuntu.com/ubuntu groovy-security Release' does not have a Release file.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    E: The repository 'http://archive.ubuntu.com/ubuntu groovy Release' does not have a Release file.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    E: The repository 'http://archive.ubuntu.com/ubuntu groovy-updates Release' does not have a Release file.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    E: The repository 'http://archive.ubuntu.com/ubuntu groovy-backports Release' does not have a Release file.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    
    root@fd8c537092b2:/# sed -i 's/archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
    
    root@fd8c537092b2:/# grep '^deb' /etc/apt/sources.list
    deb http://old-releases.ubuntu.com/ubuntu/ groovy main restricted
    deb http://old-releases.ubuntu.com/ubuntu/ groovy-updates main restricted
    deb http://old-releases.ubuntu.com/ubuntu/ groovy universe
    deb http://old-releases.ubuntu.com/ubuntu/ groovy-updates universe
    deb http://old-releases.ubuntu.com/ubuntu/ groovy multiverse
    deb http://old-releases.ubuntu.com/ubuntu/ groovy-updates multiverse
    deb http://old-releases.ubuntu.com/ubuntu/ groovy-backports main restricted universe multiverse
    deb http://security.ubuntu.com/ubuntu/ groovy-security main restricted
    deb http://security.ubuntu.com/ubuntu/ groovy-security universe
    deb http://security.ubuntu.com/ubuntu/ groovy-security multiverse
    
    root@fd8c537092b2:/# apt-get update
    Get:1 http://old-releases.ubuntu.com/ubuntu groovy InRelease [267 kB]
    Ign:2 http://security.ubuntu.com/ubuntu groovy-security InRelease
    Err:3 http://security.ubuntu.com/ubuntu groovy-security Release
      404  Not Found [IP: 185.125.190.36 80]
    Get:4 http://old-releases.ubuntu.com/ubuntu groovy-updates InRelease [115 kB]
    Get:5 http://old-releases.ubuntu.com/ubuntu groovy-backports InRelease [101 kB]
    Get:6 http://old-releases.ubuntu.com/ubuntu groovy/restricted amd64 Packages [87.5 kB]
    Get:7 http://old-releases.ubuntu.com/ubuntu groovy/main amd64 Packages [1768 kB]
    Get:8 http://old-releases.ubuntu.com/ubuntu groovy/universe amd64 Packages [16.1 MB]
    Get:9 http://old-releases.ubuntu.com/ubuntu groovy/multiverse amd64 Packages [247 kB]
    Get:10 http://old-releases.ubuntu.com/ubuntu groovy-updates/universe amd64 Packages [559 kB]
    Get:11 http://old-releases.ubuntu.com/ubuntu groovy-updates/restricted amd64 Packages [110 kB]
    Get:12 http://old-releases.ubuntu.com/ubuntu groovy-updates/main amd64 Packages [453 kB]
    Get:13 http://old-releases.ubuntu.com/ubuntu groovy-updates/multiverse amd64 Packages [20.1 kB]
    Get:14 http://old-releases.ubuntu.com/ubuntu groovy-backports/main amd64 Packages [2681 B]
    Get:15 http://old-releases.ubuntu.com/ubuntu groovy-backports/universe amd64 Packages [6237 B]
    Reading package lists... Done
    E: The repository 'http://security.ubuntu.com/ubuntu groovy-security Release' does not have a Release file.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    

    After this is done, you should get back onto a supported version. Unfortunately, there's no way to do this anymore for ubuntu 20.10:

    root@fd8c537092b2:/# apt-get install -y ubuntu-release-upgrader-core
    ...stuff...
    root@fd8c537092b2:/# do-release-upgrade
    ...stuff...
    An upgrade from 'groovy' to 'impish' is not supported with this tool.
    

    There is a longer way to upgrade though, which is found here: https://help.ubuntu.com/community/EOLUpgrades/

    To avoid this in the future, if you're not planning on upgrading your ubuntu OS every 6 months, you should stay on LTS releases. Otherwise be sure to upgrade soon after the next version is released so you do not end up running an unsupported release with a difficult upgrade path.