MongoDB GPG - 无效签名
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34733340/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MongoDB GPG - Invalid Signatures
提问by Assaf Hershko
I'm installing MongoDB on an Ubuntu 14.04 machine, using the instructions at: https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
我正在 Ubuntu 14.04 机器上安装 MongoDB,使用以下说明:https: //docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
So I run:
所以我运行:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
And then:
进而:
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
Followed by:
其次是:
sudo apt-get update
I then get the following warning at the end of the update:
然后我在更新结束时收到以下警告:
W: GPG error: http://repo.mongodb.orgtrusty/mongodb-org/3.2 Release: The following signatures were invalid: BADSIG D68FA50FEA312927 MongoDB 3.2 Release Signing Key
W:GPG 错误:http://repo.mongodb.org trusty/mongodb-org/3.2 Release:以下签名无效:BADSIG D68FA50FEA312927 MongoDB 3.2 Release Signing Key
If I ignore the warning and try to run:
如果我忽略警告并尝试运行:
sudo apt-get install -y mongodb-org
I get:
我得到:
WARNING: The following packages cannot be authenticated!
mongodb-org-shell mongodb-org-server mongodb-org-mongos mongodb-org-tools mongodb-org E: There are problems and -y was used without --force-yes
警告:无法验证以下包!
mongodb-org-shell mongodb-org-server mongodb-org-mongos mongodb-org-tools mongodb-org E: 有问题,-y 没有使用--force-yes
Any ideas on how to resolve? Thanks!
关于如何解决的任何想法?谢谢!
回答by dlopatin
Update all expired keys from Ubuntu key server in one command:
用一个命令从 Ubuntu 密钥服务器更新所有过期的密钥:
sudo apt-key list | \
grep "expired: " | \
sed -ne 's|pub .*/\([^ ]*\) .*||gp' | \
xargs -n1 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys
Command explanation:
命令解释:
sudo apt-key list
- lists all keys installed in the system;grep "expired: "
- leave only lines with expired keys;sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp'
- extracts keys;xargs -n1 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys
- updates keys from Ubuntu key server by found expired ones.
sudo apt-key list
- 列出系统中安装的所有密钥;grep "expired: "
- 只留下带有过期密钥的行;sed -ne 's|pub .*/\([^ ]*\) .*|\1|gp'
- 提取密钥;xargs -n1 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys
- 通过发现过期的密钥从 Ubuntu 密钥服务器更新密钥。
回答by PyDevSRS
Sounds like you need to redo the installation steps for MongoDB. First,remove any existing repository file for MongoDB. Do as below.
听起来您需要重做 MongoDB 的安装步骤。首先,删除 MongoDB 的任何现有存储库文件。如下操作。
$ sudo rm /etc/apt/sources.list.d/mongodb*.list
Next, add the key: (without the key, the repository will not load).
接下来,添加密钥:(没有密钥,存储库将不会加载)。
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
Now, create a new MongoDB repository list file:
现在,创建一个新的 MongoDB 存储库列表文件:
$ echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
After adding the repository details, we need to update the packages list.
添加存储库详细信息后,我们需要更新包列表。
$ sudo apt-get update
Now install MongoDB.
现在安装MongoDB。
sudo apt install mongodb-org
Hope this helps !
希望这可以帮助 !
回答by Juliano ENS
You don't need to reinstall the mongo packages, but just change the key as following:
您不需要重新安装 mongo 软件包,只需按如下方式更改密钥:
List the keys to confirm it is expired:
列出密钥以确认它已过期:
apt-key list | grep "expired:"
Replace the key:
更换钥匙:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xd68fa50fea312927
The number 0xd68fa50fea312927 is the current valid key id (expires at 2019-10-09), as you can check here.
数字 0xd68fa50fea312927 是当前有效的密钥 ID(2019 年 10 月 9 日到期),您可以在此处查看。
回答by themr0c
It seems version 3.2.1 has been released on 11/Jan/2016, and the packages signature is bad since this moment. The packages signature were fine the day before.
似乎版本 3.2.1 已于 2016 年 1 月 11 日发布,并且从此刻起包签名很糟糕。包签名前一天还好。
参考文献:https://jira.mongodb.org/browse/SERVER/fixforversion/15908/ ?selectedTab =com.atlassian.jira.jira-projects-plugin:version-summary-panel
You can either add the --force-yes option, or wait for a few hours that the mongodb team sees and fixes the issue.
您可以添加 --force-yes 选项,也可以等待 mongodb 团队发现并修复问题几个小时。
There is already a ticket there: https://jira.mongodb.org/browse/SERVER-22144
回答by Fullstack Developer
I also faced this issue when installing MongoDB 4.0 on Ubuntu 16.04. So I did.
在 Ubuntu 16.04 上安装 MongoDB 4.0 时,我也遇到了这个问题。所以我做了。
sudo rm /etc/apt/sources.list.d/mongodb*.list
- remove any existing file for MongoDBsudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E52529D4
- add the keysudo bash -c 'echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.0.list'
- create a new MongoDB repository list file
sudo rm /etc/apt/sources.list.d/mongodb*.list
- 删除 MongoDB 的任何现有文件sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E52529D4
- 添加密钥sudo bash -c 'echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.0.list'
- 创建一个新的 MongoDB 存储库列表文件
Now, Complete the installation with an update of repositories then install MongoDB, enable the mongod
service and start it up, and last, check your MongoDB version:
现在,通过更新存储库完成安装,然后安装 MongoDB,启用mongod
服务并启动它,最后检查您的 MongoDB 版本:
sudo apt update
sudo apt install mongodb-org
systemctl enable mongod.service
systemctl start mongod.service
mongo --version
回答by nshah143
I also faced this issue when installing MongoDB 3.2 on my ubuntu 16.04 using the below commands. The below solution is provided as the question related to the v3.2 installation of MongoDB
使用以下命令在我的 ubuntu 16.04 上安装 MongoDB 3.2 时,我也遇到了这个问题。以下解决方案作为与MongoDB v3.2安装相关的问题提供
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update
After running the above update command i found the following warnings
运行上述更新命令后,我发现以下警告
W: GPG error: http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release: The following signatures were invalid: KEYEXPIRED 1507497109
W: The repository 'http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 Release' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
On further investigating using the below command to list all the keys
进一步调查使用以下命令列出所有键
sudo apt-key list
It shows that the current key is expired on 2017-10-08
显示当前密钥已于 2017-10-08 过期
pub 4096R/EA312927 2015-10-09 [expired: 2017-10-08]
uid MongoDB 3.2 Release Signing Key <[email protected]>
This also made sense as the MongoDB Current Stable Release is now (3.4.9).
这也是有意义的,因为 MongoDB 当前稳定版本现在是 (3.4.9)。
To fix the issue first we make a small cleanup (optional)
为了首先解决这个问题,我们做了一个小的清理(可选)
we remove the old key added
sudo apt-key list // List all keys
sudo apt-key del EA312927 // Find the uid of the key to be deleted
apt-key list | grep Mongodb // Verify if its deleted
Now we remove the MongoDB repo added in /etc/apt/sources.list.d
sudo rm /etc/apt/sources.list.d/mongodb*.list
Now we install the latest stable version of MongoDB(3.4.9) using below commands
我们删除添加的旧密钥
sudo apt-key list // 列出所有键
sudo apt-key del EA312927 // 找到要删除的key的uid
apt-key 列表 | grep Mongodb // 验证它是否被删除
现在我们删除在 /etc/apt/sources.list.d 中添加的 MongoDB 存储库
须藤rm /etc/apt/sources.list.d/mongodb*.list
现在我们使用以下命令安装最新的稳定版 MongoDB(3.4.9)
Import the Public Key used by the Ubuntu Package Manager
导入 Ubuntu 包管理器使用的公钥
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
Create a file list for mongoDB to fetch the current repository
为 mongoDB 创建文件列表以获取当前存储库
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-3.4.list
Install MongoDB
安装 MongoDB
sudo apt-get update
sudo apt-get install mongodb-org
回答by Harrison Hyunmin Cho
I had the same problem, and solved it by installing mongodb with tarball method. Refer to the below link for detail.
我遇到了同样的问题,并通过使用 tarball 方法安装 mongodb 解决了它。详情请参考以下链接。
https://docs.mongodb.org/manual/tutorial/install-mongodb-on-linux/
https://docs.mongodb.org/manual/tutorial/install-mongodb-on-linux/
Adding details below
在下面添加详细信息
- curl -O https://fastdl.mongodb.org/linux/mongodb-linux-i686-3.2.0.tgz
- tar -zxvf mongodb-linux-i686-3.2.0.tgz
- mkdir -p mongodb && cp -R -n mongodb-linux-i686-3.2.0/ mongodb
export PATH=/bin:$PATH
then run mongod (db path might needs to be set)
- curl -O https://fastdl.mongodb.org/linux/mongodb-linux-i686-3.2.0.tgz
- tar -zxvf mongodb-linux-i686-3.2.0.tgz
- mkdir -p mongodb && cp -R -n mongodb-linux-i686-3.2.0/ mongodb
导出路径=/bin:$PATH
然后运行 mongod (可能需要设置数据库路径)
回答by Raymond
Actually, the following is very important to solve the problem
其实,以下几点对于解决问题很重要
$ sudo rm /etc/apt/sources.list.d/mongodb*.list
回答by Zineb SKARABI
I had the same problem, so I did:
我遇到了同样的问题,所以我做了:
root@skarabi:~# apt remove mongodb-org
root@skarabi:~# apt remove mongodb-org
Then:
然后:
root@skarabi:~# sudo rm /etc/apt/sources.list.d/mongodb*.list
root@skarabi:~# sudo rm /etc/apt/sources.list.d/mongodb*.list
After :
后 :
root@skarabi:~# apt update
root@skarabi:~# apt update
回答by Marlon
Using dlopatin's answerI came up with this for Ubuntu 18.04 since that code doesnt work anymore:
使用dlopatin 的答案,我为 Ubuntu 18.04 想出了这个,因为该代码不再起作用:
sudo apt-key list | \
grep -A 1 "\[expired:" | \
sed -ne 's|^\s\{1,10\}\(\w*\)||gp' | \
xargs -d '\n' sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys
- List keys
sudo apt-key list
- Get the expired one and print the next line with the fingerprint
grep -A 1 "\[expired:"
- Use sed to extract only the lines starting with space
^\s\{1,10\}
,and select the alphanumeric characters\(\w*\)
, replace those lines with the selected group which is the fingerprint\1
, repeat for all returned linesg
,then print the fingerprintp
. That gives:sed -ne 's|^\s\{1,10\}\(\w*\)|\1|gp'
- Use xargs with delimiter for '\n' otherwise it will break on spaces:
xargs -d '\n'
, then pass the fingerprints as arguments to apt-key to update them:sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys
which gives you:xargs -d '\n' sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys
- 列出键
sudo apt-key list
- 获取过期的并用指纹打印下一行
grep -A 1 "\[expired:"
- 使用 sed 只提取以空格开头的行
^\s\{1,10\}
,并选择字母数字字符\(\w*\)
,将这些行替换为选定的指纹组\1
,对所有返回的行重复g
,然后打印指纹p
。这给出了:sed -ne 's|^\s\{1,10\}\(\w*\)|\1|gp'
- 使用带有分隔符的 xargs 为 '\n' 否则它会在空格处中断:
xargs -d '\n'
,然后将指纹作为参数传递给 apt-key 以更新它们:sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys
这给你:xargs -d '\n' sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys
Hopefully that is clear. Ignore the warning about apt-key output parsing :)
希望这很清楚。忽略关于 apt-key 输出解析的警告:)