当前位置: 首页 > 工具软件 > Tencent APT > 使用案例 >

apt-get update报错解决方法

梁丘洲
2023-12-01

前言

       经过反复折腾,总结一下,最后最有效的还是是从别的ubuntu中复制一份source.list过来,其他的方法都会有各种各样的后遗症。

一 出错现象

现象

kmao@lkmao-ubuntu:~/thrift/thrift-0.16.0$ sudo apt-get update
忽略:1 https://mirrors.cloud.tencent.com/ubuntu impish InRelease
忽略:2 https://mirrors.cloud.tencent.com/ubuntu impish-updates InRelease
忽略:3 https://mirrors.cloud.tencent.com/ubuntu impish-backports InRelease
忽略:4 https://mirrors.cloud.tencent.com/ubuntu impish-security InRelease
错误:5 https://mirrors.cloud.tencent.com/ubuntu impish Release
  404  Not Found [IP: 222.73.132.205 443]
错误:6 https://mirrors.cloud.tencent.com/ubuntu impish-updates Release
  404  Not Found [IP: 222.73.132.205 443]
错误:7 https://mirrors.cloud.tencent.com/ubuntu impish-backports Release
  404  Not Found [IP: 222.73.132.205 443]
错误:8 https://mirrors.cloud.tencent.com/ubuntu impish-security Release
  404  Not Found [IP: 222.73.132.205 443]
正在读取软件包列表... 完成
E: 仓库 “https://mirrors.cloud.tencent.com/ubuntu impish Release” 不再含有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 “https://mirrors.cloud.tencent.com/ubuntu impish-updates Release” 不再含有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 “https://mirrors.cloud.tencent.com/ubuntu impish-backports Release” 不再含有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
E: 仓库 “https://mirrors.cloud.tencent.com/ubuntu impish-security Release” 不再含有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
lkmao@lkmao-ubuntu:~/thrift/thrift-0.16.0$ 

   出错解析    

         这个错误呢,我的起因是因为以前改过/etc/apt/source.list文件,我觉得这种问题最快的解决方法就是,删掉它,然后重新弄一个管用的/etc/apt/source.list过来.

        大家看到/etc目录,要有那种第一反应就是,啊,这个是linux启动配置目录,然后再看到apt,就会联想到,啊,原来是apt软件在etc目录的配置目录,就是apt软件的配置文件,如果能有这个觉悟,其他的就大胆联想,大胆尝试吧。

二 解决方案

1.进入/etc/apt/目录,将source.list文件重命名为source.list.backup

2,新建source.list文件

3.将下面的内容放到source.list文件中

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ focal main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ focal universe
# deb-src http://archive.ubuntu.com/ubuntu/ focal universe
deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu/ focal multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner

deb http://security.ubuntu.com/ubuntu/ focal-security main restricted
# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted
deb http://security.ubuntu.com/ubuntu/ focal-security universe
# deb-src http://security.ubuntu.com/ubuntu/ focal-security universe
deb http://security.ubuntu.com/ubuntu/ focal-security multiverse
# deb-src http://security.ubuntu.com/ubuntu/ focal-security multiverse

然后就可以$ sudo apt-get update

kmao@lkmao-ubuntu:/etc/apt$ sudo apt-get update
获取:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
获取:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
获取:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
获取:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
获取:5 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1,705 kB]
/*略*/
获取:108 http://archive.ubuntu.com/ubuntu focal-backports/universe DEP-11 64x64@2 Icons [29 B]
获取:109 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [860 B]
获取:110 http://archive.ubuntu.com/ubuntu focal-backports/multiverse amd64 c-n-f Metadata [116 B]
已下载 51.8 MB,耗时 20秒 (2,623 kB/s)                                         
正在读取软件包列表... 完成

lkmao@lkmao-ubuntu:/etc/apt$

三 如果直接删除source.list会怎么样?

这个简单,直接重命名就可以,现象也很简单,如下所示:

lkmao@lkmao-ubuntu:/etc/apt$ sudo apt-get update
正在读取软件包列表... 完成

试完了,记得把名字改回来。

四 如果还不能解决问题,怎么办?

        新安装一个虚拟机,将虚拟机中的/etc/apt目录中的文件打包,然后复制到出问题的ubuntu虚拟机中。

验证下:(⊙o⊙),我都安装新的系统了,为啥还要解决这个问题啊?用新的。

总结

        加油。

 类似资料: