If you’re encountering 404 errors when running apt update
on Debian 9, it’s likely due to the fact that Debian 9 (code-named “Stretch”) reached its end of life on July 18, 2020. When a Debian version reaches its end of life, the repositories are typically archived and no longer receive updates. As a result, running apt update
on an EOL (End of Life) version of Debian will result in 404 errors because the repositories for that version are no longer available.
If you don’t want to upgrade to a supported version of Debian and prefer to stick with Debian 9 (Stretch), you can try the following options to address the 404 errors when running apt update
:
Update Sources to Archive Repositories: Since Debian 9 has reached its end of life, you should change your package sources to use the archived repositories. These archived repositories are not actively maintained but can still provide access to older packages. To do this, you will need to modify your /etc/apt/sources.list
file.
Open the /etc/apt/sources.list
file in a text editor with administrative privileges, such as sudo nano
or sudo vi
:
sudo nano /etc/apt/sources.list
Replace the existing repository URLs with the following lines to point to the Debian 9 archive repositories:
deb http://archive.debian.org/debian/ stretch main
deb-src http://archive.debian.org/debian/ stretch main
deb http://archive.debian.org/debian-security stretch/updates main
deb-src http://archive.debian.org/debian-security stretch/updates main
Save the file and exit the text editor.
Update APT Lists and Install Updates: After updating your sources, run the following commands to update the package lists and install available updates:
sudo apt update
sudo apt upgrade
This should work with the archived repositories, and you may be able to install any available updates for your Debian 9 system.
Be Cautious: Keep in mind that while this approach can help you get some updates, Debian 9 is no longer receiving security updates from the official repositories. Using an EOL release for an extended period can pose security risks, so it’s essential to take precautions, such as using a firewall, keeping unnecessary services disabled, and monitoring your system for vulnerabilities.
Consider Using Extended Support: Some organizations and companies offer extended support for older Debian releases, including security updates. This is typically a paid service and can help mitigate some of the security concerns associated with running an EOL release.
Maintain Regular Backups: Since you won’t be receiving security updates from the official repositories, it’s crucial to maintain regular backups of your data and configurations to minimize potential data loss and system downtime.
It’s worth emphasizing that running an EOL release without security updates is not recommended for production systems, as it can expose your system to security vulnerabilities. Upgrading to a supported Debian version is the safest and most secure option.