linux下sudo apt-get update 报Err http://security.ubuntu.com precise-security InRelease 等

本文提供了一种解决Linux系统更新时出现错误的实用方法,通过清除APT缓存和锁定文件,帮助用户顺利进行系统更新。

今天在进行linux更新的时候一直报错,尝试了很多办法都不行
于是找到一个方法 切实可行
以根用户运行

cd  /var/lib/apt/lists 
rm *
rm /var/cache/apt/archives/lock
rm /var/lib/dpkg/lock
The following extra packages will be installed: openssh-client openssh-server ssh-import-id Suggested packages: libpam-ssh keychain monkeysphere openssh-blacklist openssh-blacklist-extra rssh molly-guard The following NEW packages will be installed: openssh-server ssh ssh-import-id The following packages will be upgraded: openssh-client 1 upgraded, 3 newly installed, 0 to remove and 767 not upgraded. Need to get 1,310 kB of archives. After this operation, 926 kB of additional disk space will be used. Do you want to continue [Y/n]? y WARNING: The following packages cannot be authenticated! openssh-client openssh-server ssh ssh-import-id Install these packages without verification [y/N]? y Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main openssh-client i386 1:5.9p1-5ubuntu1.10 404 Not Found [IP: 91.189.91.82 80] Err http://us.archive.ubuntu.com/ubuntu/ precise/main ssh-import-id all 2.10-0ubuntu1 404 Not Found [IP: 91.189.91.82 80] Err http://security.ubuntu.com/ubuntu/ precise-security/main openssh-client i386 1:5.9p1-5ubuntu1.10 404 Not Found [IP: 91.189.91.81 80] Err http://security.ubuntu.com/ubuntu/ precise-security/main openssh-server i386 1:5.9p1-5ubuntu1.10 404 Not Found [IP: 91.189.91.81 80] Err http://security.ubuntu.com/ubuntu/ precise-security/main ssh all 1:5.9p1-5ubuntu1.10 404 Not Found [IP: 91.189.91.81 80] Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openssh/openssh-client_5.9p1-5ubuntu1.10_i386.deb 404 Not Found [IP: 91.189.91.81 80] Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openssh/openssh-server_5.9p1-5ubuntu1.10_i386.deb 404 Not Found [IP: 91.189.91.81 80] Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/o/openssh/ssh_5.9p1-5ubuntu1.10_all.deb 404 Not Found [IP: 91.189.91.81 80] Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/s/ssh-import-id/ssh-import-id_2.10-0ubuntu1_all.deb 404 Not Found [IP: 91.189.91.82 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
最新发布
08-09
<think>好的,我现在需要帮助用户解决Ubuntu Hirsute源的404错误,并成功更新系统。首先,我得了解Hirsute的版本情况。Ubuntu 21.04的代号是Hirsute Hippo,但它的支持周期已经结束了。官方通常只支持非LTS版本9个月,所以现在用户可能无法访问官方源,导致404错误。 接下来,我需要考虑用户可能的当前源配置。用户可能还在使用旧的Hirsute源,而这些源已经被归档或移动到其他位置。因此,解决方案可能包括将源切换到旧的归档仓库或者升级系统到支持的版本。 首先,检查用户的sources.list文件是否正确。用户可能需要将源中的http://archive.ubuntu.com/ubuntu替换为http://old-releases.ubuntu.com/ubuntu。此外,确保发行版名称正确,比如hirsute-updates和hirsute-security也需要相应调整。 另一个方案是建议用户升级到仍受支持的版本,比如22.04 LTS(Jammy Jellyfish)。这样用户可以获得长期支持,避免再次遇到源失效的问题。不过,用户需要注意备份数据,并在升级前确认系统兼容性。 此外,用户可能在使用第三方PPA,这些PPA可能没有为Hirsute提供支持,导致部分包无法找到。需要检查是否有启用了不兼容的PPA,并暂时禁用它们。 最后,确保用户在执行任何更改后运行apt-get update,并观察是否还有错误。如果问题依旧存在,可能需要进一步检查网络连接或镜像状态。</think>### 解决Ubuntu Hirsute源404错误的分步指南 #### 1. 确认系统版本与支持状态 Ubuntu 21.04(Hirsute Hippo)已于**2022年1月**结束官方支持[^1],标准软件仓库已关闭。可通过以下命令验证版本: ```bash lsb_release -a ``` #### 2. 修改软件源至归档仓库 编辑源列表文件: ```bash sudo sed -i 's/archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list sudo sed -i 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list ``` 或手动修改`/etc/apt/sources.list`,将所有条目中的: ``` http://archive.ubuntu.com/ubuntu http://security.ubuntu.com/ubuntu ``` 替换为: ``` http://old-releases.ubuntu.com/ubuntu ``` #### 3. 清理无效PPA 检查`/etc/apt/sources.list.d/`目录,注释掉所有包含`hirsute`的第三方PPA: ```bash sudo sed -i 's/^deb/#deb/g' /etc/apt/sources.list.d/*.list ``` #### 4. 执行更新操作 ```bash sudo apt-get clean sudo rm -rf /var/lib/apt/lists/* sudo apt-get update ``` #### 5. 系统升级建议(推荐) 考虑升级到LTS版本: ```bash sudo do-release-upgrade -d # 升级至22.04 LTS ``` 升级前请备份重要数据。 #### 验证修复 执行更新后观察输出,应不再出现`404 Not Found`错误。典型成功输出示例: ``` Get:1 http://old-releases.ubuntu.com/ubuntu hirsute InRelease [...] Reading package lists... Done ``` ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值