You are not logged in.

#1 2020-01-29 15:44:22

marcosdsanchez
Member
Registered: 2014-12-18
Posts: 7

[SOLVED] Gpg:problem importing key-No such file or directory<Dirmngr>

I'm getting the error

gpg: keyserver receive failed: No such file or directory

when trying to import a public pgp key.

Gpg version:

gpg (GnuPG) 2.2.19
libgcrypt 1.8.5
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /home/marcos/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

Example:

➜  ~ gpg --recv-keys 424CC0FF
gpg: keyserver receive failed: No such file or directory

When debugging the command, I get the following output:

➜  ~ gpg -vvv --debug-all --keyserver pgp.mit.edu --recv-keys 424CC0FF
gpg: Note: no default option file '/home/marcos/.gnupg/gpg.conf'
gpg: using character set 'utf-8'
gpg: enabled debug flags: packet mpi crypto filter iobuf memory cache memstat trust hashing ipc clock lookup extprog
gpg: DBG: [not enabled in the source] start
gpg: DBG: chan_3 <- # Home: /home/marcos/.gnupg
gpg: DBG: chan_3 <- # Config: [none]
gpg: DBG: chan_3 <- OK Dirmngr 2.2.19 at your service
gpg: DBG: connection to the dirmngr established
gpg: DBG: chan_3 -> GETINFO version
gpg: DBG: chan_3 <- D 2.2.19
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> KEYSERVER --clear hkp://pgp.mit.edu
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> KS_GET -- 0x424CC0FF
gpg: DBG: chan_3 <- ERR 167805009 No such file or directory <Dirmngr>
gpg: keyserver receive failed: No such file or directory
gpg: DBG: chan_3 -> BYE
gpg: DBG: [not enabled in the source] stop
gpg: keydb: handles=0 locks=0 parse=0 get=0
gpg:        build=0 update=0 insert=0 delete=0
gpg:        reset=0 found=0 not=0 cache=0 not=0
gpg: kid_not_found_cache: count=0 peak=0 flushes=0
gpg: sig_cache: total=0 cached=0 good=0 bad=0
gpg: random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
              outmix=0 getlvl1=0/0 getlvl2=0/0
gpg: rndjent stat: collector=0x0000000000000000 calls=0 bytes=0
gpg: secmem usage: 0/32768 bytes in 0 blocks

I've removed both

~/.gnupg

and

/root/.gnupg

I also rebooted but the problem persists.

Any ideas of how to fix the issue?

Last edited by marcosdsanchez (2020-01-30 17:04:00)

Offline

#2 2020-01-30 12:26:46

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,742

Re: [SOLVED] Gpg:problem importing key-No such file or directory<Dirmngr>

Looks like you need to setup your ~/.gnupg folder correctly.

remove ~/.gnupg completely , then run gpg without any options to allow gpg as user to setup the basic stuff.
post the output of gpg first run.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2020-01-30 14:33:14

marcosdsanchez
Member
Registered: 2014-12-18
Posts: 7

Re: [SOLVED] Gpg:problem importing key-No such file or directory<Dirmngr>

Thank you very much Lone_Wolf for your answer.

I've followed your instructions and this is the output:

➜  ~ rm -rf ~/.gnupg 
➜  ~ gpg
gpg: directory '/home/marcos/.gnupg' created
gpg: keybox '/home/marcos/.gnupg/pubring.kbx' created
gpg: WARNING: no command supplied.  Trying to guess what you mean ...
gpg: Go ahead and type your message ...
^C
gpg: signal Interrupt caught ... exiting

➜  ~ gpg --recv-keys 424CC0FF          
gpg: keyserver receive failed: No such file or directory

Thoughts?

Offline

#4 2020-01-30 15:01:47

seth
Member
Registered: 2012-09-03
Posts: 64,240

Re: [SOLVED] Gpg:problem importing key-No such file or directory<Dirmngr>

killall gpg-agent dirmngr

Then try again.

Offline

#5 2020-01-30 15:24:15

marcosdsanchez
Member
Registered: 2014-12-18
Posts: 7

