Debian 8/9服务器及桌面端官方仓库连接故障求助
解决Debian 8/9仓库连接失败的问题
嘿,这个问题我太熟了——Debian 8(Jessie)和9(Stretch)早就过了官方支持周期啦,这就是你遇到大规模仓库连接故障的根本原因!
为什么会出现这个错误?
Debian 8的长期支持(LTS)在2020年6月就结束了,Debian 9的LTS也在2022年6月终止。官方已经把这两个版本的包仓库从常规源(比如ftp.de.debian.org)迁移到了归档服务器archive.debian.org,原来的源地址已经不再提供服务,所以会出现「没有Release文件」「无法获取资源」的报错。
修复步骤
1. 备份原有源配置(重要!)
先把当前的源文件备份一份,防止改错了无法恢复:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak # 如果有额外的源目录,也一起备份 sudo cp -r /etc/apt/sources.list.d /etc/apt/sources.list.d.bak
2. 修改源配置文件
编辑sources.list文件,把所有旧的源地址替换成归档服务器地址:
sudo nano /etc/apt/sources.list
把文件里的内容全部替换成对应版本的配置:
- Debian 8(Jessie):
deb [trusted=yes] http://archive.debian.org/debian jessie main non-free contrib deb [trusted=yes] http://archive.debian.org/debian-security jessie/updates main non-free contrib deb [trusted=yes] http://archive.debian.org/debian jessie-updates main non-free contrib - Debian 9(Stretch):
deb [trusted=yes] http://archive.debian.org/debian stretch main non-free contrib deb [trusted=yes] http://archive.debian.org/debian-security stretch/updates main non-free contrib deb [trusted=yes] http://archive.debian.org/debian stretch-updates main non-free contrib
注:添加
[trusted=yes]是因为归档源的签名密钥可能已经过期或不在你的系统中,这样可以跳过签名验证,确保apt update能正常运行。
3. 更新包缓存
保存文件后,运行以下命令更新缓存:
sudo apt update
这时候应该就能正常获取仓库信息了,安装/更新操作也能恢复。
重要提醒
虽然以上方法能暂时修复包管理问题,但Debian 8和9已经没有任何安全更新了,继续使用会面临严重的安全风险。强烈建议尽快升级到仍受支持的Debian版本(比如Debian 11 Bullseye或Debian 12 Bookworm)。
内容的提问来源于stack exchange,提问作者Stefan
相关产品推荐
相关产品推荐

