GPG4Win - Kleopatra hangs just after being started up (in log file last written line: "org.kde.pim.kleopatra: Startup timing: 2813 ms: UiServer created" and stops)

I have used GPG4Win for many years. But yesterday for the first time ever Kleopatra did hang very shortly after I started it. There is a (non-responsive) Kleopatra icon in my tray, and the process “kleopatra.exe” is present (and so is gpg-agent.exe). Since my version wasn’t up to date I thought an update perhpaps could fix this, so I installed gpg4win-5.0.1.exe ‘on top of’ the older version (v4.?). But still the same.
I then tried to uninstall Gpg4win and restarted my PC. I then copied and renamed (to have a ‘fresh start’) the folder C:\Users\AppData\Roaming\gnupg
And then I installed “gpg4win-5.0.1.exe“ again - but it exactly the same problem.

I then found this page:

… and here also the information that I could use some environment variables for getting additional info:
”KLEOPATRA_LOGDIR” to point to a folder where Kleopatra could log information about what it ‘is doing’ and the other environment variable “KLEOPATRA_LOGOPTIONS“ which I as described set to “all” which should make the logging more verbose.

I then started Kleopatra again, but the only thing that was logged (in the file “kleo-log“ in the folder where ”KLEOPATRA_LOGDIR” is pointing to) were these two lines and then nothing more:

org.kde.pim.kleopatra: Startup timing: 2813 ms: Application initialized
org.kde.pim.kleopatra: Startup timing: 2813 ms: UiServer created

I then tried to log on to the same PC but with a different user, set up the environment variables ”KLEOPATRA_LOGDIR” (pointing to a different folder of course) and set “KLEOPATRA_LOGOPTIONS“ to ‘all’ also for this user.
When I started Kleopatra up with this alternative user it started up just fine, and a lot more was logged to the log file “kleo-log”. The two first lines are the same as shown above, but then a lot of lines followed. Here is the full log from the startup of Kleopatra with the alternative user on the same PC:

org.kde.pim.kleopatra: Startup timing: 2674 ms: Application initialized
org.kde.pim.kleopatra: Startup timing: 2674 ms: UiServer created
org.kde.pim.kleopatra: Startup timing: 2679 ms: UiServer started
org.kde.pim.kleopatra: Kleo::Command(0x89dd1ff730) ~Command
org.kde.pim.kleopatra: Kleo::Command(0x89dd1ff730) ~Private
org.kde.pim.kleopatra: Startup timing: 2740 ms: SelfCheck completed
org.kde.pim.kleopatra: startMonitoring
org.kde.pim.kleopatra: startMonitoring waiting for key cache …
org.kde.pim.kleopatra: openOrRaiseMainWindow
org.kde.pim.libkleo: KeyFilterManager:: reload final filter count is 17
org.kde.pim.kleopatra: Hook into the help menu to show the About dialog ourselves
org.kde.pim.kleopatra: open_or_raise showing window
org.kde.pim.kleopatra: you need to register view Kleo::TreeView(0x1b9d1e77920, name=“m_view”) before trying to set it as the current view!
org.kde.pim.kleopatra: No update for: “5.0.1”
org.kde.pim.kleopatra: Startup timing: 4375 ms: new instance created
org.kde.pim.libkleo: Kleo::KeyCache(0x1b9cd8b1530) reload option: 0
org.kde.pim.libkleo: KeyCache::RefreshKeysJob start
org.kde.pim.libkleo: Kleo::KeyCache(0x1b9cd8b1530) reload option: 0
org.kde.pim.libkleo: Kleo::KeyCache(0x1b9cd8b1530) reload - refresh already running
org.kde.pim.libkleo: Waiting for keycache.
org.kde.pim.libkleo: Kleo::KeyCache::RefreshKeysJob(0x1b9d1fb2fb0) RefreshKeysJob::done
org.kde.pim.libkleo: readGroups Reading groups
org.kde.pim.kleopatra: startMonitoring
org.kde.pim.kleopatra: startMonitoring key cache is ready
org.kde.pim.kleopatra: ReaderStatusThread[2nd]: new iteration command= “update” ; nullSlot= true
org.kde.pim.kleopatra: update_cardinfo()
org.kde.pim.libkleo: sendCommand “SCD SERIALNO --all”
org.kde.pim.libkleo: Keycache available.
org.kde.pim.libkleo: Reloading keycache with remarks enabled
org.kde.pim.libkleo: Kleo::KeyCache(0x1b9cd8b1530) reload option: 0
org.kde.pim.libkleo: KeyCache::RefreshKeysJob start
org.kde.pim.kleopatra: onUpdateCardsStarted
org.kde.pim.kleopatra: Kleo::Command(0x1b9cf78e8b0) ~Command
org.kde.pim.kleopatra: Kleo::Command(0x1b9cf78e8b0) ~Private
org.kde.pim.libkleo: sendCommand “SCD SERIALNO --all” failed: “Service is not running” (code: 318, source: SCD)
org.kde.pim.libkleo: sendStatusLinesCommand “SCD SERIALNO --all” : t == NULL
org.kde.pim.kleopatra: Running SCD SERIALNO --all failed: “Service is not running” (code: 318, source: SCD)
org.kde.pim.kleopatra: ReaderStatusThread: Card “” with app “” was added
org.kde.pim.kleopatra: ReaderStatusThread[2nd]: waiting for commands
org.kde.pim.kleopatra: onUpdateFinished
org.kde.pim.libkleo: Kleo::KeyCache::RefreshKeysJob(0x1b9d1feb4b0) RefreshKeysJob::done
org.kde.pim.libkleo: readGroups Reading groups
org.kde.pim.kleopatra: queryClose