Re: [SOLVED] Gpg:problem importing key-No such file or directory<Dirmngr>

Thanks seth.

Output:

➜  ~ rm -rf ~/.gnupg          
➜  ~ gpg                      
gpg: directory '/home/marcos/.gnupg' created
gpg: keybox '/home/marcos/.gnupg/pubring.kbx' created
gpg: WARNING: no command supplied.  Trying to guess what you mean ...
gpg: Go ahead and type your message ...
^C
gpg: signal Interrupt caught ... exiting

➜  ~ killall gpg-agent dirmngr
gpg-agent: no process found
dirmngr: no process found
➜  ~ gpg --recv-keys 424CC0FF 
gpg: keyserver receive failed: No such file or directory

Offline

#6 2020-01-30 15:31:26

seth
Member
Registered: 2012-09-03
Posts: 64,240

Re: [SOLVED] Gpg:problem importing key-No such file or directory<Dirmngr>

ls -l  ~/.gnupg
strace gpg --keyserver pgp.mit.edu --receive-keys 424CC0FF

Offline

#7 2020-01-30 15:48:40

marcosdsanchez
Member
Registered: 2014-12-18
Posts: 7

Re: [SOLVED] Gpg:problem importing key-No such file or directory<Dirmngr>

Thanks!

➜  ~ ls -l  ~/.gnupg         
total 4
drwx------ 2 marcos marcos 3488 ene 30 12:23 crls.d
-rw------- 1 marcos marcos   32 ene 30 12:23 pubring.kbx
➜  ~

The output of strace is here: https://gist.github.com/marcosdsanchez/ … d3ce02e9b8

Offline

#8 2020-01-30 15:58:41

seth
Member
Registered: 2012-09-03
Posts: 64,240

Re: [SOLVED] Gpg:problem importing key-No such file or directory<Dirmngr>

Do you use systemd-resolved?

ls -l /etc/resolv.conf
cat /etc/resolv.conf

Offline

#9 2020-01-30 16:21:51

marcosdsanchez
Member
Registered: 2014-12-18
Posts: 7

Re: [SOLVED] Gpg:problem importing key-No such file or directory<Dirmngr>

seth wrote:

Do you use systemd-resolved?

➜  ~ sudo systemctl is-active systemd-resolved.service 
inactive

Looks like I do not.

I do use dnscrypt-proxy

➜  ~ ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 39 dic 23 08:45 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
➜  ~ cat /etc/resolv.conf    
cat: /etc/resolv.conf: No such file or directory

but

➜  ~ cat /etc/resolvconf.conf                  
# Configuration for resolvconf(8)
# See resolvconf.conf(5) for details

#resolv_conf=/etc/resolv.conf
# If you run a local name server, you should uncomment the below line and
# configure your subscribers configuration files below.

# (dis-en)able for dnscrypt-proxy
nameserver ::1
nameserver 127.0.0.1
options edns0 single-request-reopen

Offline

#10 2020-01-30 16:28:15

seth
Member
Registered: 2012-09-03
Posts: 64,240

Re: [SOLVED] Gpg:problem importing key-No such file or directory<Dirmngr>

Looks like I do not.

lrwxrwxrwx 1 root root 39 dic 23 08:45 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

cat: /etc/resolv.conf: No such file or directory

There's your problem. Remove the symlink and create a proper resolve.conf (resolvconf.conf si the config file to generate resolve.conf using resolvconf ;-)
You can edit it by hand.

Offline

#11 2020-01-30 17:00:42

marcosdsanchez
Member
Registered: 2014-12-18
Posts: 7

Re: [SOLVED] Gpg:problem importing key-No such file or directory<Dirmngr>

That fixed the problem.

For reference, I copied the contents of /etc/resolvconf.conf to /etc/resolv.conf and also set the file to immutable by executing:

chattr +i /etc/resolv.conf

This is explained in the wiki: https://wiki.archlinux.org/index.php/Do … esolv.conf

Thanks to all involved!

Offline

Board footer

Powered by FluxBB