Is /usr/share/upstart/sessions/gpg-agent.conf executed?

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
ilya40umov

Is /usr/share/upstart/sessions/gpg-agent.conf executed?

Post by ilya40umov »

In my distribution (Linux Mind 18.3, Cinnamon 64bit, 4.13.0-32) I have /usr/share/upstart/sessions/gpg-agent.conf with the following content:

Code: Select all

description "GPG Agent"
author "Stéphane Graber <stgraber@ubuntu.com>"

start on starting xsession-init and (no-pinentry-gnome3 or started dbus)

pre-start script
    GNUPGHOME=$HOME/.gnupg
    [ -d $GNUPGHOME ] || { stop; exit 0; }

    # /etc/X11/Xsession.d/90gpg-agent starts the agent without DBUS,
    # thus can't use pinentry-gnome3
    # but we know we have dbus now, restart gpg-agent
    gpgconf --kill gpg-agent
    gpgconf --launch gpg-agent
    initctl set-env --global GPG_AGENT_INFO=$GNUPGHOME/S.gpg-agent:0:1

    if [ -n "$(gpgconf --list-options gpg-agent | awk -F: '/^enable-ssh-support:/{ print $10 }')" ]; then
        initctl set-env --global SSH_AUTH_SOCK=$GNUPGHOME/S.gpg-agent.ssh
    fi
end script

post-stop script
    gpgconf --kill gpg-agent
    initctl unset-env --global GPG_AGENT_INFO

    if [ -n "$(gpgconf --list-options gpg-agent | awk -F: '/^enable-ssh-support:/{ print $10 }')" ]; then
        initctl unset-env --global SSH_AUTH_SOCK
    fi
end script
Now, I suspect that this file is not being executed (I added some echo "Abc" > $HOME/.gnupg/abc to pre-start, and it did not take any effect when I rebooted my machine), and this is actually a problem for me, because an process of gpg-agent that is running when my laptop boots can't properly talk to its scdaemon. Meaning that I get

Code: Select all

gpg: selecting openpgp failed: Card not present
gpg: OpenPGP card not available: Card not present
Up until I run:

Code: Select all

gpgconf --kill scdaemon && gpgconf --kill gpg-agent && gpgconf --launch gpg-agent
And only then, I can actually access my Yubikey (e.g. run gpg2 --card-status). I'm currently tempted to just restart gpg-agent semi-manually to solve this issue.
However, my question here would be: Is /usr/share/upstart/sessions/gpg-agent.conf actually being run on boot? If not, does Mint run any of the files in that directly at all? If yes, how do I tell which ones are run by upstart?
I would also welcome any other advice!

P.S. Not sure if it's relevant, but I do remember I had to install dbus-user-session to make gpg-agent communicate with pinentry/seahorse and ask me into enter the passphrase for the key.

P.S. I'm on the last stage of setting up my Yubikey in order to being able use it as a GPG smart card (in addition to U2F and generating OAUTH codes), and apart from that little issue I'm already able to use the gpg keys stored on Yubikey for SSH and commit signing.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
ilya40umov

Re: Is /usr/share/upstart/sessions/gpg-agent.conf executed?

Post by ilya40umov »

Looks like I have found the reason of why I was getting

Code: Select all

gpg: selecting openpgp failed: Card not present
and it seems it was the smart card reader that came with my Thinkpad.
Once I have disabled the smart card port in BIOS, the issue (which I was only experiencing after booting the system) was gone.

Anyway, I would still love to know if the job that I mentioned (/usr/share/upstart/sessions/gpg-agent.conf) actually gets executed on boot, along with others from the same directory.

Thanks,
Illia
Last edited by ilya40umov on Fri Feb 16, 2018 2:06 pm, edited 1 time in total.
User avatar
thx-1138
Level 8
Level 8
Posts: 2092
Joined: Fri Mar 10, 2017 12:15 pm
Location: Athens, Greece

Re: Is /usr/share/upstart/sessions/gpg-agent.conf executed?

Post by thx-1138 »

ilya40umov wrote: Fri Feb 16, 2018 1:24 pm ............
Anyway, I would still love to know if the job that I mentioned (/usr/share/upstart/sessions/gpg-agent.conf) actually gets executed on boot, along with others from the same directory.
I'd try lsof...ie. lsof | grep gpg-agent.conf...

I haven't used gpg since a long time, but i'd doubt the above .conf is being used nowadays (as Mint 18 uses systemd, not upstart...)
Locked

Return to “Software & Applications”