NO_PUBKEY for apt.releases.hashicorp.com in apt

huangapple go评论63阅读模式
英文:

NO_PUBKEY for apt.releases.hashicorp.com in apt

问题

当运行 sudo apt update 时,我遇到以下错误:

Err:4 https://apt.releases.hashicorp.com focal InRelease                                                                               
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY AA16FCBCA621E701

如何修复这个问题?

英文:

When running sudo apt update, I am presented with the following error:

Err:4 https://apt.releases.hashicorp.com focal InRelease                                                                               
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY AA16FCBCA621E701

How can I fix this?

答案1

得分: 11

移除/etc/apt/sources.list.d/目录下现有的Hashicorp文件,然后按照官方指南执行以下步骤:

sudo -s
wget -O- https://apt.releases.hashicorp.com/gpg |
    gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg

echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" > /etc/apt/sources.list.d/hashicorp.list
apt update
英文:

Remove the exiting Hashicorp files under /etc/apt/sources.list.d/ and then follow the official guide:

sudo -s
wget -O- https://apt.releases.hashicorp.com/gpg |
    gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg

echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" > /etc/apt/sources.list.d/hashicorp.list
apt update

答案2

得分: 0

The GPG key is outdated or missing.

Run this code to remove the outdated key sudo rm /usr/share/keyrings/hashicorp-archive-keyring.gpg

And this to obtain the current key: curl https://apt.releases.hashicorp.com/gpg | gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg

I had to run the last one under root (sudo -s), as I couldn't get sudo to work with the pipe character. Not really sure why.

英文:

The GPG key is outdated or missing.

Run this code to remove the outdated key sudo rm /usr/share/keyrings/hashicorp-archive-keyring.gpg

And this to obtain the current key: curl https://apt.releases.hashicorp.com/gpg | gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg

I had the run that last one under root (sudo -s), as I couldn't get sudo to play ball with the pipe character. Not really sure why

答案3

得分: 0

问题出在正在使用的sources.list文件。最终它链接到一个密钥环,其中不包含密钥AA16FCBCA621E701

在我的情况下,这个文件是/etc/apt/sources.list.d/hashicorp.list

deb [arch=amd64 signed-by=/usr/share/keyrings/terraform-archive-keyring.gpg] https://apt.releases.hashicorp.com jammy main

上述说明(感谢MacroMan),引导我到了这里(它创建了一个新的有效的hashicorp-archive-keyring.gpg,他的原始指令除非你以su - root身份运行,否则不起作用,而我从不这样做)

curl https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg

使用新的密钥环,编辑上述文件,将terraform-archive-keyring.gpg替换为hashicorp-archive-keyring.gpg,然后运行sudo apt-get update时不应出现错误。

或者(我没有运行这个,但有人可能会发现它有用,因为它使用sudo tee重新创建了sources.list,所以不需要以root身份运行,就像>一样)

echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee  etc/apt/sources.list.d/hashicorp.list
英文:

So the problem is with the sources.list file being used. Ultimately it links to a keyring, which doesn't contain key AA16FCBCA621E701.

In my case this was the file /etc/apt/sources.list.d/hashicorp.list

deb [arch=amd64 signed-by=/usr/share/keyrings/terraform-archive-keyring.gpg] https://apt.releases.hashicorp.com jammy main

The above notes (thank you MacroMan), led me to this (which creates a new, valid hashicorp-archive-keyring.gpg, his original instructions don't work unless you're running as su - root, which I never do)

curl https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg

With the new keyring, edit the above file to replace terraform-archive-keyring.gpg with hashicorp-archive-keyring.gpg and sudo apt-get update should run without errors.

Alternatively (I didn't run this, but someone might find it useful, as it recreates the sources.list using sudo tee, so doesnt need to be run as root, as > does)

echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee  etc/apt/sources.list.d/hashicorp.list

huangapple
  • 本文由 发表于 2023年2月6日 21:52:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/75362188.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定