Ubuntu 22.04 jammy 的镜像使用apt update失败
创始人
2025-01-20 00:02:41
0

Ubuntu 22.04 jammy 的镜像使用apt update失败

1. 问题现象

# 下载镜像 ~]# docker pull ubuntu:22.04 22.04: Pulling from library/ubuntu 79d0ea7dc1a8: Pull complete  Digest: sha256:dfd64a3b4296d8c9b62aa3309984f8620b98d87e47492599ee20739e8eb54fbf Status: Downloaded newer image for ubuntu:22.04 docker.io/library/ubuntu:22.04  # 进入容器 docker run -it ubuntu:22.04 bash  # 更新包 root@e0ab4ec26d51:/# apt update Get:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease [270 kB] Get:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease [119 kB] Err:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C Get:3 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease [108 kB] Err:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C Get:4 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease [110 kB] Err:3 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C Err:4 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C Reading package lists... Done W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: GPG error: http://ports.ubuntu.com/ubuntu-ports jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C E: The repository 'http://ports.ubuntu.com/ubuntu-ports jammy 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. W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy-updates/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy-updates/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: GPG error: http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C E: The repository 'http://ports.ubuntu.com/ubuntu-ports 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. W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy-backports/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy-backports/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: GPG error: http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C E: The repository 'http://ports.ubuntu.com/ubuntu-ports 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. W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy-security/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: http://ports.ubuntu.com/ubuntu-ports/dists/jammy-security/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: GPG error: http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C E: The repository 'http://ports.ubuntu.com/ubuntu-ports jammy-security 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. 

2. 尝试方法

# 1.添加key文件 root@e0ab4ec26d51:/# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation # 失败,缺少命令  # 2.尝试使用gpg添加key文件 # gpg --keyserver keyserver.ubuntu.com --recv 3B4FE6ACC0B21F32 # gpg --export --armor 3B4FE6ACC0B21F32 |apt-key add - root@e0ab4ec26d51:/# gpg --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C bash: gpg: command not found root@e0ab4ec26d51:/# gpg --keyserver keyserver.ubuntu.com --recv 467B942D3A79BD29^C root@e0ab4ec26d51:/# apt install gpg Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package gpg # 失败,缺少命令  # 尝试更换apt镜像源 root@e0ab4ec26d51:/# echo "deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse " > /etc/apt/sources.list root@e0ab4ec26d51:/# apt update Get:1 http://mirrors.aliyun.com/ubuntu jammy InRelease [270 kB] Get:2 http://mirrors.aliyun.com/ubuntu jammy-security InRelease [110 kB] Get:3 http://mirrors.aliyun.com/ubuntu jammy-updates InRelease [119 kB] Err:1 http://mirrors.aliyun.com/ubuntu jammy InRelease   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C Get:4 http://mirrors.aliyun.com/ubuntu jammy-backports InRelease [108 kB] Err:2 http://mirrors.aliyun.com/ubuntu jammy-security InRelease   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C Err:3 http://mirrors.aliyun.com/ubuntu jammy-updates InRelease   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C Err:4 http://mirrors.aliyun.com/ubuntu jammy-backports InRelease   The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C Reading package lists... Done W: http://mirrors.aliyun.com/ubuntu/dists/jammy/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: http://mirrors.aliyun.com/ubuntu/dists/jammy/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: GPG error: http://mirrors.aliyun.com/ubuntu jammy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C E: The repository 'http://mirrors.aliyun.com/ubuntu jammy 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. W: http://mirrors.aliyun.com/ubuntu/dists/jammy-security/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: http://mirrors.aliyun.com/ubuntu/dists/jammy-security/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: GPG error: http://mirrors.aliyun.com/ubuntu jammy-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C E: The repository 'http://mirrors.aliyun.com/ubuntu jammy-security 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. W: http://mirrors.aliyun.com/ubuntu/dists/jammy-updates/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: http://mirrors.aliyun.com/ubuntu/dists/jammy-updates/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: GPG error: http://mirrors.aliyun.com/ubuntu jammy-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C E: The repository 'http://mirrors.aliyun.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. W: http://mirrors.aliyun.com/ubuntu/dists/jammy-backports/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: http://mirrors.aliyun.com/ubuntu/dists/jammy-backports/InRelease: The key(s) in the keyring /etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg are ignored as the file is not readable by user '_apt' executing apt-key. W: GPG error: http://mirrors.aliyun.com/ubuntu jammy-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 871920D1991BC93C E: The repository 'http://mirrors.aliyun.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. # 失败,还是不行 

