Error when using sudo apt update on ubuntu 22.04

Asked by Aayush Regmi

i am new to ubuntu so don't know whats wrong. i get this error

Ign:1 http://security.ubuntu focal-security InRelease
Ign:2 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 InRelease
Hit:3 https://dl.google.com/linux/chrome/deb stable InRelease
Ign:4 http://security.ubuntu.com/ubuntu impish-security InRelease
Get:5 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release [3,457 B]
Ign:6 http://old-releases.ubuntu.com/ubuntu jammy InRelease
Ign:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 InRelease
Hit:8 https://packages.microsoft.com/repos/ms-teams stable InRelease
Err:9 http://security.ubuntu.com/ubuntu impish-security Release
  404 Not Found [IP: 185.125.190.39 80]
Get:10 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release.gpg [801 B]
Ign:11 http://old-releases.ubuntu.com/ubuntu jammy-updates InRelease
Ign:12 https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 InRelease
Hit:13 https://ppa.launchpadcontent.net/git-core/ppa/ubuntu jammy InRelease
Ign:1 http://security.ubuntu focal-security InRelease
Ign:10 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release.gpg
Ign:14 http://old-releases.ubuntu.com/ubuntu jammy-backports InRelease
Hit:15 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 Release
Ign:16 http://old-releases.ubuntu.com/ubuntu jammy-security InRelease
Hit:18 https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 Release
Err:20 http://old-releases.ubuntu.com/ubuntu jammy Release
  404 Not Found [IP: 91.189.91.124 80]
Err:21 http://old-releases.ubuntu.com/ubuntu jammy-updates Release
  404 Not Found [IP: 91.189.91.124 80]
Err:22 http://old-releases.ubuntu.com/ubuntu jammy-backports Release
  404 Not Found [IP: 91.189.91.124 80]
Ign:1 http://security.ubuntu focal-security InRelease
Err:23 http://old-releases.ubuntu.com/ubuntu jammy-security Release
  404 Not Found [IP: 91.189.91.124 80]
Err:1 http://security.ubuntu focal-security InRelease
  Could not resolve 'security.ubuntu'
Reading package lists... Done
E: The repository 'http://security.ubuntu.com/ubuntu impish-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.
W: GPG error: http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY BC711F9BA15703C6
E: The repository 'http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Release' is not signed.
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.
W: https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/5.0/Release.gpg: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
E: The repository 'http://old-releases.ubuntu.com/ubuntu jammy 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://old-releases.ubuntu.com/ubuntu jammy-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://old-releases.ubuntu.com/ubuntu jammy-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.
E: The repository 'http://old-releases.ubuntu.com/ubuntu jammy-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.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

So you need the mongodb repo GPG key importing and comment out the old-release lines in /etc/apt/sources.list as a good start

Revision history for this message
Manfred Hampl (m-hampl) said :
#2

There are several errors in the package management configuration file (errors in server names, wrong release name, ...)

For being able to help we need some more information.
What is the output of the command (to be executed in a terminal window):

cat -n /etc/apt/sources.list

Revision history for this message
Aayush Regmi (aayush1202) said :
#3

cat -n /etc/apt/sources.list

     1 # deb cdrom:[Ubuntu 22.04.1 LTS _Jammy Jellyfish_ - Release amd64 (20220809.1)]/ jammy main restricted
     2
     3 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
     4 # newer versions of the distribution.
     5 deb http://old-releases.ubuntu.com/ubuntu/ jammy main restricted
     6 # deb-src http://old-releases.ubuntu.com/ubuntu/ jammy main restricted
     7
     8 ## Major bug fix updates produced after the final release of the
     9 ## distribution.
    10 deb http://old-releases.ubuntu.com/ubuntu/ jammy-updates main restricted
    11 # deb-src http://old-releases.ubuntu.com/ubuntu/ jammy-updates main restricted
    12
    13 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    14 ## team. Also, please note that software in universe WILL NOT receive any
    15 ## review or updates from the Ubuntu security team.
    16 deb http://old-releases.ubuntu.com/ubuntu/ jammy universe
    17 # deb-src http://old-releases.ubuntu.com/ubuntu/ jammy universe
    18 deb http://old-releases.ubuntu.com/ubuntu/ jammy-updates universe
    19 # deb-src http://old-releases.ubuntu.com/ubuntu/ jammy-updates universe
    20
    21 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    22 ## team, and may not be under a free licence. Please satisfy yourself as to
    23 ## your rights to use the software. Also, please note that software in
    24 ## multiverse WILL NOT receive any review or updates from the Ubuntu
    25 ## security team.
    26 deb http://old-releases.ubuntu.com/ubuntu/ jammy multiverse
    27 # deb-src http://old-releases.ubuntu.com/ubuntu/ jammy multiverse
    28 deb http://old-releases.ubuntu.com/ubuntu/ jammy-updates multiverse
    29 # deb-src http://old-releases.ubuntu.com/ubuntu/ jammy-updates multiverse
    30
    31 ## N.B. software from this repository may not have been tested as
    32 ## extensively as that contained in the main release, although it includes
    33 ## newer versions of some applications which may provide useful features.
    34 ## Also, please note that software in backports WILL NOT receive any review
    35 ## or updates from the Ubuntu security team.
    36 deb http://old-releases.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
    37 # deb-src http://old-releases.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
    38
    39 deb http://old-releases.ubuntu.com/ubuntu jammy-security main restricted
    40 # deb-src http://old-releases.ubuntu.com/ubuntu jammy-security main restricted
    41 deb http://old-releases.ubuntu.com/ubuntu jammy-security universe
    42 # deb-src http://old-releases.ubuntu.com/ubuntu jammy-security universe
    43 deb http://old-releases.ubuntu.com/ubuntu jammy-security multiverse
    44 # deb-src http://old-releases.ubuntu.com/ubuntu jammy-security multiverse
    45
    46 # This system was installed using small removable media
    47 # (e.g. netinst, live or single CD). The matching "deb cdrom"
    48 # entries were disabled at the end of the installation process.
    49 # For information about how to configure apt package sources,
    50 # see the sources.list(5) manual.