So that must mean that the install of Gpg4win is ok (otherwise the alternative user wouldn’t be able to start up Kleopatra without problems). But that something present when logged on with my regular user stops Kleopatra quite early in the start up phase.

So without knowing a lot about the “UiServer” (other that the “Ui” most likely could mean something like “User Interface” like in GUI) it looks like the UiServer has a problem when started with my regular user - according to the log it can be created (=”UiServer created”) but it never gets to the point where it is started up (it never reaches / logs “UiServer started“)

My PC is using “Windows 11 Home Version 25H2“ and as mentioned the GPG4Win is v5.0.1

As mentioned I have tried a clean start inclusive uninstall / install Gpg4win and also ‘removed’ my “gpg keystore”, but as described nothing helped. So I’m out of ideas. During the last install of Gpg4win I also unchecked everything but ‘Kleopatra’ (to make the install as ‘lean’ as possible) but same same same again :frowning:

Therefore I hope somebody here might be able to help help investigating / fixing this problem. Perhaps some additional debugging settings that could give more information about the problem, perhaps some info regarding ‘cleaning up’ (in addtion to the AppData\Roaming\gnupg I already ‘removed) - or something else :slight_smile:

Thanks a lot in advance

I would like to add: ‘gpg’ from the command line works fine without any problems - e.g. ‘gpg –encrypt ..’, ‘gpg –list-keys’, ‘gpg –decrypt…’ and so on

Hi @flagpg4win,
sorry to hear that you have problems running Kleopatra.

It seems you have already discovered that it must be something that is related to the windows user or its data. You have already done some useful analysis, so it seems to be a hard problem.

What would I potentially do?

You could try to compare the fresh user to the non-working user account more deeply. Haver you checked registry entries, environment variables, file systems (their existence, contents), other settings maybe related to security?

Another branch of action can be to get more information about where kleopatra is hanging. I’m no expert on windows debugging. Try to check into debugging tools like process monitor to see what the Kleopatra process is doing. You could also try to attach gdb. Here are some general hints (as Kleopatra is basically a KDE application running on windows): Guidelines and HOWTOs/Debugging/MS Windows - KDE Community Wiki

I do not know if this information is current and on point, but this is where I would start looking for ideas.

Let us know what you find out!
(And another possibility later is to ask on gnupg-users@ mailinglist or a mailinglist or forum related to KDE applications on windows. There maybe experts that have more insights.)

Best Regards,
Bernhard

Hi @bernhard

Thank you very much for your reply.

To make it short: As I described I tried upgrading, reinstalling booting but nothing helped.

So after reading your reply I downloaded DebugView, started it and then started Kleopatra…. which now started up without any problems :open_mouth:

Except for that my PC had a good night’s sleep - plus that I this time started DebugView before I started Kleopatra nothing has changed (no Windows update or updating of other things - nothing (ok, something must have happened since it works now, but I did nothing which I didn’t try yesterday (except for DebugVIew which would be great if it was a miracle cure for these kind of problems - but not very likely :wink:)).

But … problem solved, but no idea what the problem was. Another thing was that DebugView did show some (not problems, just info) during the startup of Kleopatra, so I will save DebugView in my “box of tools” for future use - Sysinternals rocks :slight_smile:

Happy days :+1:
Thanks again

Frank

Hello @flagpg4win,

I suspect that the cause was an issue with the UIServer socket file. (Uiserver is only needed for GpgEX, by the way.)

One thing you should be aware of is that Kleopatra should not be started with admin rights. In that case a socket file may be created with those rights and if that file is not deleted again before the user starts Kleopatra with the normal rights, it can not be accessed. Might this have been the case for you? I’m asking because we have made several changes to get rid of socket issues with other causes and I had hoped that with the change to version 5 they would not occur any more.

If it should occur again that the Kleopatra window does not come up after starting the program, try deleting the file %LOCALAPPDATA%\gnupg\S.uiserver (or all the files in this directory, there might be issues with the other ones too, and it can’t do harm if Gpg4win is not running. They all start with “S.”). Then that file can be created on startup and everything should work again.

Hi

Thank you for your reply

I don’t think that I ever have started Kleopatra in administrator mode - at least not on purpose :slight_smile:

Hopefully this problem will never happen again, but if it does I will try what you suggested here.

Thanks again

Best regards

Frank