3. 解决办法

# 解决方法: # 从报错来看是镜像仓库没有认证,不是安全的,可以通过 --allow-insecure-repositories 参数解决  # 以下为一般镜像仓库出问题的解决办法 1. 检查源是否正确,检查源的地址是否正确,检查源的类型是否正确;  2. 尝试更换源,更换源的方法可以参考Ubuntu官方文档;  3. 尝试更换源的类型,比如从http更换为https;  4. 尝试更换源的地址,比如从国内源更换为国外源;  5. 尝试更换源的更新方式,比如从apt-get更换为aptitude;  6. 尝试更换源的更新模式,比如从自动更新模式更换为手动更新模式;  7. 尝试更换源的更新模式,比如从自动更新模式更换为手动更新模式;  8. 尝试更换源的更新模式,比如从自动更新模式更换为手动更新模式;  9. 尝试更换源的更新模式,比如从自动更新模式更换为手动更新模式;  10. 尝试更换源的更新模式,比如从自动更新模式更换为手动更新模式;  11. 尝试更换源的更新模式,比如从自动更新模式更换为手动更新模式;  12. 尝试更换源的更新模式,比如从自动更新模式更换为手动更新模式;  13. 尝试更换源的更新模式,比如从自动更新模式更换为手动更新模式;  14. 尝试使用apt-get clean命令清理缓存;  15. 尝试使用apt-get update --allow-insecure-repositories命令允许更新不安全的源;  16. 尝试使用apt-get update --allow-unauthenticated命令允许更新不受信任的源;  17. 尝试使用apt-get update --allow-unauthenticated --allow-insecure-repositories命令允许更新不受信任和不安全的源;  18. 尝试使用apt-get update --allow-unauthenticated --allow-insecure-repositories --allow-releaseinfo-change命令允许更新不受信任、不安全和发行信息变更的源;  19. 尝试使用apt-get update --allow-unauthenticated --allow-insecure-repositories --allow-releaseinfo-change --allow-downgrades命令允许更新不受信任、不安全、发行信息变更和降级的源;  20. 尝试使用apt-get update --allow-unauthenticated --allow-insecure-repositories --allow-releaseinfo-change --allow-downgrades --allow-change-held-packages命令允许更新不受信任、不安全、发行信息变更、降级和更改已安装软件包的源。 

相关内容

热门资讯

揭露一下!决战十三水作弊码,衢... 揭露一下!决战十三水作弊码,衢州都莱辅助器免费,一直真的有挂(哔哩哔哩)1、每一步都需要思考,不同水...
有挂一下!聚财平台辅助,浙江宝... 有挂一下!聚财平台辅助,浙江宝宝游戏辅助软件,真是真的有挂(哔哩哔哩);1、完成聚财平台辅助辅助器v...
解谜一下!蜀山四川小程序辅助插... 解谜一下!蜀山四川小程序辅助插件,微友联盟辅助,切实存在有挂(哔哩哔哩)1)蜀山四川小程序辅助插件辅...
必备一下!小松宿松游戏辅助,盛... 必备一下!小松宿松游戏辅助,盛世辅助器,果然是有挂(哔哩哔哩)1、许多玩家不知道小松宿松游戏辅助辅助...
关于一下!都莱软件安装辅助,广... 关于一下!都莱软件安装辅助,广东雀神挂件怎么样,竟然是真的有挂(哔哩哔哩)1)广东雀神挂件怎么样免费...
总结一下!福建微乐小程序修改器... 总结一下!福建微乐小程序修改器,微友辅助神器下载,竟然存在有挂(哔哩哔哩)福建微乐小程序修改器是不是...
揭露一下!多乐跑胡子辅助,潮汕... 揭露一下!多乐跑胡子辅助,潮汕木虱有辅助挂吗,一直真的有挂(哔哩哔哩)一、潮汕木虱有辅助挂吗可以开透...
推荐一下!微乐小程序辅助收费,... 推荐一下!微乐小程序辅助收费,创思维辅助器,都是存在有挂(哔哩哔哩)所有人都在同一条线上,像星星一样...
普及一下!逗娱碰胡辅助器,潮汕... 普及一下!逗娱碰胡辅助器,潮汕掌手娱辅助器,本来真的有挂(哔哩哔哩)1、下载好逗娱碰胡辅助器正确养号...
教你一下!老友辅助器,邯郸胡乐... 教你一下!老友辅助器,邯郸胡乐修改器,好像有挂(哔哩哔哩)1、上手简单,内置详细流程视频教学,新手小...