You are here

[Fixed] GPGShutdown does not shutdown dirmngr.exe

17 posts / 0 new
Last post
CarlosCastaneda
Offline
Last seen: 3 months 3 days ago
Joined: 2008-08-18 16:04
[Fixed] GPGShutdown does not shutdown dirmngr.exe

I installed Enigmail extension within Thunderbird. So, when I'm about to shutdown portableapps launcher a message is displayed that portableapps can't stop because dirmngr is still running.
When Thunderbird is shut down then GPGShutdown is called which properly terminates gpg-agent but leaves dirmngr running.

GPGShutdown should also terminate dirmgr. dirmngr can't even be terminated by means of gpgconf: .\portableapps.com\PortableApps\CommonFiles\GPG\bin\gpgconf.exe --kill dirmngr

John T. Haller
John T. Haller's picture
Online
Last seen: 13 min 50 sec ago
AdminDeveloperModerator
Joined: 2005-11-28 22:21
Fixed in 2.2.7

This is addressed in today's release of GPG Portable 2.2.7. The custom shutdown routine I wrote will attempt to use the documented (but currently unimplemented) shutdown procedure for dirmngr.exe. After that fails, it will then forcibly shut it down.

Sometimes, the impossible can become possible, if you're awesome!

CarlosCastaneda
Offline
Last seen: 3 months 3 days ago
Joined: 2008-08-18 16:04
GPGShutdown doen't shutdown gpg-agent nor dirmngr

Currently I can see the very same problem I reported last year when terminating Thunderbird. GPGShutdown doesn't shut down processes gpg-agent and dirmngr. Both have to be killed manually. I'm running the very last releases of Thunderbird and gpg.
Just for cempleteness: on my Windows machine there is full gpg4win installation. I'm running Thunderbird from a PortableApps installation on a USB device along with a portable version of gpg.
When I start Thunderbird and open Options->Settings Menu-dialogue it can be seen that gpg-agent and after some time dirmngr are startet.

John T. Haller
John T. Haller's picture
Online
Last seen: 13 min 50 sec ago
AdminDeveloperModerator
Joined: 2005-11-28 22:21
High Process Count Bug, Try This Fix

It would appear you're hitting the high process count bug present in all NSIS process plugins available. Too many processes and it'll always tell the caller the process is not running. I'll need to update GPGShutdown to handle high process counts the way I have other of our utilities like the PA.c Installer.

For the curious, FindProc won't return 1 here even when it's running:

	FindProcDLL::FindProc "$EXEDIR\bin\dirmngr.exe"
	
	${If} $R0 == 1
		;this switch is documented but not supported yet, we try it just in case
		nsExec::Exec `"$EXEDIR\bin\dirmngr.exe" --shutdown`
		
		FindProcDLL::FindProc "$EXEDIR\bin\dirmngr.exe"		
		${If} $R0 == 1
			KillProcDLL::KillProc "dirmngr.exe"
		${EndIf}
	${EndIf}

Please try downloading this updated GPGShutdown.exe and replacing the existing one and let me know if that works for you.

Sometimes, the impossible can become possible, if you're awesome!

CarlosCastaneda
Offline
Last seen: 3 months 3 days ago
Joined: 2008-08-18 16:04
Not yet

Hi John,

because there is a dirmngr.exe again I had a look at my post and saw your notice. After downloading the updated GPGShutdown.exe I realized that this one was already provided with GPG_Plugin_Portable_2.2.19.paf.exe. Because this update has already been installed before running Thunderbird I conclude that the fix does not work in my case.

Best regards
CC

John T. Haller
John T. Haller's picture
Online
Last seen: 13 min 50 sec ago
AdminDeveloperModerator
Joined: 2005-11-28 22:21
Just Released

This update was just included yesterday. As I heard nothing back from you, I was hoping it would solve the issue. Are you sure the current version of both is not working for you?

Also, I don't know what this means: "because there is a dirmngr.exe again I had a look at my post and saw your notice."

Sometimes, the impossible can become possible, if you're awesome!

CarlosCastaneda
Offline
Last seen: 3 months 3 days ago
Joined: 2008-08-18 16:04
Hi John,

Hi John,

I compared the Hash of both files: identical. I noticed, that the problem arises if TB is being kept running for some time. When closing TB, then in case of success there comes a messagebox containing the local path of Firefox (no idea why). In case of failure, the messagebox contains the number 0.

I've made some screen shots of the messagesboxes as well as of the processes screen of process explorer. If needed I can upload those files (where?).

Trying to shutdown dirmngr from command line gives this message:

PS C:\Users\xxxxx> I:\portableapps.com\PortableApps\CommonFiles\GPG\bin\dirmngr.exe --shutdown
dirmngr[1196]: No ldapserver file at: 'C:\Users\xxxxxxxx\AppData\Roaming\gnupg\dirmngr_ldapservers.conf'

Best regards

John T. Haller
John T. Haller's picture
Online
Last seen: 13 min 50 sec ago
AdminDeveloperModerator
Joined: 2005-11-28 22:21
Something Else

Neither the current official TB Portable launcher nor the GPGShutdown.exe routine have such message boxes within them. Do you have a second copy of GPG within TB Portable itself?

Sometimes, the impossible can become possible, if you're awesome!

CarlosCastaneda
Offline
Last seen: 3 months 3 days ago
Joined: 2008-08-18 16:04
No there is no second copy

