[pkg-gnupg-maint] Bug#1058572: Bug#1058572: Bug#1058572: gnupg2.4: fail to initialize homedir and generate key due to keyboxd

NIIBE Yutaka gniibe at fsij.org
Tue Dec 19 07:27:10 GMT 2023


Hello, again,

YunQiang Su <wzssyqa at gmail.com> wrote:
> gpg: error writing public keyring '[keyboxd]': Attempt to write a
> readonly SQL database
> Key generation failed: Attempt to write a readonly SQL database

NIIBE Yutaka <gniibe at fsij.org> wrote:
> I can't replicate this issue on my system.  With a new user I created
> for the test, I had no problem; The directory ~/.gnupg is created,
> ~/.gnupg/public-keys.d is created, and ~/.gnupg/public-keys.d/pubring.db
> is created.  Note that keyboxd just works with systemd by socket
> activation.

For your information, I managed to replicate the error by doing
following:

    # For the user having no .gnupg directory, run gpg at the first
    # time.  It creates .gnupg directory by gpg and .gnupg/public-keys.d
    # by keyboxd
    $ gpg -k
    gpg: directory '/home/u/.gnupg' created
    gpg: /home/u/.gnupg/trustdb.gpg: trustdb created

    # Move the ~/.gnupg/public-keys.d while it is in-use by keyboxd
    $ mv ~/.gnupg/public-keys.d ~/.gnupg/public-keys.d.bak

    # In this situation, creat a key, to be stored by keyboxd
    # Then, we see the error
    $ gpg --pinentry-mode=loopback --debug ipc --quick-gen-key "a user <u at gniibe.org>"
    [...]
    gpg: writing public key to '[keyboxd]'
    gpg: error writing public keyring '[keyboxd]': Attempt to write a readonly SQL database
    Key generation failed: Attempt to write a readonly SQL database

The error may occur, when the database is moved and some data is to be written.

I don't think your case was same, but when someone encounters similar,
this would be an information to investigate the cause.
-- 



More information about the pkg-gnupg-maint mailing list