Error installing sbt on Ubuntu 18.04: `gpg: keyserver receive failed: Invalid argument`

Error installing sbt on Ubuntu 18.04: `gpg: keyserver receive failed: Invalid argument`



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?





i think i had sth similar the other day. might be a server issue. try again later perhaps?
– Joel Berkeley
Aug 23 at 10:03





Works for me in Ubuntu 18.04.1 LTS
– Duelist
Aug 23 at 10:17





is there a pause between entering the command and the last line being returned?
– Joel Berkeley
Aug 23 at 10:47





Yes. I've also updated the question to show the script being executed.
– kshikama
Aug 23 at 11:37





@Duelist Can you please show me a print out of the gpg key 2EE0EA64E40A89B84B2DF73499E82A75642AC823 ?
– kshikama
Aug 23 at 11:48





2 Answers
2



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.





``` $ sudo lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic ``` Hmm well unfortunately I'm already on Ubuntu 18.04.1 but thanks for the help anyways.
– kshikama
Aug 30 at 7:33



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.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế