SQL database disk image is malformed


If I try to import or create a key I get a SQL database disk image is malformed error
How do i find the sql disk image?

See below error log

C:/Projects/HMCTS/Steven Oliver-Public.asc (imported with gpg)
gpg: DBG: kbx_client_data_cmd: finished command with error: SQL database disk image is malformed
gpg: keydb_get_keyblock failed: Value not found
gpg: error writing keyring '[keyboxd]': SQL database disk image is malformed
gpg: error reading '-&12': SQL database disk image is malformed
gpg: import from '-&12' failed: SQL database disk image is malformed
gpg: Total number processed: 0
C:/Projects/HMCTS/Steven Oliver-Public.asc (imported with gpgsm)
gpgsm: total number processed: 0
gpgsm: error importing certificate: End of file


while this is obviously not great for you thank you very much for your report. This is the reason why we decided for a “careful” rollout of the new keyboxd / key database first for new users. So if you could assist us in figuring out this issue and fix it for the future your help would be greatly appreciated.

I have opened a ticket in our development tracker for this already: ⚓ T6679 Keyboxd: SQL database disk image is malformed

First the database is located at:

This directory is hidden by default but can also be reached if you type %APPDATA% in the Windows explorer address bar.

If you could send us the pubring.db in there to “aheinecke@gnupg.org” this might already be a great help. I would treat this confidentially even though this only contains public keys.

To fix this ensure that no “GnuPG’s public key daemon” process is running with taskmanager and then You can either rename the file pubring.db to something else.

Next time you start kleopatra it should be recrated but you will loose all the keys you have imported so far. If you can then encounter this issue again this means that you have found a reproducible bug, which would really help us. Please let us know how you did that and if it happened after importing a public key please send this key, too.

Then you can disable the new keyboxd by removing the file: %APPDATA%\gnupg\common.conf
That will guaranteed fix the issue since then the new database will no longer be used. But please try to help us first fix this for the future.


1 Like