Ubuntu is one of the popular and widely used Linux distributions, which, in contrast to the valuable features it offers, has flaws that may be annoying for users. Fortunately, the powerful and lovely Linux does not leave worries in the hearts of users. Therefore, you can easily solve your problems in Linux by finding solutions.
For this reason, today users prefer buying Ubuntu VPS to other operating systems because they are sure of the features of Linux in solving all problems. One of the common problems of users using Ubuntu is receiving errors when updating the Ubuntu repository and repeatedly using
If you are an Ubuntu user, most likely you have experienced various errors including the “404 Not found” error when updating the package list of the old version of Ubuntu using apt-get. Encountering this error is due to the short-term support (9 months) of Ubuntu versions, and if an old version is not supported, you will receive an error message. Don’t panic and worry when you see these errors in Ubuntu, this error is common and very easy to fix. In this article, you will learn the instructions to fix the common Ubuntu update error; by following the instructions in this article, your problem will be solved.
Solving the problem of receiving a “404 Not Found” error in Ubuntu
When you update the repository and packages of the old version of Ubuntu by running the “
apt-get update” command, getting a “404 Not Found” error is one of the common errors in Ubuntu.
sudo apt-get update
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB] Ign:2 http://old-releases.ubuntu.com/ubuntu jammy InRelease Ign:3 http://old-releases.ubuntu.com/ubuntu jammy-updates InRelease Ign:4 http://old-releases.ubuntu.com/ubuntu jammy-backports InRelease Hit:5 https://packages.microsoft.com/repos/azure-cli jammy InRelease Err:6 http://old-releases.ubuntu.com/ubuntu jammy Release 404 Not Found [IP:********** **] Ign:7 http://security.ubuntu.com/ubuntu impish-security InRelease Err:8 http://old-releases.ubuntu.com/ubuntu jammy-updates Release 404 Not Found [IP:********** **] Err:9 http://security.ubuntu.com/ubuntu impish-security Release 404 Not Found [IP:********** **] Err:10 http://old-releases.ubuntu.com/ubuntu jammy-backports Release 404 Not Found [IP:********** **] Hit:11 http://apt.postgresql.org/pub/repos/apt jammy-pgdg InRelease Reading package lists… Done E: The repository ‘http://old-releases.ubuntu.com/ buntu 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.
This error indicates that the URL defined to access other resources in the default location http://archive.ubuntu.com/ubuntu/dist/ is not available, which is due to Ubuntu moving the repositories to another server.
This error is usually displayed when you intend to add a PPA repository to Ubuntu. If you ask why? In response, it should be said that if the PPA repository does not support the version of Ubuntu you are using and is not available for your version of Ubuntu, you will receive a 404 Not Found error. Also, the incompatibility of the PPA repository with Ubuntu causes problems in updating the repository and the package list of the Ubuntu operating system. Therefore, one of the solutions to avoid receiving errors is to check the availability and compatibility of the PPA repository for the version of Ubuntu you are using, before installing the PPA.
Maybe you have a question about what PPA is and how to install PPA. We have already guided you in detail about what PPA is, you can benefit from our educational articles.
Solving the problem of receiving the “404 Not Found” error when updating Ubuntu is possible in two ways, the graphical interface and the command line. In this training, we will teach both methods so that you can solve your problem with whichever method is more convenient for you.
Method 1: Fixing the “404 Not Found” Error via the command line
Expert and experienced Linux users find it easier and more efficient to troubleshoot and solve Linux problems through the command line. There are different ways to solve this problem. The methods that you can use through the command line to solve the “404 Not Found “error and correct the performance of apt commands are as follows:
- Upgrading the version of Ubuntu
- Updating old package repositories’ source URLs
- Restoring the default Ubuntu repository and removing the PPA repository
The most basic and easiest step to solve this problem is to upgrade Ubuntu by running the following command:
sudo apt-get dist-upgrade
If the problem is solved by upgrading the version of Ubuntu, that is great; If the problem still persists, you should try other methods.
Changing Packages Url
If you failed to solve this problem by upgrading the Ubuntu version, updating the source URL for the Ubuntu repository can be a useful way to solve the “404 Not Found” error. By updating the source URL for Ubuntu repositories you will find older packages.
command helps you update the resources in the /etc/apt/sources.list file.
sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
Normal versions of Ubuntu due to dependency on archive…. and security… URLs after 9 months when the support for the Ubuntu version is stopped, the relevant repositories will be moved to old-releases. Therefore, by running the previous command, archive.ubuntu.com, and security.ubuntu.com package repository URLs are updated along with old-releases.ubuntu.com.
Update the other files in /etc/apt/sources.list.d/ that need to be updated using the
grep -E 'archive.ubuntu.com|security.ubuntu.com' /etc/apt/sources.list.d/*
Then update the Ubuntu source again:
sudo apt-get update
You can take additional measures in this field to solve your problem. Follow the instructions below:
- Access the contents of the /etc/apt/sources.list file using your favorite editor (vim editor is preferred in this tutorial):
- Add the following comment because the repository support is discontinued:
- After commenting out extras.ubuntu.com, replace main/security repositories with old-releases by following the procedure you see:
You can replace archive instead of main/security:
If the “404 not found” error is fixed by following the instructions of this method, you do not need to read the rest of the article, otherwise, you should use other methods.
Restoring the default Ubuntu repository and removing the PPA repository
The incompatibility of PPA repositories in Ubuntu is one of the common reasons for receiving the 404 Not Found error, that’s why restoring the default Ubuntu repository and removing the incompatible PPA repository can solve this problem. For this purpose, first, create a directory and add the following commands to it:
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 rm /etc/apt/sources.list sudo cp ~/solution/sources.list /etc/apt/sources.list
Then, by running the following command, remove all the PPA repository from the Ubuntu system:
sudo mv /etc/apt/sources.list.d/* ~/solution
You can also use another method to remove the PPA repository. You can directly remove the PPA repository by mentioning the desired PPA repository name:
sudo add-apt-repository --remove ppa:<ppa_repository name>
Finally, update your Ubuntu system again to check if the “404 Not Found” error is resolved:
sudo apt-get update
The output reports that this problem has been solved. Finally, your problem has been successfully solved.
Method 2: Fixing the “404 Not Found” Error via GUI
The Linux GUI is the easiest way for novice users to solve their problems, so follow the instructions to solve the problem of getting a “404 Not Found” error through the GUI:
1. Open the Ubuntu Application Menu and select the Software & Updates option.
2. Select the Other software tab to access a list of PPA repositories you have installed.
3. In the list of PPA repositories, find the repository associated with the 404 Not Found error and remove it by marking the box next to the desired PPA repository and clicking the Remove button.
Note: Never delete the main repository. We have chosen the main repository to delete for training in the image you see. Uncheck the main repository from the list of repositories you want to remove and do not delete it.
4. To ensure the problem is solved, run the
sudo apt-get updatecommand and check if you get a 404 Not Found error when updating the Ubuntu repository.
Most likely, your problem will be solved. We got over this problem so easily.
What are the reasons for showing the "404 Not Found" error in the Ubuntu update?
- PPA repository incompatibility and failure
- The Existence of non-working URLs in the resource repository files (/etc/apt/sources.list)
- The short period of support for regular versions of Ubuntu and the need for regular updates
apt-get update vs apt-get upgrade: what is the difference?
the apt-get upgrade is executed to upgrade the actual packages that are installed, while the package index files are updated by running the apt-get update. Using these two commands, the list of packages and the Ubuntu operating system is updated and you can use the latest software, security patches, and technologies.
Is it risky to update Ubuntu?
Not at all, it is always recommended to update Ubuntu to take advantage of new features, security updates, kernel upgrades, bug fixes, stability, and performance improvements. Therefore, updating Ubuntu provides valuable advantages; also if you use the normal version of Ubuntu, after 9 months the support for the old version of Ubuntu will be stopped, and updating the version of Ubuntu will be a necessity.
PPA is a repository that provides rare and unique software to Ubuntu users, and Linux users install the PPA repository on Ubuntu to benefit from software that is not supported by the default Ubuntu repository. Sometimes PPA repositories are not compatible with older versions of Ubuntu and do not work properly; With the discontinuation of support for Ubuntu versions, when updating Ubuntu repositories, users will receive a 404 Not Found error due to the incompatibility of PPA repositories with the Ubuntu system or the presence of broken URLs in the source repository file (/etc/apt/sources.list).
Removing broken and incompatible PPA repositories from the Ubuntu system is one of the main solutions to solve this problem. In this training, we taught different methods to solve your problem. We hope you can fix “404 Not Found Repository Errors” in Ubuntu using the instructions in this article.
If you need more help in any part of the article, ask us your questions in the comments section and we will answer your questions as soon as possible.