debian或者Ubuntu在使用apt-get update出现GPG erro

问题:debian 9.x stretch

  • GPG error: http://mirrors.aliyun.com/debian-archive/debian stretch-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 648ACFD622F3D138 NO_PUBKEY 0E98404D386FA1D9

解决方法:
有可能是授权或证书失效
执行如下命令:apt install debian-keyring debian-archive-keyring 然后执行apt-get update

root@local:/var/www/html# apt install debian-keyring debian-archive-keyring
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  debian-keyring
The following packages will be upgraded:
  debian-archive-keyring
1 upgraded, 1 newly installed, 0 to remove and 33 not upgraded.
Need to get 33.3 MB of archives.
After this operation, 35.0 MB of additional disk space will be used.
Get:1 http://mirrors.aliyun.com/debian-archive/debian stretch/main arm64 debian-archive-keyring all 2017.5+deb9u1 [73.9 kB]
10% [Waiting for headers]
10% [Waiting for headers]
Get:2 http://mirrors.aliyun.com/debian-archive/debian stretch/main arm64 debian-keyring all 2017.05.28 [33.2 MB]
Fetched 33.3 MB in 35s (949 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 28767 files and directories currently installed.)
Preparing to unpack .../debian-archive-keyring_2017.5+deb9u1_all.deb ...
Unpacking debian-archive-keyring (2017.5+deb9u1) over (2017.5) ...
Setting up debian-archive-keyring (2017.5+deb9u1) ..............................]
Removing obsolete conffile /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg ...ess: [ 36%] [######################........................................]
Removing obsolete conffile /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg ...
Selecting previously unselected package debian-keyring.
(Reading database ... 28768 files and directories currently installed.).........]
Preparing to unpack .../debian-keyring_2017.05.28_all.deb ...
Unpacking debian-keyring (2017.05.28) ...
Setting up debian-keyring (2017.05.28) ...#########.............................]
root@local:/var/www/html# apt-get update
Ign:1 http://mirrors.aliyun.com/debian-archive/debian stretch InRelease
Get:2 http://mirrors.aliyun.com/debian-archive/debian stretch-backports InRelease [78.5 kB]
Hit:3 http://mirrors.aliyun.com/debian-archive/debian stretch Release
Fetched 78.5 kB in 0s (190 kB/s)
Reading package lists... Done


