[APT] Resolving 404 Errors with Debian Jessie Repositories on Aliyun Mirrors
Resolving 404 Errors with Debian Jessie Repositories on Aliyun Mirrors
If you’ve been managing Debian servers, especially those running the older Jessie distribution, you might have encountered a frustrating 404 Not Found error when trying to fetch updates from Aliyun mirrors. This error typically looks something like this:
1 | http://mirrors.aliyun.com/debian-security/dists/jessie/updates/main/binary-amd64/Packages 404 Not Found [IP: 27.221.82.230 80] |
This issue arises because Debian Jessie has reached its end of life, and its packages are no longer hosted in the primary repositories. Instead, they have been moved to the Debian Archive repositories. Fortunately, resolving this issue is straightforward.
Updating Your Sources List
To fix the 404 error and ensure your system can still access Jessie packages and security updates, you need to update the /etc/apt/sources.list
file to point to the correct archive locations.
Here’s the initial, problematic configuration:
1 | echo "deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list && \ |
This configuration fails because the primary and security repositories for Jessie have been archived. You need to update your sources to point to the Debian Archive repositories instead.
Correct Configuration
To ensure your system points to the correct repositories, update your /etc/apt/sources.list
as follows:
1 | echo "deb http://mirrors.aliyun.com/debian-archive/debian/ jessie main non-free contrib" >/etc/apt/sources.list && \ |
Step-by-Step Guide
-
Open Terminal:
Open a terminal on your Debian Jessie system. -
Edit Sources List:
Run the following commands to overwrite the existing sources list with the updated entries:1
2
3
4echo "deb http://mirrors.aliyun.com/debian-archive/debian/ jessie main non-free contrib" >/etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian-archive/debian-security/ jessie/updates main non-free contrib" >>/etc/apt/sources.list && \
echo "deb-src http://mirrors.aliyun.com/debian-archive/debian/ jessie main non-free contrib" >>/etc/apt/sources.list && \
echo "deb-src http://mirrors.aliyun.com/debian-archive/debian-security/ jessie/updates main non-free contrib" >>/etc/apt/sources.list && \ -
Update Package Lists:
Update your package lists to reflect the new repository locations:1
sudo apt-get update
-
Install or Upgrade Packages:
You can now install or upgrade packages as needed without encountering the 404 error.
Conclusion
By pointing your Debian Jessie system to the correct archive repositories on Aliyun, you can continue to manage your packages without interruption. Although Jessie is an older release, many systems still rely on it, and understanding how to properly maintain these systems is crucial for any Debian administrator. This quick adjustment ensures that your package management continues smoothly, even after the official end-of-life of Jessie.