Ubuntu的软件源更新常见问题及解决

最近家里的网可能被天朝了,一直很好用的更新设置,出现各种错误,但在公司可以,所以应该是网络的问题,所以把遇到的问题整理了一下:

问题一:

执行命令

sudo apt-get update

错误描述如下:

复制代码
W: Failed to fetch http://mirrors.sohu.com/ubuntu/dists/precise/universe/i18n/Index  No Hash entry in Release file /var/lib/apt/lists/partial/mirrors.sohu.com_ubuntu_dists_precise_universe_i18n_Index

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/mirrors.sohu.com_ubuntu_dists_precise-updates_main_binary-i386_Packages  Hash Sum mismatch

W: Failed to fetch bzip2:/var/lib/apt/lists/partial/extras.ubuntu.com_ubuntu_dists_precise_main_binary-i386_Packages  Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.
复制代码

解决方法:

将/var/lib/apt/lists/partial/下的所有文件删除,但是这可以解决大部分问题,个别源不能解决,如"/var/lib/apt/lists/partial/extras.ubuntu.com_ubuntu_dists_precise_main_binary-i386_Packages",无耐进入/var/lib/apt/lists/将对应的文件删除

注:经过长时间的实践,这个解决方法不是万能的,最终解决方法还是FQ吧。 

 

问题二:

无法找到对应的KEY

W : GPG  error: http://mirrors.sohu.com precise Release: The following signatures couldn't be verified because the public key is not  available: NO_PUBKEY  40976EAF437D05B5
W : GPG  error: http://mirrors.sohu.com precise-updates Release: The following signatures couldn't be verified because the public key is not  available: NO_PUBKEY  40976EAF437D05B5
W : GPG  error: http://mirrors.sohu.com precise-proposed Release: The following signatures couldn't be verified because the public key is not  available: NO_PUBKEY  40976EAF437D05B5
W : GPG  error: http://archive.canonical.com precise Release: The following signatures couldn't be verified because the public key is not  available: NO_PUBKEY  40976EAF437D05B5
W : GPG  error: http://security.ubuntu.com precise-security Release: The following signatures couldn't be verified because the public key is not  available: NO_PUBKEY  40976EAF437D05B5

解决方法:

使用如下命令:

gpg --keyserver subkeys.pgp.net --recv-keys 40976EAF437D05B5
gpg -a --export 40976EAF437D05B5  | sudo apt-key add -

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Ubuntu中,你可以通过以下步骤来更换: 1. 首先,打开终端。你可以使用快捷键Ctrl+Alt+T来打开终端。 2. 接下来,输入以下命令来备份你的列表文件: ```shell sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak ``` 3. 然后,编辑列表文件。你可以使用以下命令打开列表文件: ```shell sudo nano /etc/apt/sources.list ``` 4. 在列表文件中,你可以选择删除所有内容,然后将以下内容粘贴到文件中: (根据你的Ubuntu版本选择对应的) 对于Ubuntu 22.04 (Jammy): ```shell deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse ``` 对于Ubuntu 20.04 (Focal): ```shell deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse ``` 对于Ubuntu 18.04 (Bionic): ```shell deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse ``` 对于Ubuntu 16.04 (Xenial): ```shell deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse ``` 对于Ubuntu 14.04 (Trusty): ```shell deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse ``` 5. 保存更改并关闭列表文件。你可以使用Ctrl+X来退出,然后按Y键来保存更改。 6. 最后,更新列表以使更改生效。输入以下命令: ```shell sudo apt update ``` 现在,你的Ubuntu系统已经成功更换了。这样,当你使用命令行安装软件时,下载速度应该会更快了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [Ubuntu快速更换](https://blog.csdn.net/Lanyan9/article/details/125493390)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [Ubuntu详解,教你如何换,并且解决常见的大坑](https://blog.csdn.net/apple_51720004/article/details/125105945)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值