You are not logged in.

#1 2017-06-21 15:50:37

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,475

[SOLVED] [GPG] no password prompt, process keeps waiting

When I run gpg, or any depended process (mutt/pass etc.), password prompt is not displayed and the process hangs indefinately.

For an example,

┌─[sharad] (09:14 PM)-(Wed Jun 21) !6706! [~]
└───▶ gpg --verbose -r <my_mail_id> .password-store/net/IT.gpg
gpg: public key is B9A162B328E94140
^C
gpg: signal Interrupt caught ... exiting

This issue is started after recent update, gpg was working fine before that.

Last edited by Docbroke (2017-06-23 03:44:24)

Offline

#2 2017-06-21 16:20:41

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] [GPG] no password prompt, process keeps waiting

Is there another process (agent) running?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-06-21 16:29:57

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,475

Re: [SOLVED] [GPG] no password prompt, process keeps waiting

No. I am not starting gpg-agent manually (or through systemd). It is called when required. Killing gpg-agent doesn't help either.
Another thing I just noticed is that I am not able to kill gpg-agent once it starts.

EDIT: spell correction "ones to once"

Last edited by Docbroke (2017-06-22 02:29:15)

Offline

#4 2017-06-22 02:19:47

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,475

Re: [SOLVED] [GPG] no password prompt, process keeps waiting

It appears that no process were able to connect with gpg-agent, and when I kill gpg-agent it reloads itself.

┌─[sharad] (07:35 AM)-(Thu Jun 22) !6748! [~]
└───▶ pgrep gpg-agent
2717

┌─[sharad] (07:35 AM)-(Thu Jun 22) [~]
└───▶ pkill gpg-agent

┌─[sharad] (07:35 AM)-(Thu Jun 22) [~]
└───▶ pgrep gpg-agent
3077

To kill this defective agent from relaoding itself I have to add error(few random words) in config file (.gnupg/gpg-agent.conf)

┌─[sharad] (07:38 AM)-(Thu Jun 22) [~]
└───▶ cat .gnupg/gpg-agent.conf 
dkfjlkdj dfjlkdfjl
pinentry-program /usr/bin/pinentry

Now I can kill the agent

┌─[sharad] (07:39 AM)-(Thu Jun 22) !6749! [~]
└───▶ gpg --verbose -r <my_mail_id> -d .password-store/net/IT.gpg
gpg: public key is B9A162B328E94140
gpg: no running gpg-agent - starting '/usr/bin/gpg-agent'
gpg: waiting for the agent to come up ... (5s)
gpg: waiting for the agent to come up ... (4s)
gpg: waiting for the agent to come up ... (3s)
gpg: waiting for the agent to come up ... (2s)
gpg: waiting for the agent to come up ... (1s)
gpg: can't connect to the agent: IPC connect call failed
gpg: using subkey B9A162B328E94140 instead of primary key 4EBCA5607B3290F9
gpg: encrypted with 2048-bit RSA key, ID B9A162B328E94140, created 2016-05-29
      "<user_id> <my_mail_id>"
gpg: decryption failed: No secret key
┌─[sharad] (07:40 AM)-(Thu Jun 22) !6749! [~]
└───▶ gpg-agent
gpg-agent[7535]: /home/sharad/.gnupg/gpg-agent.conf:1: invalid option 

Next I remove the error from conf file. Now If I start any process needing gpg-agent it starts correctly.

┌─[sharad] (07:43 AM)-(Thu Jun 22) [~]
└───▶ cat .gnupg/gpg-agent.conf 
pinentry-program /usr/bin/pinentry

