• apt-get update报错解决方法


    前言

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

    一 出错现象

    现象

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

    1. # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    2. # newer versions of the distribution.
    3. deb http://archive.ubuntu.com/ubuntu/ focal main restricted
    4. # deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted
    5. ## Major bug fix updates produced after the final release of the
    6. ## distribution.
    7. deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
    8. # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
    9. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    10. ## team. Also, please note that software in universe WILL NOT receive any
    11. ## review or updates from the Ubuntu security team.
    12. deb http://archive.ubuntu.com/ubuntu/ focal universe
    13. # deb-src http://archive.ubuntu.com/ubuntu/ focal universe
    14. deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
    15. # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates universe
    16. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    17. ## team, and may not be under a free licence. Please satisfy yourself as to
    18. ## your rights to use the software. Also, please note that software in
    19. ## multiverse WILL NOT receive any review or updates from the Ubuntu
    20. ## security team.
    21. deb http://archive.ubuntu.com/ubuntu/ focal multiverse
    22. # deb-src http://archive.ubuntu.com/ubuntu/ focal multiverse
    23. deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
    24. # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
    25. ## N.B. software from this repository may not have been tested as
    26. ## extensively as that contained in the main release, although it includes
    27. ## newer versions of some applications which may provide useful features.
    28. ## Also, please note that software in backports WILL NOT receive any review
    29. ## or updates from the Ubuntu security team.
    30. deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
    31. # deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
    32. ## Uncomment the following two lines to add software from Canonical's
    33. ## 'partner' repository.
    34. ## This software is not part of Ubuntu, but is offered by Canonical and the
    35. ## respective vendors as a service to Ubuntu users.
    36. # deb http://archive.canonical.com/ubuntu focal partner
    37. # deb-src http://archive.canonical.com/ubuntu focal partner
    38. deb http://security.ubuntu.com/ubuntu/ focal-security main restricted
    39. # deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted
    40. deb http://security.ubuntu.com/ubuntu/ focal-security universe
    41. # deb-src http://security.ubuntu.com/ubuntu/ focal-security universe
    42. deb http://security.ubuntu.com/ubuntu/ focal-security multiverse
    43. # deb-src http://security.ubuntu.com/ubuntu/ focal-security multiverse

    然后就可以$ sudo apt-get update

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

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

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

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

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

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

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

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

    总结

            加油。

  • 相关阅读:
    Element树形控件使用过程中遇到的问题及解决方法
    怎么把Excel转换成PDF格式?这三种方法轻松完成转换
    【最新】如何在CSDN个人主页左侧栏添加二维码?侧边推广怎么弄?
    hive-行转列
    LAMP--实战部署步骤--httpd-2.4--mysql-5.7--php8
    网络的常见度量属性
    金融知识分析系列之:期货种类、T+0期货品种、期货IF、沪深300股指期货、IF交割月份
    Linux基本命令简单介绍
    Java泛型
    KMP算法
  • 原文地址:https://blog.csdn.net/yueni_zhao/article/details/126703823