Find the cause of a problem with dirmngr
What is dirmngr?
The thing called dirmngr (spoken: dirmanager) is a tool that comes with GnuPG. It is responsible for sending or receiving information about public keys, like getting them from a keyserver or via WKD.
If we want to analyze what is going wrong with these network access operations, dirmngr can create log files.
How to create log files?
1. Create a configuration file
When the dirmngr is starting it looks for a configuration file. When it finds the file it uses it. Otherwise the dirmngr uses default configurations. If we want to tell the dirmngr to create a log file and where the file is located we to do so with a configuration file.
- Navigate to C:/Users/user_name/AppData/Roaming/gnupg/
- Create a file called dirmngr.conf
2. Edit the configuration file
2.1 Path for log file
Now we can to tell the dirmngr what options it has to use. Therefore open the configuration file by double-clicking on it.
First we can decide where the dirmngr creates the log file. We are doing this by adding this line:
The path and the name of the file are your choice but of course it has to be a place where dirmngr can write and a meaningful name helps you later to recognize the file ;-)
2.2 Set Debug Flags
The dirmngr can create a log file that is more or less detailed. That depends on what debug flags you set in the configuration file.
If you have a problem when trying to retrieve a public key add the following line in the configuration file to get helpful information:
If you want to find out which debug flags you can enter the following command in the console:
dirmngr --debug help
Then you get a list of flags which you can use for debugging. More information about debug flags is available here.
3. Activate new configuration of dirmngr
If you don't tell the dirmngr to read your edited configuration file it will be lazy and won't read it. To make it read the file and adapt the settings you have to give it a kick with the following command :
gpgconf reload dirmngr
(Or stop and restart it completely, by any other method.)
How to solve my problem with the log file?
Look into the log file
After you configurated the dirmngr and restarted it you can read the file (remember: you set the location in 2.1). Maybe this already helps you to find out what causes the problem.
Share your log file in the forums
Maybe the content of the log file doesn't tell you anything because you don't understand this gibberish. Or maybe you are just no "technical person". In any case you can upload your log file in the forums so other people can try to help you.
Please note two things:
- The debug flags influence what is visible in the log file. Because it can contain sensitive information we recommend you not to use every debug flag.
- Please tell in the forums also the version of GnuPG/Gpg4win you are using and the steps you made before the problem appeared.
Stop the logging after solving the problem
When the logging was enabled the dirmngr will continue to produce new log entries. This means that this file will grow on and on so it will take much space on your computer. So, on one hand much space will be consumed and on the other hand this file will contain more and more sensitive information. That is why you should stop the logging after solving your problem.
You can stop the logging by writing a "#" in front of the lines that you have changed in the configuration file. For example:
#debug dns,network,lookup #log-file C:/Users/user_name/Desktop/dirmngr.log.txt
or you can rename or delete the config file altogether.
- Make Dirmngr reload the config afterwards (like above).