root@local:/var/www/html# apt update
Ign:1 http://mirrors.aliyun.com/debian-archive/debian stretch InRelease
Hit:2 http://mirrors.aliyun.com/debian-archive/debian stretch-backports InRelease
Hit:3 http://mirrors.aliyun.com/debian-archive/debian stretch Release
Reading package lists... Done
Building dependency tree
Reading state information... Done
33 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@ubuntu:~/exploit-CVE-2015-3306-master# vi Dockerfile root@ubuntu:~/exploit-CVE-2015-3306-master# docker build -t vuln/cve-2015-3306 . [+] Building 8.4s (7/10) docker:default => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 827B 0.0s => WARN: MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label (line 5) 0.0s => [internal] load metadata for docker.io/library/debian:jessie 0.3s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => CACHED [1/6] FROM docker.io/library/debian:jessie@sha256:32ad5050caffb2c7e969dac873bce2c370015c2256ff 0.0s => [internal] load build context 0.0s => => transferring context: 29B 0.0s => [2/6] RUN sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list && sed -i 's|secur 0.3s => ERROR [3/6] RUN apt-get update && apt-get upgrade -y && DEBIAN_FRONTEND=noninteractive apt-ge 7.8s ------ > [3/6] RUN apt-get update && apt-get upgrade -y && DEBIAN_FRONTEND=noninteractive apt-get install -y wget apache2 php5 gcc make && apt-get clean && rm -rf /var/lib/apt/lists/*: 0.799 Ign http://archive.debian.org jessie InRelease 1.249 Ign http://archive.debian.org jessie/updates InRelease 1.514 Ign http://archive.debian.org jessie-updates InRelease 1.618 Get:1 http://archive.debian.org jessie Release.gpg [2420 B] 2.168 Ign http://archive.debian.org jessie/updates Release.gpg 2.421 Ign http://archive.debian.org jessie-updates Release.gpg 2.523 Get:2 http://archive.debian.org jessie Release [148 kB] 2.754 Ign http://archive.debian.org jessie Release 3.305 Ign http://archive.debian.org jessie/updates Release 3.558 Ign http://archive.debian.org jessie-updates Release 3.658 Get:3 http://archive.debian.org jessie/main amd64 Packages [9098 kB] 7.468 Err http://archive.debian.org jessie/updates/main amd64 Packages 7.468 404 Not Found [IP: 151.101.130.132 80] 7.723 Err http://archive.debian.org jessie-updates/main amd64 Packages 7.723 404 Not Found [IP: 151.101.130.132 80] 7.724 Fetched 9249 kB in 7s (1260 kB/s) 7.725 W: GPG error: http://archive.debian.org jessie Release: The following signatures were invalid: KEYEXPIRED 1587841717 7.725 W: Failed to fetch http://archive.debian.org/debian-security/debian-security/dists/jessie/updates/main/binary-amd64/Packages 404 Not Found [IP: 151.101.130.132 80] 7.725 7.725 W: Failed to fetch http://archive.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages 404 Not Found [IP: 151.101.130.132 80] 7.725 7.725 E: Some index files failed to download. They have been ignored, or old ones used instead. ------ 1 warning found (use docker --debug to expand): - MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label (line 5) Dockerfile:11 -------------------- 10 | # install debian stuff 11 | >>> RUN apt-get update && \ 12 | >>> apt-get upgrade -y && \ 13 | >>> DEBIAN_FRONTEND=noninteractive apt-get install -y \ 14 | >>> wget apache2 php5 gcc make \ 15 | >>> && apt-get clean && rm -rf /var/lib/apt/lists/* 16 | -------------------- ERROR: failed to solve: process "/bin/sh -c apt-get update && apt-get upgrade -y && DEBIAN_FRONTEND=noninteractive apt-get install -y wget apache2 php5 gcc make && apt-get clean && rm -rf /var/lib/apt/lists/*" did not complete successfully: exit code: 100 更改以后运行命令还是爆粗
最新发布
07-05
### 解决方案 当遇到 `sudo apt-get update` 导致的无效操作错误,通常是因为系统软件源配置文件存在问题、网络连接不稳定或者某些仓库不可访问等原因引起的。以下是详细的解决方法: #### 1. 检查 `/etc/apt/sources.list` 文件 确保系统的软件源配置文件没有语法错误或指向不存在的地址。可以打开该文件并检查其内容是否合理: ```bash sudo nano /etc/apt/sources.list ``` 常见的有效条目如下所示[^3]: ``` deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse ``` #### 2. 清理缓存并重置 APT 配置 有旧的缓存数据可能导致问题。可以通过清理缓存来尝试解决问题: ```bash sudo rm -rf /var/lib/apt/lists/* sudo mkdir -p /var/lib/apt/lists/partial sudo apt-get clean ``` 之后再次运行更新命令。 #### 3. 使用 `-o Debug::Acquire::http=true` 参数调试 HTTP 请求 通过启用调试模式查看具体的请求失败原因: ```bash sudo apt-get update -o Debug::Acquire::http=true ``` 这可以帮助定位是否有特定 URL 返回了错误状态码。 #### 4. 替换国内镜像源 如果默认官方源无法正常使用,建议更换为更稳定的国内镜像站点,比如阿里云、清华大学开源软件镜像站等。编辑 sources.list 文件并将所有链接替换为对应的镜像地址。例如对于阿里云: ``` deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse ... ``` #### 5. 更新 CA 证书库 (针对 SSL/TLS 错误) 部分情况下由于缺少最新的根证书也可能引发 HTTPS 连接失败的情况。此应先手动下载并安装最新版 ca-certificates 软件包后再试一次: ```bash wget https://ftp.debian.org/debian/pool/main/c/ca-certificates/ca-certificates_20230719_all.deb sudo dpkg -i ./ca-certificates*.deb sudo apt-get install --reinstall ca-certificates ``` #### 6. 如果仍然存在 Err/W 提示,则逐一排查具体项 根据实际输出中的 Error 或 Warning 条目分别处理每一条警告信息直到全部清除为止。一般常见的是 GPG key 不匹配或者是临 DNS 故障等问题。 --- ### 总结 以上步骤涵盖了大部分场景下修复 `sudo apt-get update` 失败的方法。按照顺序依次执行直至恢复正常功能即可。 ```python print("APT Update Fixed!") ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值