You are not logged in.

#1 2014-11-06 02:36:16

paleneutron
Member
Registered: 2014-11-06
Posts: 18

My gpg-agent do not start automaticly

My session is Plasma5.
The first time I create a gpg key, everything works well.
But after I removed my former gpg key and create a new one something changed.(the new one's name is the same as the former one)
After reboot, I got a warning that 'gpr-agent is not running'
All my configuration is the same as https://wiki.archlinux.org/index.php/GnuPG#gpg-agent.

and I could start it manually.

So, what's the problem?

Last edited by paleneutron (2014-11-06 05:11:38)

Offline

#2 2014-11-06 12:20:02

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: My gpg-agent do not start automaticly

So, where did you configure it for autostart?

Offline

#3 2014-11-06 12:49:03

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: My gpg-agent do not start automaticly

Paleneutron, it looks like you hit report rather than reply:

paleneutron wrote:

I am not sure, maybe:
~/.gnupg/gpg.conf

use-agent


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2014-11-06 13:47:09

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: My gpg-agent do not start automaticly

I'll run with it tongue

If you don't know, I'm going to assume that you didn't configure it at all. As the wiki entry states:

Arch Wiki wrote:

gpg-agent is mostly used as daemon to request and cache the password for the keychain. This is useful if GnuPG is used from an external program like a mail client. It can be activated by adding following line in gpg.conf:

~/.gnupg/gpg.conf

use-agent

This tells GnuPG to use the agent whenever it needs the password. However, the agent needs to be already running. To autostart it, add the following entry to your .xinitrc or .bash_profile.

That part is what you have done. Below it, it states that you need to autostart gpg-agent and it seems you skipped that part. So, please read the part under gpg-agent to figure out how to set it up (autostart gpg-agent). I think you'll need to edit your .bash_profile as your session is a plasma session.

Last edited by runical (2014-11-06 15:02:58)

Offline

#5 2014-11-06 14:57:12

paleneutron
Member
Registered: 2014-11-06
Posts: 18

Re: My gpg-agent do not start automaticly

Trilby wrote:

Paleneutron, it looks like you hit report rather than reply:

paleneutron wrote:

I am not sure, maybe:
~/.gnupg/gpg.conf

use-agent

I am so sorry I have report a post again before I realized what happens... TAT

Offline

#6 2014-11-06 15:36:11

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: My gpg-agent do not start automaticly

I see it.

paleneutron wrote:

Unfortunately, I have edited my .bash_profile as wiki and it works well before I delet my former key.
And I could not restart gpg-agent manually by:
~$ sh .bash_profile
That's the reason why I am not sure which commad to start my gpg-agent.

Please try to click quote and not report. wink


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#7 2014-11-06 15:49:49

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: My gpg-agent do not start automaticly

fsckd wrote:

I see it.

paleneutron wrote:

Unfortunately, I have edited my .bash_profile as wiki and it works well before I delet my former key.
And I could not restart gpg-agent manually by:
~$ sh .bash_profile
That's the reason why I am not sure which commad to start my gpg-agent.

Please try to click quote and not report. wink

Or just leave the quote out tongue (Something new: Troubleshooting with the moderators as relay)

sh .bash_profile

Hmm. I don't think that that command would fix it (not only because bash_profile is not an SH script but a bash script).

Can you try executing the mentioned code via a script file and post the output here?
Put it in a file and execute the file with

bash [filename]

EDIT: Can you also post your .bash_profile?

Last edited by runical (2014-11-06 15:51:45)

Offline

#8 2014-11-07 00:34:05

paleneutron
Member
Registered: 2014-11-06
Posts: 18

Re: My gpg-agent do not start automaticly

runical wrote:
fsckd wrote:

I see it.

paleneutron wrote:

Unfortunately, I have edited my .bash_profile as wiki and it works well before I delet my former key.
And I could not restart gpg-agent manually by:
~$ sh .bash_profile
That's the reason why I am not sure which commad to start my gpg-agent.

Please try to click quote and not report. wink

Or just leave the quote out tongue (Something new: Troubleshooting with the moderators as relay)

sh .bash_profile

Hmm. I don't think that that command would fix it (not only because bash_profile is not an SH script but a bash script).

Can you try executing the mentioned code via a script file and post the output here?
Put it in a file and execute the file with

bash [filename]

EDIT: Can you also post your .bash_profile?

My .bash_profile:

#
# ~/.bash_profile
#

[[ -f ~/.bashrc ]] && . ~/.bashrc

#gpg-agent is mostly used as daemon to request and cache the password for the keychain
envfile="$HOME/.gnupg/gpg-agent.env"
if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then
    eval "$(cat "$envfile")"
else
    eval "$(gpg-agent --daemon --enable-ssh-support --write-env-file "$envfile")"
fi
export GPG_AGENT_INFO  # the env file does not contain the export statement
export SSH_AUTH_SOCK   # enable gpg-agent for ssh

After login I tried:

➜ ➜  ~  echo $GPG_AGENT_INFO

➜  ~  pgrep gpg-agent
➜  ~  bash .bash_profile
➜  ~  pgrep gpg-agent   
790
➜  ~  

and another problem happens, I could not logout.
When I tried to logout, the process stacked at"/dev/sda1:clean XXXXX" on the screen.
So I have to reboot instead of logout and login.

Last edited by paleneutron (2014-11-07 01:09:09)

Offline

#9 2014-11-07 01:02:32

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: My gpg-agent do not start automaticly

You have removed a comment hash from the line that starts: "gpg-agent is mostly..."


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#10 2014-11-07 01:10:52

paleneutron
Member
Registered: 2014-11-06
Posts: 18

Re: My gpg-agent do not start automaticly

jasonwryan wrote:

You have removed a comment hash from the line that starts: "gpg-agent is mostly..."

Yes...
But! It's not the reason cause the problem.
The issue still troubles me after I fix the comment...
See the post I have edited.

Offline

#11 2014-11-07 01:22:03

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: My gpg-agent do not start automaticly

So your .bash_profile isn't being sourced by your {display,login} manager...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#12 2014-11-07 02:30:10

paleneutron
Member
Registered: 2014-11-06
Posts: 18

Re: My gpg-agent do not start automaticly

jasonwryan wrote:

So your .bash_profile isn't being sourced by your {display,login} manager...

Hmm... That's the point.
So... my assumption is that I have a problem with sddm so that I got another problem with logout.

My display manager is sddm.
But why sddm broke after I delete a key... and I have no idea to fix it.

Last edited by paleneutron (2014-11-07 08:37:10)

Offline

#13 2014-11-09 09:33:19

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: My gpg-agent do not start automaticly

You can try removing SDDM's settings and see if this helps. Another option is to add the script to the KDE autostart, although that will only fix it in KDE, not in other sessions.

Offline

#14 2014-11-09 09:53:16

paleneutron
Member
Registered: 2014-11-06
Posts: 18

Re: My gpg-agent do not start automaticly

runical wrote:

You can try removing SDDM's settings and see if this helps. Another option is to add the script to the KDE autostart, although that will only fix it in KDE, not in other sessions.

I found this in my /usr/share/sddm/scripts/Xsession.

#! /bin/sh
# Xsession - run as user

# This file is extracted from kde-workspace (kdm/kfrontend/genkdmconf.c)
# Copyright (C) 2001-2005 Oswald Buddenhagen <ossi@kde.org>

session=$1

# Note that the respective logout scripts are not sourced.
case $SHELL in
  */bash)
    [ -z "$BASH" ] && exec $SHELL $0 "$@"
    set +o posix
    [ -f /etc/profile ] && . /etc/profile
    if [ -f $HOME/.bash_profile ]; then
      . $HOME/.bash_profile
    elif [ -f $HOME/.bash_login ]; then
      . $HOME/.bash_login
    elif [ -f $HOME/.profile ]; then
      . $HOME/.profile
    fi
    ;;
  */zsh)
    [ -z "$ZSH_NAME" ] && exec $SHELL $0 "$@"
    emulate -R sh
    [ -d /etc/zsh ] && zdir=/etc/zsh || zdir=/etc
    zhome=${ZDOTDIR:-$HOME}
    # zshenv is always sourced automatically.
    [ -f $zdir/zprofile ] && . $zdir/zprofile
    [ -f $zhome/.zprofile ] && . $zhome/.zprofile
    [ -f $zdir/zlogin ] && . $zdir/zlogin
    [ -f $zhome/.zlogin ] && . $zhome/.zlogin
    ;;

Does it meens the sddm only source zsh's profile if my $SHELL is zsh?
Maybe...So, I am confused about why my gpg-agent works well at the very beginning...

Offline

#15 2014-11-09 10:17:32

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: My gpg-agent do not start automaticly

Well, yes. If you change your shell, the startup behaviour changes. It doesn't make any sense to source bash files if the shell is zsh, does it?

Did you change the shell with chsh?

Offline

#16 2014-11-09 11:29:53

paleneutron
Member
Registered: 2014-11-06
Posts: 18

Re: My gpg-agent do not start automaticly

runical wrote:

Well, yes. If you change your shell, the startup behaviour changes. It doesn't make any sense to source bash files if the shell is zsh, does it?

Did you change the shell with chsh?

Interesting, I used zsh as my shell since I useradd this account.
I'll try to move this autostart command from `.bash_profile` to `.xprofile`.
===========
It works!
Also, I can logout as usual. XD
Thanks a lot!

Offline

#17 2014-11-09 11:47:02

runical
Member
From: The Netherlands
Registered: 2012-03-03
Posts: 896

Re: My gpg-agent do not start automaticly

No problem. Please mark the thread as solved by editing the first post and putting [Solved] in front of the current title.

Offline

Board footer

Powered by FluxBB