• ubuntu apt-get update 失败 server certificate verification failed


    报错提示

    执行sudo apt-get update时,报错如下

    Ign:188 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/multiverse Translation-en
    Ign:189 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/multiverse amd64 DEP-11 Metadata
    Ign:190 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/multiverse DEP-11 64x64 Icons
    Err:121 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial/main amd64 Packages
    server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

    Ign:122 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial/main i386 Packages
    Ign:123 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial/main Translation-en

    Reading package lists… Done
    W: The repository ‘https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial Release’ does not have a Release file.
    N: Data from such a repository can’t be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: The repository ‘https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates Release’ does not have a Release file.
    N: Data from such a repository can’t be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: The repository ‘https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports Release’ does not have a Release file.
    N: Data from such a repository can’t be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: The repository ‘https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security Release’ does not have a Release file.
    N: Data from such a repository can’t be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    E: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/xenial-backports/restricted/binary-amd64/Packages server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
    E: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/xenial/main/binary-amd64/Packages server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
    E: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/xenial-updates/main/binary-amd64/Packages server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
    E: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/xenial-security/main/binary-amd64/Packages server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
    E: Some index files failed to download. They have been ignored, or old ones used instead.

    解决方法

    step 1

    将 /etc/apt/sources.list 中的https 都替换成 http,我使用的是清华源,ubuntu16.04,修改后如下

    # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
    deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
    deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
    deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
    deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
    
    # 预发布软件源,不建议启用
    # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    step 2

    sudo apt-get update
    sudo apt-get upgrade

    step 3

    把step 1的修改复原即可,复原后如下

    # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
    
    # 预发布软件源,不建议启用
    # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
  • 相关阅读:
    MFC耗时操作增加模态旋转等待对话框
    【BUG记录】关于linux/pytorch等操作/BUG记录——持续更新
    Gridea,一个小而美的博客梦想桥梁
    KMP算法
    随机生成一个指定边数多边形
    “ BallEventsPersist“ app Tech Support(URL)
    jsencrypt与base64加密解密的实用流程
    数据库开发-Mysql03
    深度讲解TS:这样学TS,迟早进大厂【10】:函数的类型
    面试突击52:什么是三范式?它有什么用?
  • 原文地址:https://blog.csdn.net/weixin_43512663/article/details/127582311