ubuntu下sudo apt-get update Sources 404 Not Found [IP: 91.189.92.200 80]解决办法

原文地址:http://blog.youkuaiyun.com/chaihuasong/article/details/17009641


最近在ubuntu 10.04下面装了一个虚拟机,在虚拟机里面又装了11.04的ubuntu,装好后用apt get install 出现Unable to locate packag错误,上网上查了下,说是要sudo apt-get update 就可以了,但是本地执行sudo apt-get update 命令后出现了如下错误:

[html]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. Ign http://extras.ubuntu.com natty/main TranslationIndex  
  2. Err http://extras.ubuntu.com natty/main Sources  
  3.   404  Not Found  
  4. Err http://extras.ubuntu.com natty/main i386 Packages  
  5.   404  Not Found  
  6. Ign http://extras.ubuntu.com natty/main Translation-en_US  
  7. Err http://security.ubuntu.com natty-security/universe Sources  
  8.   404  Not Found [IP: 91.189.92.200 80]  
  9. Err http://security.ubuntu.com natty-security/multiverse Sources  
  10.   404  Not Found [IP: 91.189.92.200 80]  
  11. Ign http://extras.ubuntu.com natty/main Translation-en  
  12. Err http://security.ubuntu.com natty-security/universe i386 Packages  
  13.   404  Not Found [IP: 91.189.92.200 80]  
  14. Err http://security.ubuntu.com natty-security/multiverse i386 Packages  
  15.   404  Not Found [IP: 91.189.92.200 80]  
  16. Err http://security.ubuntu.com natty-security/main Sources  
  17.   404  Not Found [IP: 91.189.92.200 80]  
  18. Err http://security.ubuntu.com natty-security/restricted Sources  
  19.   404  Not Found [IP: 91.189.92.200 80]  
  20. Err http://security.ubuntu.com natty-security/main i386 Packages  
  21.   404  Not Found [IP: 91.189.92.200 80]  
  22. Err http://security.ubuntu.com natty-security/restricted i386 Packages  
  23.   404  Not Found [IP: 91.189.92.200 80]  
  24. Ign http://security.ubuntu.com natty-security/main Translation-en_US  
  25. Ign http://security.ubuntu.com natty-security/main Translation-en  
  26. Ign http://security.ubuntu.com natty-security/multiverse Translation-en_US  
  27. Ign http://security.ubuntu.com natty-security/multiverse Translation-en  
  28. Ign http://security.ubuntu.com natty-security/restricted Translation-en_US  
  29. Ign http://security.ubuntu.com natty-security/restricted Translation-en  
  30. Ign http://security.ubuntu.com natty-security/universe Translation-en_US  
  31. Ign http://security.ubuntu.com natty-security/universe Translation-en  
  32. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/main/source/Sources  404  Not Found  
  33.   
  34. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/restricted/source/Sources  404  Not Found  
  35.   
  36. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/universe/source/Sources  404  Not Found  
  37.   
  38. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/multiverse/source/Sources  404  Not Found  
  39.   
  40. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/main/binary-i386/Packages  404  Not Found  
  41.   
  42. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/restricted/binary-i386/Packages  404  Not Found  
  43.   
  44. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/universe/binary-i386/Packages  404  Not Found  
  45.   
  46. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty/multiverse/binary-i386/Packages  404  Not Found  
  47.   
  48. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/main/source/Sources  404  Not Found  
  49.   
  50. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/restricted/source/Sources  404  Not Found  
  51.   
  52. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/universe/source/Sources  404  Not Found  
  53.   
  54. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/multiverse/source/Sources  404  Not Found  
  55.   
  56. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/main/binary-i386/Packages  404  Not Found  
  57.   
  58. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/restricted/binary-i386/Packages  404  Not Found  
  59.   
  60. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/universe/binary-i386/Packages  404  Not Found  
  61.   
  62. W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/natty-updates/multiverse/binary-i386/Packages  404  Not Found  
  63.   
  64. W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/universe/source/Sources  404  Not Found [IP: 91.189.92.200 80]  
  65.   
  66. W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/multiverse/source/Sources  404  Not Found [IP: 91.189.92.200 80]  
  67.   
  68. W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/universe/binary-i386/Packages  404  Not Found [IP: 91.189.92.200 80]  
  69.   
  70. W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/multiverse/binary-i386/Packages  404  Not Found [IP: 91.189.92.200 80]  
  71.   
  72. W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/main/source/Sources  404  Not Found [IP: 91.189.92.200 80]  
  73.   
  74. W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/restricted/source/Sources  404  Not Found [IP: 91.189.92.200 80]  
  75.   
  76. W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/main/binary-i386/Packages  404  Not Found [IP: 91.189.92.200 80]  
  77.   
  78. W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/natty-security/restricted/binary-i386/Packages  404  Not Found [IP: 91.189.92.200 80]  
  79.   
  80. W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/natty/main/source/Sources  404  Not Found  
  81.   
  82. W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/natty/main/binary-i386/Packages  404  Not Found  
  83.   
  84. E: Some index files failed to download. They have been ignored, or old ones used instead.  
  85. chaihuasong@chaihuasong:~$ sudo apt-get install git  
  86. Reading package lists... Done  
  87. Building dependency tree         
  88. Reading state information... Done  
  89. E: Unable to locate package git  