┌─[sharad] (07:43 AM)-(Thu Jun 22) !6749! [~]
└───▶ gpg --verbose -r <mail_id> -d .password-store/net/IT.gpg
gpg: public key is B9A162B328E94140
gpg: no running gpg-agent - starting '/usr/bin/gpg-agent'
gpg: waiting for the agent to come up ... (5s)
gpg: connection to agent established
gpg: using subkey B9A162B328E94140 instead of primary key 4EBCA5607B3290F9
gpg: pinentry launched (8942 gtk2 1.0.0 ? ? ?)
gpg: using subkey B9A162B328E94140 instead of primary key 4EBCA5607B3290F9
gpg: encrypted with 2048-bit RSA key, ID B9A162B328E94140, created 2016-05-29
      "<user_id> <mail_id>"
gpg: AES256 encrypted data
gpg: original file name='ojP0s-net-IT.txt'
incometaxindiaefiling.gov.in

So why gpg-agent doesn't start correctly first time, and why it start behving well after I introduce and correct the error in it's config file just so that I can stop it from reloading itself.

Offline

#5 2017-06-22 06:31:06

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,475

Re: [SOLVED] [GPG] no password prompt, process keeps waiting

Based on above post now, I am running this ugly hack.

┌─[sharad] (11:57 AM)-(Thu Jun 22) [~]
└───▶ cat .gnupg/gpg-agent.conf 
#default-cache-ttl 60480000 
#max-cache-ttl 604840000
# pinentry-program /usr/bin/pinentry-gtk-2
pinentry-program /usr/bin/pinentry
dfkj .dfmlkj.dflkj

┌─[sharad] (11:57 AM)-(Thu Jun 22) [~]
└───▶ cat .gnupg/gpg-agent2.conf 
#default-cache-ttl 60480000 
#max-cache-ttl 604840000
# pinentry-program /usr/bin/pinentry-gtk-2
pinentry-program /usr/bin/pinentry

this line goes in .bash_profile

gpg-agent --daemon >/dev/null 2>&1

this line goes in my pass wrapper, so whenever I run pass it start gpg-agent with good config

pgrep gpg-agent >/dev/null || gpg-agent --options .gnupg/gpg-agent2.conf --daemon

Though I fully fail to understand why gpg-agent doesn't run properly on first attempt.

Offline

#6 2017-06-22 12:56:20

erbrecht
Member
From: United States
Registered: 2016-03-07
Posts: 10

Re: [SOLVED] [GPG] no password prompt, process keeps waiting

@Docbroke, that worked for me too. Encountered this yesterday afternoon and I was totally stumped. All I could find was the gpg-agent journal entries which show gpg-agent attempting to start over and over again, only to time out every time.

I use gopass as my password manager, so I was up a certain creek until I came across your post. Thanks for sharing your work around, saved me a lot of headache today.

Jun 22 08:39:40 ffprime systemd[2471]: Starting GnuPG private key agent...
Jun 22 08:41:10 ffprime systemd[2471]: gpg-agent.service: Start operation timed out. Terminating.
Jun 22 08:41:10 ffprime systemd[2471]: Failed to start GnuPG private key agent.
Jun 22 08:41:10 ffprime systemd[2471]: gpg-agent.service: Unit entered failed state.
Jun 22 08:41:10 ffprime systemd[2471]: gpg-agent.service: Failed with result 'timeout'.
Jun 22 08:41:10 ffprime systemd[2471]: Starting GnuPG private key agent...
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Start operation timed out. Terminating.
Jun 22 08:42:41 ffprime systemd[2471]: Failed to start GnuPG private key agent.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Unit entered failed state.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Failed with result 'timeout'.
Jun 22 08:42:41 ffprime systemd[2471]: Starting GnuPG private key agent...
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Control process exited, code=exited status=2
Jun 22 08:42:41 ffprime systemd[2471]: Failed to start GnuPG private key agent.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Unit entered failed state.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Failed with result 'exit-code'.
Jun 22 08:42:41 ffprime systemd[2471]: Starting GnuPG private key agent...
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Control process exited, code=exited status=2
Jun 22 08:42:41 ffprime systemd[2471]: Failed to start GnuPG private key agent.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Unit entered failed state.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Failed with result 'exit-code'.
Jun 22 08:42:41 ffprime systemd[2471]: Starting GnuPG private key agent...
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Control process exited, code=exited status=2
Jun 22 08:42:41 ffprime systemd[2471]: Failed to start GnuPG private key agent.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Unit entered failed state.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Failed with result 'exit-code'.
Jun 22 08:42:41 ffprime systemd[2471]: Starting GnuPG private key agent...
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Control process exited, code=exited status=2
Jun 22 08:42:41 ffprime systemd[2471]: Failed to start GnuPG private key agent.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Unit entered failed state.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Failed with result 'exit-code'.
Jun 22 08:42:41 ffprime systemd[2471]: Starting GnuPG private key agent...
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Control process exited, code=exited status=2
Jun 22 08:42:41 ffprime systemd[2471]: Failed to start GnuPG private key agent.

