Ubuntu执行sudo apt-get update报错W: An error occurred during the signature verification. The repository

Ubuntu执行sudo apt-get update报错W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used

报错内容:

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://pkg.jenkins.io/debian-stable binary/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5BA31D57EF5975CA
E: Failed to fetch https://mirrors.aliyun.com/docker-ce/linux/ubuntu/dists/xenial/InRelease  Unable to find expected entry 'stable/source/Sources' in Release file (Wrong sources.list entry or malformed file)
W: Failed to fetch https://pkg.jenkins.io/debian-stable/binary/Release.gpg  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 5BA31D57EF5975CA
W: Some index files failed to download. They have been ignored, or old ones used instead.

报错原因:

错误是由于缺少公钥导致的。可以通过以下命令添加公钥:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5BA31D57EF5975CA

# 关于第二个错误,可能是因为源列表中的条目不正确或文件格式不正确。可以检查源列表文件
# (/etc/apt/sources.list)中的条目是否正确,并尝试使用正确的条目更新。

解决办法:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5BA31D57EF5975CA
Executing: /tmp/tmp.LxWK4WC50x/gpg.1.sh --keyserver
keyserver.ubuntu.com
--recv-keys
5BA31D57EF5975CA
gpg: requesting key EF5975CA from hkp server keyserver.ubuntu.com
gpg: key EF5975CA: "Jenkins Project " not changed
gpg: Total number processed: 1
gpg:              unchanged: 1


# 这个输出表示已经成功从 keyserver.ubuntu.com 服务器上获取了公钥 5BA31D57EF5975CA。
# 由于该公钥已经存在,因此输出中包含 "unchanged: 1"。
# 现在再次尝试运行sudo apt-get update命令,应该会成功更新索引文件。

你可能感兴趣的:(Linux,ubuntu,linux)