Onlykey-gpg init gets stuck

Hi,

Am a new onlykey user. Am trying to setup the gpg keys and am stuck at the onlykey-gpg init command.

Environment :
OS : Mac OS X Catalina
Onlykey App : 5.3.0
Onlykey firmware : 2.1.0
gpg (GnuPG) 2.3.1
libgcrypt 1.9.3

Steps followed:

  1. Set the onlykey in config mode and set the derived key mode to “button press” by executing the command “onlykey-cli derivedkeymode 1”
  2. Couldn’t figure out how to exit config mode evern after searching for more than 30min on docs/google.What is the correct procedure to come out of config mode ?
  3. One of the forum post mentioned to just remove and reconnect. So did the same. Remove the key and reconnect. enter the pin to unlock
  4. Run : rm -rf ~/.gnupg ; onlykey-gpg init “user1 user1@xyz.com"
  5. Here is where it gets stuck. It initially asks to enter 3 digit code 262. I just touch a key and then it shows enter code 512. Again i touch a key , the LED turns GREEN but the cli command is stuck there. I have also tried to enter the code on onlykey but the result is same. It gets stuck after showing the second 3 digit challenge code the second time.
    I have to do ctrl+c after waiting for more than 15min.
2021-06-05 23:51:32,442 WARNING      This GPG tool is still in EXPERIMENTAL mode, so please note that the API and features may change without backwards compatibility! [__init__.py:128]
2021-06-05 23:51:32,502 WARNING      NOTE: in order to re-generate the exact same GPG key later, run this command with "--time=0" commandline flag (to set the timestamp of the GPG key manually). [__init__.py:39]
Enter the 3 digit challenge code on OnlyKey to authorize <gpg://user1 <user1@xyz.com>|ed25519>
2 6 2
Enter the 3 digit challenge code on OnlyKey to authorize <gpg://user1 <user1@xyz.com>|ed25519>
5 1 2

^C
gpg: signal Interrupt caught ... exiting
Traceback (most recent call last):
  File "/usr/local/bin/onlykey-gpg", line 8, in <module>
    sys.exit(gpg_tool())
  File "/usr/local/bin/onlykey_agent.py", line 6, in <lambda>
    gpg_tool = lambda: libagent.gpg.main(DeviceType)
  File "/usr/local/lib/python3.9/site-packages/libagent/gpg/__init__.py", line 381, in main
    return args.func(device_type=device_type, args=args)
  File "/usr/local/lib/python3.9/site-packages/libagent/gpg/__init__.py", line 212, in run_init
    check_call(keyring.gpg_command(['--homedir', homedir, verbosity,
  File "/usr/local/lib/python3.9/site-packages/libagent/gpg/__init__.py", line 114, in check_call
    subprocess.check_call(args=args, stdin=stdin, env=env)
  File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 368, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 351, in call
    return p.wait(timeout=timeout)
  File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1189, in wait
    return self._wait(timeout=timeout)
  File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1917, in _wait
    (pid, sts) = self._try_wait(0)
  File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1875, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)
KeyboardInterrupt

Questions:

  1. What am i doing wrong in generating the key ? Is there something am missing ?
  2. What is the correct procedure to come out of config mode ?
  3. How do i know if i have set the Derived Key User Input Mode as “button press” ? The App does not read the preferences. So how can i check the same ?

TIA.

EDIT: Added additional info , Reordering/updating my questions.

I could solve the problem. Just putting this for other’s reference.

The problem seems to be on the gpg version. I had installed the gpg on mac using brew brew install gnupg . This installed gpg version 2.3.1. This version seems to be not compatible with onlykey-gpg creating the above mentioned problems of getting stuck.

Resoultion :

  1. uninstall brew gnupg version brew uninstall gnupg
  2. Install gnupg by installing GPGsuite from gpgtools.org
  3. delete the ~/.gnupg/onlykey directory and rerun the onlykey-gpg init command.

Thanks for the detailed report here. It looks like there may be some issues with gnupg 2.3 support for other things too - Update scdaemon.conf for gnupg 2.3 with MacOS (and possibly others) · Issue #256 · drduh/YubiKey-Guide · GitHub

I will test this out and see if I can reproduce issue.