Offline

#7 2017-06-22 14:20:06

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,475

Re: [SOLVED] [GPG] no password prompt, process keeps waiting

Glad to know that I am not the sole victim.

Offline

#8 2017-06-22 15:45:06

woodape
Member
Registered: 2015-03-25
Posts: 159

Re: [SOLVED] [GPG] no password prompt, process keeps waiting

Is gpg-agent not being started as a user service? This is the default as of a recent update, check here. Check the output of "systemctl --user status gpg-agent". I had problems a little while ago because I was also starting gpg-agent separatly from this service - which I hadn't realized had been put in place.

Offline

#9 2017-06-22 17:52:50

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,475

Re: [SOLVED] [GPG] no password prompt, process keeps waiting

Starting gpg-agent as user service causes the same problem. The status command hangs, even stop/start commands of systemctl hangs.

Offline

#10 2017-06-22 18:45:35

erbrecht
Member
From: United States
Registered: 2016-03-07
Posts: 10

Re: [SOLVED] [GPG] no password prompt, process keeps waiting

gpg-agent is starting as a user service. I was viewing the logs using

journalctl --user --user-unit=gpg-agent.service

Output of systemctl --user status gpg-agent.service:

● gpg-agent.service - GnuPG private key agent
   Loaded: loaded (/home/travis/.config/systemd/user/gpg-agent.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2017-06-22 08:42:41 EDT; 5h 55min ago
  Process: 11740 ExecStart=/usr/bin/gpg-agent --daemon (code=exited, status=2)

Jun 22 08:42:41 ffprime systemd[2471]: Starting GnuPG private key agent...
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Control process exited, code=exited status=2
Jun 22 08:42:41 ffprime systemd[2471]: Failed to start GnuPG private key agent.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Unit entered failed state.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Failed with result 'exit-code'.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Start request repeated too quickly.
Jun 22 08:42:41 ffprime systemd[2471]: Failed to start GnuPG private key agent.
Jun 22 08:42:41 ffprime systemd[2471]: gpg-agent.service: Failed with result 'exit-code'.

So gpg-agent is running, as I can encrypt/decrypt, but not currently as a systemd service.

It also appears that of all the .sockets listed in the wiki, only dirmngr.socket is actually running. I may do more troubleshooting tomorrow, but I'm out of time today.

Offline

#11 2017-06-22 19:19:42

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,881

Re: [SOLVED] [GPG] no password prompt, process keeps waiting

Offline

#12 2017-06-23 03:43:29

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,475

Re: [SOLVED] [GPG] no password prompt, process keeps waiting

Thanks seth for pointing to the link.
Removing gpg-agent.service from .config/systemd/user solved the issue. The service was not even enabled but still it intereferes with /usr/lib/systemd/user/gpg-agent.service, which has probably appeared recently.
EDIT: I guess that as service file in home directory gets preference over one in the /usr/lib/systemd/user/, it lead to all this trouble. I am getting some idea why my hack was working, thanks again.

Last edited by Docbroke (2017-06-23 03:47:31)

Offline

Board footer

Powered by FluxBB