No there is no second copy within TB. As I mentioned before there is a local installation of the gpg4win package (gpg, kleopatra,...).

The message box is related to GPGShutdown.exe (checked with process explorer: Find Window's Process (drag over window)).
The process image is I:\portableapps.com\PortableApps\CommonFiles\GPG\GPGShutdown.exe called from Thunderbird.exe.

Here is the hash of GPGShutdown.exe (latest GPG Plugin package).

SHA256 C4BF899D586D3DD8599CCBFCDEB26460FAE3535D2656B62EA2F50AD780D981BD I:\portableapps.com\PortableApps\CommonFiles\GPG\GPGShutdown.exe

I ran some more tests and recorded those with process monitor. gpg-agent is terminated successfully, dirmngr.exe isn't:
commands run by GPGShutdown.exe
"I:\portableapps.com\PortableApps\CommonFiles\GPG\bin\gpg-connect-agent.exe" /bye
"I:\portableapps.com\PortableApps\CommonFiles\GPG\bin\gpg-connect-agent.exe" killagent /bye

John T. Haller
John T. Haller's picture
Online
Last seen: 13 min 50 sec ago
AdminDeveloperModerator
Joined: 2005-11-28 22:21
Please Test

This test version of GPG Shutdown: https://portableapps.com/downloads/temp/GPGShutdown.exe

It's version 2.2.1 and should have 3 message boxes if it sees dirmngr.exe running. One message if it can't find it. MD5 is 286a502ef1a07a4ccd315d2ef80f983c

Sometimes, the impossible can become possible, if you're awesome!

CarlosCastaneda
Offline
Last seen: 3 months 3 days ago
Joined: 2008-08-18 16:04
Weird...

Hi John,

made 2 tests:
local gpg-agent and corresponding dirmngr is running

1) starting TB, opened options->settings dialogue the gpg-agent has been started. After some while (about 10-15 min) portableapps's dirmngr has been started. Terminating TB runs GPGShutdown and there were 3 message boxes, the first one "dirmngr.exe is running", second "dirmngr.exe path: " and last one "killing dirmngr". That one works.
2) Started TB again, opened options->settings dialogue to start gpg-agent and waited until portableapp's dirmngr has been started again. Terminated TB, first message box contained again "dirmngr.exe is running" but second now "dirmngr.exe path: " resulting in stopping successfully portableapps's gpg-agent but left portableapp's dirmngr running. Now local and portableapp's dirmngr are still running.

Best regards
CC

John T. Haller
John T. Haller's picture
Online
Last seen: 13 min 50 sec ago
AdminDeveloperModerator
Joined: 2005-11-28 22:21
Path?

Was a path listed?

Sometimes, the impossible can become possible, if you're awesome!

CarlosCastaneda
Offline
Last seen: 3 months 3 days ago
Joined: 2008-08-18 16:04
Path

Yes, it was. It put it into the comment, but as I notice now I did it wrong (used angle brackets without escape character, hence text "disappeared").
In case 1 it was the path of portableapps, in case 2 the path of the local installation.

After case 2 I never succeeded to stop portableapp's dirmngr because the local one has been display. Did one more test: ran gpgconf --kill dirmngr which terminate dirmngr of local installation (portableapp's still running), then terminating TB shutdown portableapp's gpg-agent as well as dirmngr (with all 3 three message boxes, in second path to portableapps installation).

John T. Haller
John T. Haller's picture
Online
Last seen: 13 min 50 sec ago
AdminDeveloperModerator
Joined: 2005-11-28 22:21
Multiple Copies

If you have multiple copies of dirmngr running, this will NOT close it. The above will work when you're only running one copy. Our only alternative given the current tools for users with way too many processes running is to kill all of them, local and portable.

Otherwise, you'll need to ask GPG to properly support shutting down dirmngr by supporting the command line parameter they have documented (which doesn't currently work).

Sometimes, the impossible can become possible, if you're awesome!

CarlosCastaneda
Offline
Last seen: 3 months 3 days ago
Joined: 2008-08-18 16:04
Multiple Copies

I opened an entry in the gpg4win forum and will see what the dev team will respond. I'll keep you updated here.

SUNot
Offline
Last seen: 5 months 1 week ago
Joined: 2019-11-21 05:08
+1

+1
Every time I close TB portable, I get a message box titled "GPG Shutdown | PortableApps.com" and the content is the local path to Firefox (not Firefox portable).

I too have gpg4win installed. Version gpg4win-3.1.10. I'm pretty sure the message box started appearing since I installed gpg4win.

I'll follow this thread to see if you find a solution. But let me know if I can help with additonal information.

matthewsheeran
Offline
Last seen: 5 months 2 weeks ago
Joined: 2015-03-19 04:36
To replicate this still extant problem: install Git for Windows

To replicate this still extant problem: install Git for Windows adding git's usr/bin directory containing gpg.exe et al to your PATH and reboot.
You will now see the following GPG Shutdown | PortableApps.com 0 Dialog every time you shutdown PortableApps Thunderbird and when you start it twice! Smile
https://drive.google.com/file/d/1Om2gerA5qX26ggWbO1-VdKKGIJc8rAN1/view
Starting Thunderbird from a batch file which removes git usr/bin form the path first or kills the GPG Shutdown window after (more ugly) might be the only answer for me..

Log in or register to post comments