Categories: Snippets

How to Fix Ubuntu/Debian apt-get 404 Not Found Repository Errors

Distribution Upgrade

The most simple solution is to upgrade your Ubuntu instance to the newest release:

sudo apt-get dist-upgrade

if the distribution upgrade is not an option right now, you can update the sources url for the Ubuntu repositories to find the old packages.

Update Packages Url

You can use the sed command to update the sources in /etc/apt/sources.list file to the new location for old package repositories2.

Run the following command to update archive.ubuntu.com and security.ubuntu.com package repository4 URLs with old-releases.ubuntu.com. Since the normal Ubuntu releases link to the archive and security URLs, the support will be removed after their live cycle of 9 months and respective repositories3 moved to

sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

**Linux Mint additionally requires the execution of this command:**

sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list.d/official-package-repositories.list

To check whether there are other files in /etc/apt/sources.list.d/ which need to be updated, use the following grep command.

grep -E 'archive.ubuntu.com|security.ubuntu.com' /etc/apt/sources.list.d/*

That’s it. Now you can update your sources again.

sudo apt-get update

 

Recent Posts

How To Troubleshoot Socket Errors in MySQL – Ubuntu

MySQL manages connections to the database server through the use of a socket file, a special…

5 years ago

How to remove .html, .php, etc (extension) from URL?

To remove the .html extension from your urls, you can use the following code in…

5 years ago

Ubuntu with Apache2: Installing and Configuring Your SSL Certificate

Use free/paid SSL certificates https://www.sslforfree.com Enable SSL Module Replace 'default-ssl' with the real site name…

5 years ago

Create zip archive excluding specific Files & Directories

Create archive of all files under public_html directory ignoring all files and folders including text…

6 years ago

how to use sudo command to install .tar.gz?

To install some file *.tar.gz, you basically would do: Open a console, and go to…

6 years ago

Change ownership of the directory in ubuntu

The chown command has the following syntax: [crayon-6637131ba7656573771656/] So in your example command it is your primary…

6 years ago