问题
I'm following the official sbt install instructions.
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
Executing: /tmp/apt-key-gpghome.uRI0yiusG0/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
gpg: keyserver receive failed: Invalid argument
Edit:
I've tried digging into the gpg.1.sh script that it executes. Here is the final call to gpg.
$ sudo cat /tmp/apt-key-gpghome.IRnmlx6hfX/gpg.0.sh
#!/bin/sh
exec 'gpg' --ignore-time-conflict --no-options --no-default-keyring \
--homedir '/tmp/apt-key-gpghome.IRnmlx6hfX' --no-auto-check-trustdb --trust-model always "$@"
Edit 2:
I've tried to directly query for the key from the keyserver with no luck. See http://keyserver.ubuntu.com/pks/lookup?search=2EE0EA64E40A89B84B2DF73499E82A75642AC823&op=vindex . Is it possible the key is missing?
Edit 3:
I retried again on Feb 24th and it now works!
回答1:
giving the command
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
I got the error
Executing: /tmp/apt-key-gpghome.DKOlZn67Q0/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
gpg: ricezione dal server di chiavi non riuscita: Dati assenti
(no data)
I solved in this way (laptop with Ubuntu 18.04.1, behind a corporate proxy without authentication):
- got the key with gpg:
gpg --receive-keys 99E82A75642AC823
- gpg showed me that the key belongs to scalasbt@gmail.com
- searched that key on http://keyserver.ubuntu.com/ using the email address
- saved the key in local file (sbt-key) and then imported with
sudo apt-key add sbt-key
回答2:
Had same problem. Two ubuntu 18.04.1 boxes. One recently installed, the other was recently upgraded from 16.04.5. In the first one I could import keys to install Scala & R without problems. In the second one the import process failed with the same error as you.
It seems that gpg imports keys launching a dirmng daemon. This process is the one that communicates through the network with keyserver.ubuntu.com.
To solve the problem, I launched dirmng prior to gpg this way:
sudo -i
dirmngr --daemon --homedir /root/key --debug-level guru --log-file dirmng.log
gpg -vv --debug-level 9 --ignore-time-conflict --no-options --no-default-keyring --homedir '/root/key' --no-auto-check-trustdb --trust-model always --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
Then gpg shows the dialog with dirmngr:
gpg: DBG: chan_3 -> KEYSERVER --clear hkp://keyserver.ubuntu.com:80
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> KS_GET -- 0x2EE0EA64E40A89B84B2DF73499E82A75642AC823
gpg: DBG: chan_3 <- ERR 167804976 Invalid argument <Dirmngr>
gpg: keyserver receive failed: Invalid argument
gpg: DBG: chan_3 -> BYE
And dirmngr log file shows errors resolving keyserver.ubuntu.com:
2018-09-07 11:44:34 dirmngr[16174.6] DBG: chan_6 <- KS_GET -- 0x2EE0EA64E40A89B84B2DF73499E82A75642AC823
2018-09-07 11:44:39 dirmngr[16174.6] resolving 'keyserver.ubuntu.com' failed: Invalid argument
2018-09-07 11:44:39 dirmngr[16174.6] number of system provided CAs: 133
2018-09-07 11:44:44 dirmngr[16174.6] resolving 'keyserver.ubuntu.com' failed: Invalid argument
2018-09-07 11:44:44 dirmngr[16174.6] can't connect to 'keyserver.ubuntu.com': host not found
2018-09-07 11:44:44 dirmngr[16174.6] error connecting to 'http://keyserver.ubuntu.com:80': Invalid argument
2018-09-07 11:44:44 dirmngr[16174.6] command 'KS_GET' failed: Invalid argument
Why one box connected to the same network fails to resolve keyserver.ubuntu.com from dirmngr and the newer one succeeds? Why in the older box I could resolve keyserver.ubuntu.com with nslookup but dirmngr couldn't? I don't know. But the difference between the two boxes was in /etc/resolv.conf. I had added google DNS servers. Removing them from resolv.conf made dirmngr work.
nameserver 127.0.0.53
#nameserver 8.8.8.8
#nameserver 8.8.4.4
After this change, apt-key works. Hope this helps.
回答3:
In official SBT documentation there is this note:
Note: There’s been reports about SSL error using Ubuntu: Server access Error: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty url=https://repo1.maven.org/maven2/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.pom, which apparently stems from OpenJDK 9 using PKCS12 format for /etc/ssl/certs/java/cacerts cert-bug. According to https://stackoverflow.com/a/50103533/3827 it is fixed in Ubuntu Cosmic (18.10), but Ubuntu Bionic LTS (18.04) is still waiting for a release. See the answer for a woraround.
According to this the problem has been fixed in Ubuntu 18.04.1.
来源:https://stackoverflow.com/questions/51983144/error-installing-sbt-on-ubuntu-18-04-gpg-keyserver-receive-failed-invalid-ar