发现很多源找不到,需要重新寻找更新源,最后把/etc/apt/sources.list文件中的地址换成我10.04中的etc/apt/sources.list文件后再执行sudo apt-get update 后就成功了,先贴上10.04上的source.list内容,如需要,直接替换即可

deb http://mirrors.163.com/ubuntu/ lucid main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ lucid-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ lucid-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ lucid-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid-backports main restricted universe multiverse 

发现了这个源超级快的,是网易163更新服务器,亲测可用


另外附上
搜狐更新服务器:

deb http://mirrors.sohu.com/ubuntu/ lucid main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ lucid-security main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ lucid-updates main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ lucid-proposed main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ lucid main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ lucid-security main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ lucid-updates main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ lucid-proposed main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ lucid-backports main restricted universe multiverse 

这个速度也非常快,国内的源就是牛x啊~~


<think>好的,我现在需要解决用户在Ubuntu 20.04中遇到的apt-get update命令出现400和404错误的问题。首先,我得回忆一下常见的APT错误原因。通常这类错误和软件源配置有关,可能包括源列表中的错误URL、过时的GPG密钥、或者网络连接问题。 用户提到的是400 URI Failure和404 Not Found,这通常意味着APT在尝试访问某些仓库时,要么URL不正确(404),要么服务器无法处理请求(400)。首先,我应该检查用户的软件源列表,看看是否有错误的仓库地址或者已经失效的源。Ubuntu 20.04的官方源地址是http://archive.ubuntu.com/,而某些镜像源可能会出现问题。 接下来,用户可能修改了/etc/apt/sources.list文件,或者添加了第三方PPA,导致部分仓库无法访问。比如,用户可能使用了旧的或已迁移的仓库,或者PPA已经被维护者删除。这时候需要建议用户检查并注释掉这些有问题的源。 另外,GPG密钥的问题也可能导致验证失败,进而引发错误。可以建议用户更新GPG密钥,使用apt-key命令进行修复。同时,网络问题如代理设置不正确或DNS解析问题也可能导致连接失败,需要检查网络配置。 还有一个可能性是本地APT缓存损坏,这时候清除缓存并重新生成可能会有帮助。此外,确保系统时间正确,因为证书验证依赖于正确的时间设置。 最后,参考用户提供的引用[^1],虽然原本是关于Keystone和Apache的问题,但其中提到在解决类似问题时,重新安装相关软件并调整配置可能有效。不过这里的错误更可能与软件源有关,因此重点应放在源列表和网络配置上。 总结下来,解决步骤可能包括:检查软件源、更新GPG密钥、清除APT缓存、检查网络设置、确保系统时间正确。分步指导用户逐一排查这些可能性,应该能解决400和404错误。</think>Ubuntu 20.04系统中出现`apt-get update`报400/404错误的解决方案如下: ### 一、检查软件源配置 1. 备份并编辑源列表文件: ```bash sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak sudo nano /etc/apt/sources.list ``` 2. 确保所有源地址格式正确: - 官方源示例:`deb http://archive.ubuntu.com/ubuntu/ focal main restricted` - 推荐替换为国内镜像源(如清华、阿里云)可提升稳定性,例如: ```bash sudo sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list ``` ### 二、处理第三方PPA仓库 1. 检查`/etc/apt/sources.list.d/`目录下的附加源文件: ```bash ls -l /etc/apt/sources.list.d/ ``` 2. 暂时禁用可疑PPA源(通过文件名前加`#`注释或移动文件): ```bash sudo mv /etc/apt/sources.list.d/problematic-ppa.list ~/ ``` ### 三、更新元数据与密钥 1. 清理旧索引并强制刷新: ```bash sudo apt clean sudo rm -rf /var/lib/apt/lists/* sudo apt update ``` 2. 修复缺失的GPG密钥(根据错误提示中的密钥ID操作): ```bash sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys [缺失的密钥ID] ``` ### 四、网络环境诊断 1. 测试仓库连通性(以archive.ubuntu.com为例): ```bash curl -I http://archive.ubuntu.com/ubuntu/ ``` 2. 检查DNS解析: ```bash nslookup archive.ubuntu.com ``` 3. 若使用代理,确认代理配置正确: ```bash env | grep -i proxy ``` ### 五、系统时间校准 ```bash sudo timedatectl set-ntp true date # 验证时间是否准确 ``` ### 六、典型错误处理示例 当出现`404 Not Found [IP: 91.189.91.38 80]`时: 1. 检查对应仓库的发行版代号是否匹配(focal对应20.04) 2. 确认仓库路径是否包含正确的组件(如main/universe)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值