1

I'm trying to generate a "perfect keypair" akin to https://linuxich.wordpress.com/short-manual-for-a-perfect-gpg-keypair-using-gpg-v2/ but I want to do it semi-automatized, in gpg2 terms that would be unattended or batched generation. However, the generation is stuck. There seems to be enough entropy in the system, random/entropy_avail shows me over 3000.

Running the command gives

homediruser@localhost ~/.gnupg $ gpg2 --verbose --batch --generate-key --debug-level guru --debug-all  genkeycommands2.lst
gpg: reading options from '/home/homediruser/.gnupg/gpg.conf'
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: fd_cache_invalidate (/home/homediruser/.gnupg/pubring.kbx)
gpg: DBG: iobuf-1.0: open '/home/homediruser/.gnupg/pubring.kbx' desc=file_filter(fd) fd=3
gpg: DBG: iobuf-1.0: close 'file_filter(fd)'
gpg: DBG: /home/homediruser/.gnupg/pubring.kbx: close fd/handle 3
gpg: DBG: fd_cache_close (/home/homediruser/.gnupg/pubring.kbx) new slot created
gpg: DBG: iobuf-*.*: ioctl '/home/homediruser/.gnupg/pubring.kbx' invalidate
gpg: DBG: fd_cache_invalidate (/home/homediruser/.gnupg/pubring.kbx)
gpg: DBG:                 did (/home/homediruser/.gnupg/pubring.kbx)
gpg: keybox '/home/homediruser/.gnupg/pubring.kbx' created
gpg: DBG: fd_cache_open (genkeycommands2.lst) not cached
gpg: DBG: iobuf-2.0: open 'genkeycommands2.lst' desc=file_filter(fd) fd=3
gpg: DBG: iobuf-2.0: ioctl 'file_filter(fd)' no_cache=1
gpg: DBG: iobuf-2.0: underflow: buffer size: 8192; still buffered: 0 => space for 8192 bytes
gpg: DBG: iobuf-2.0: underflow: A->FILTER (8192 bytes)
gpg: DBG: iobuf-2.0: A->FILTER() returned rc=0 (ok), read 185 bytes
gpg: DBG: iobuf-2.0: underflow: buffer size: 8192; still buffered: 0 => space for 8192 bytes
gpg: DBG: iobuf-2.0: underflow: A->FILTER (8192 bytes)
gpg: DBG: iobuf-2.0: A->FILTER() returned rc=-1 (EOF), read 0 bytes
gpg: DBG: genkeycommands2.lst: close fd/handle 3
gpg: DBG: fd_cache_close (3) real
gpg: DBG: chan_3 <- OK Pleased to meet you, process 10484
gpg: DBG: connection to agent established
gpg: DBG: chan_3 -> RESET
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> OPTION ttyname=/dev/pts/3
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> OPTION ttytype=xterm
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> OPTION lc-ctype=C
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> OPTION lc-messages=C
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> GETINFO version
gpg: DBG: chan_3 <- D 2.1.17
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> OPTION allow-pinentry-notify
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> OPTION agent-awareness=2.1.0
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> RESET
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> GENKEY --inq-passwd
gpg: DBG: chan_3 <- S INQUIRE_MAXLEN 1024
gpg: DBG: chan_3 <- INQUIRE KEYPARAM
gpg: DBG: chan_3 -> D (genkey(rsa(nbits 4:2048)))
gpg: DBG: chan_3 -> END
gpg: DBG: chan_3 <- INQUIRE NEWPASSWD
gpg: DBG: chan_3 -> D kljfhslfjkhsaljkhsdflgjkhsd
gpg: DBG: chan_3 -> END
gpg: DBG: chan_3 <- S PROGRESS need_entropy X 32 128
gpg: DBG: chan_3 <- S PROGRESS need_entropy X 110 128
gpg: DBG: chan_3 <- S PROGRESS need_entropy X 124 128
gpg: DBG: chan_3 <- S PROGRESS need_entropy X 128 128
gpg: DBG: chan_3 <- S PROGRESS primegen . 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen . 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen . 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen + 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen + 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen + 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen + 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen + 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen X 100 100
gpg: DBG: chan_3 <- S PROGRESS need_entropy X 32 128
gpg: DBG: chan_3 <- S PROGRESS need_entropy X 98 128
gpg: DBG: chan_3 <- S PROGRESS need_entropy X 126 128
gpg: DBG: chan_3 <- S PROGRESS need_entropy X 128 128
gpg: DBG: chan_3 <- S PROGRESS primegen . 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen . 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen . 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen . 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen . 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen . 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen + 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen + 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen + 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen + 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen + 0 0
gpg: DBG: chan_3 <- S PROGRESS primegen X 100 100
gpg: DBG: chan_3 <- ERR 67141713 No such file or directory <GPG Agent>
gpg: agent_genkey failed: No such file or directory
gpg: key generation failed: No such file or directory
gpg: DBG: iobuf-2.0: close '?'
gpg: DBG: [not enabled in the source] stop
gpg: random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
              outmix=0 getlvl1=0/0 getlvl2=0/0
gpg: secmem usage: 0/32768 bytes in 0 blocks

The content of the file is

homediruser@localhost ~/.gnupg $ cat genkeycommands2.lst 
Key-Type: 1
Key-Length: 2048
Subkey-Type: 1
Subkey-Length: 2048
Name-Real: Root Superuser
Name-Email: root@handbook.westarete.com
Expire-Date: 0
Passphrase: kljfhslfjkhsaljkhsdflgjkhsd

And the GPG agent is running

homediruser@localhost ~/.gnupg $ ps aux|grep gpg
homedir+ 8577 0.1 0.0 237364 1072 ? Ss 17:58 0:01 gpg-agent --homedir /home/homediruser/.gnupg --use-standard-socket --daemon

I have no idea what may cause this or how to further debug it, please let me know if you need additional information in the comments below.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.