美文网首页
解决ubuntu报apt-get update错误

解决ubuntu报apt-get update错误

作者: liurongming | 来源:发表于2022-09-28 18:13 被阅读0次

    本地安装Ubuntu 22.04.1 LTS 后报 Clearsigned file isn't valid 相关错误。

    root@ubuntu:/etc/apt# cat /etc/os-release
    PRETTY_NAME="Ubuntu 22.04.1 LTS"
    NAME="Ubuntu"
    VERSION_ID="22.04"
    VERSION="22.04.1 LTS (Jammy Jellyfish)"
    VERSION_CODENAME=jammy
    ID=ubuntu
    ID_LIKE=debian
    HOME_URL="https://www.ubuntu.com/"
    SUPPORT_URL="https://help.ubuntu.com/"
    BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
    PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
    UBUNTU_CODENAME=jammy
    root@ubuntu:/etc/apt# 
    

    报错信息:

    root@ubuntu:/etc/apt# sudo apt-get update Clearsigned file isn't valid
    Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [2,664 B]                                       
    Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease                                                                                 
      Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
    Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [2,664 B]                                                             
    Err:2 http://security.ubuntu.com/ubuntu jammy-security InRelease                       
      Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
    Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [2,664 B]               
    Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease                   
      Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
    Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [2,664 B]       
    Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
      Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
    Reading package lists... Done
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    E: The repository 'http://archive.ubuntu.com/ubuntu jammy InRelease' is not signed.
    E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    E: The repository 'http://security.ubuntu.com/ubuntu jammy-security InRelease' is not signed.
    E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
    E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
    E: The repository 'http://archive.ubuntu.com/ubuntu jammy-updates InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
    E: The repository 'http://archive.ubuntu.com/ubuntu jammy-backports InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    root@ubuntu:/etc/apt# 
    
    

    初步可以认定为网络问题。因此解决方式,可通过调整网络或切换国内源解决。
    1、切换网络,使用代理软件即可。亲测可行。
    2、更换apt源。以下采用此方法解决。
    初始安装,可以查看默认配置为:

    root@ubuntu:/etc/apt# cat /etc/os-release
    PRETTY_NAME="Ubuntu 22.04.1 LTS"
    NAME="Ubuntu"
    VERSION_ID="22.04"
    VERSION="22.04.1 LTS (Jammy Jellyfish)"
    VERSION_CODENAME=jammy
    ID=ubuntu
    ID_LIKE=debian
    HOME_URL="https://www.ubuntu.com/"
    SUPPORT_URL="https://help.ubuntu.com/"
    BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
    PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
    UBUNTU_CODENAME=jammy
    root@ubuntu:/etc/apt# clear
    root@ubuntu:/etc/apt# pwd
    /etc/apt
    root@ubuntu:/etc/apt# cat /etc/apt/sources.list
    # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    # newer versions of the distribution.
    deb http://archive.ubuntu.com/ubuntu/ jammy main restricted
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted
    
    ## Major bug fix updates produced after the final release of the
    ## distribution.
    deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy-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/ jammy universe
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy universe
    deb http://archive.ubuntu.com/ubuntu/ jammy-updates universe
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy-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/ jammy multiverse
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy multiverse
    deb http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy-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/ jammy-backports main restricted universe multiverse
    # deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
    
    deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted
    # deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted
    deb http://security.ubuntu.com/ubuntu/ jammy-security universe
    # deb-src http://security.ubuntu.com/ubuntu/ jammy-security universe
    deb http://security.ubuntu.com/ubuntu/ jammy-security multiverse
    # deb-src http://security.ubuntu.com/ubuntu/ jammy-security multiverse
    root@ubuntu:/etc/apt# 
    

    因此将以上*ubuntu.com替换成国内源地址即可,
    如华为源:http://repo.huaweicloud.com/ubuntu/,其他源参考替换即可

    sudo sed -i "s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list
    sudo sed -i "s@http://.*security.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list
    

    执行命令

    sudo apt-get update
    root@ubuntu:/etc/apt# sudo apt-get update
    Hit:1 http://repo.huaweicloud.com/ubuntu jammy InRelease
    Hit:2 http://repo.huaweicloud.com/ubuntu jammy-updates InRelease
    Hit:3 http://repo.huaweicloud.com/ubuntu jammy-backports InRelease
    Hit:4 http://repo.huaweicloud.com/ubuntu jammy-security InRelease
    Reading package lists... Done
    root@ubuntu:/etc/apt# 
    

    至此,问题已经得到解决。

    附录:
    部分虚拟机安装不上ubuntu,很可能是hyper-v冲突。
    因此将hyper-v从电脑中卸除。可以开始安装vmware虚拟机软件或者其他第三方虚拟机软件。管理权限打开powsershell执行命令,重启系统即可。

    bcdedit /set hypervisorlaunchtype off
    

    相关文章

      网友评论

          本文标题:解决ubuntu报apt-get update错误

          本文链接:https://www.haomeiwen.com/subject/txicartx.html