Revision history for this message
Manfred Hampl (m-hampl) said :
#4

Open a terminal window and issue the command

sudo gedit /etc/apt/sources.list

Provide your password when asked for it, and an editor will open with the config file loaded.
Replace all strings old-releases.ubuntu.com by archive.ubuntu.com
In lines 39 to 44 (those containing "jammy-security") change the server name to security.ubuntu.com
Save the file and close the editor.

There are more errors in other files; for giving repair instructions for those please provide the output that you receive for the command

find /etc/apt -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;

Revision history for this message
Aayush Regmi (aayush1202) said :
#5

/etc/apt/sources.list

     1 # deb cdrom:[Ubuntu 22.04.1 LTS _Jammy Jellyfish_ - Release amd64 (20220809.1)]/ jammy main restricted
     2
     3 # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
     4 # newer versions of the distribution.
     5 deb http://archive.ubuntu.com/ubuntu/ jammy main restricted
     6 # deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted
     7
     8 ## Major bug fix updates produced after the final release of the
     9 ## distribution.
    10 deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
    11 # deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
    12
    13 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    14 ## team. Also, please note that software in universe WILL NOT receive any
    15 ## review or updates from the Ubuntu security team.
    16 deb http://archive.ubuntu.com/ubuntu/ jammy universe
    17 # deb-src http://archive.ubuntu.com/ubuntu/ jammy universe
    18 deb http://archive.ubuntu.com/ubuntu/ jammy-updates universe
    19 # deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates universe
    20
    21 ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    22 ## team, and may not be under a free licence. Please satisfy yourself as to
    23 ## your rights to use the software. Also, please note that software in
    24 ## multiverse WILL NOT receive any review or updates from the Ubuntu
    25 ## security team.
    26 deb http://archive.ubuntu.com/ubuntu/ jammy multiverse
    27 # deb-src http://archive.ubuntu.com/ubuntu/ jammy multiverse
    28 deb http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse
    29 # deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse
    30
    31 ## N.B. software from this repository may not have been tested as
    32 ## extensively as that contained in the main release, although it includes
    33 ## newer versions of some applications which may provide useful features.
    34 ## Also, please note that software in backports WILL NOT receive any review
    35 ## or updates from the Ubuntu security team.
    36 deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
    37 # deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
    38
    39 deb http://archive.ubuntu.com/ubuntu security.ubuntu.com main restricted
    40 # deb-src http://archive.ubuntu.com/ubuntu security.ubuntu.com main restricted
    41 deb http://archive.ubuntu.com/ubuntu security.ubuntu.com universe
    42 # deb-src http://archive.ubuntu.com/ubuntu security.ubuntu.com universe
    43 deb http://archive.ubuntu.com/ubuntu security.ubuntu.com multiverse
    44 # deb-src http://archive.ubuntu.com/ubuntu security.ubuntu.com multiverse
    45
    46 # This system was installed using small removable media
    47 # (e.g. netinst, live or single CD). The matching "deb cdrom"
    48 # entries were disabled at the end of the installation process.
    49 # For information about how to configure apt package sources,
    50 # see the sources.list(5) manual.

Revision history for this message
Manfred Hampl (m-hampl) said :
#6

1. Sorry for not being clear enough, but you misinterpreted one of my instructions.

You changed also a wrong part in lines 39-44

Please repeat editing the file and change lines 39 to 44 to:

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

2. Now I am a bit astonished.
You "apt update" output shows references to mongodb and focal, but these are not visible in your output above.
Did you delete them?

What is the output of the command

ls -l /etc/apt/sources.list.d/

Revision history for this message
Aayush Regmi (aayush1202) said :
#7

Oh i am sorry like i said i am new to this.
I did it correctly this time and sudo apt update worked.

ls -l /etc/apt/sources.list.d/
total 0

Revision history for this message
Best Manfred Hampl (m-hampl) said :
#8

If "apt update" does not show errors any more, then the question can be marked as "solved", unless you have further questions.

Revision history for this message
Aayush Regmi (aayush1202) said :
#9

Thanks Manfred Hampl, that solved my question.