Page 1 of 1

gpg don't work under ctrl alt F1 terminal [Solved]

Posted: Sat Feb 23, 2013 0:01
by mrizzone
Hello! When I open a terminal with CTRL ALT F1 and run gpg, it fails in generating a new key. The process is OK until the end, when i get this message:

pinentry 12311 gtk warning ** cannot open display
gpg agent 12310 can't connect to the pin entry module: end of file
gpg agent 12310 command get_passphrase cancelled: no pinentry

Works OK when I run gpg under GUI terminal. Any clue?

Thanks!

Re: gpg don't work under CTRL ALT F1 terminal

Posted: Sat Feb 23, 2013 0:33
by Ryuno-Ki
The virtual command, which you use via Ctrl+Alt+F1, has no DISPLAY var.

Code: Select all

DISPLAY=:0 yourgpgcommandhere
Not tested, but Gtk is a graphic library ;)

Re: gpg don't work under CTRL ALT F1 terminal

Posted: Sat Feb 23, 2013 10:47
by svantoviit
I would try to
  1. edit ~/.gnupg/gpg-agent.conf and change

    Code: Select all

    pinentry-program /usr/bin/pinentry-gtk-2
    to

    Code: Select all

    pinentry-program /usr/bin/pinentry-curses
    Update: This method actually works for me
    After editing the conf file you need to restart the agent

    Code: Select all

    gpgconf --reload gpg-agent
    In addition I have the following lines in my ~/.bashrc

    Code: Select all

    GPG_TTY=$(tty)
    export GPG_TTY
    but actually don't know if it's really needed.

    or
  2. change the pinentry implementation using eselect

    Code: Select all

    $ eselect pinentry list
    Available pinentry implementations:
      [1]   pinentry-gtk-2 *
      [2]   pinentry-qt4
      [3]   pinentry-curses
    $ eselect pinentry set 3
    
Comment: The DISPLAY method as suggested by Ryuno-Ki displays the pinentry-gtk window in your running X, so you could switch to it (Ctrl-Alt-F7) and enter the password there.

Re: gpg don't work under CTRL ALT F1 terminal

Posted: Sat Feb 23, 2013 11:37
by Ryuno-Ki
svantoviit wrote:

Code: Select all

GPG_TTY=$(tty)
export GPG_TTY
You can put that in one line:

Code: Select all

export FOO=$(echo 'bar')
svantoviit wrote:Comment: The DISPLAY method as suggested by Ryuno-Ki displays the pinentry-gtk window in your running X, so you could switch to it (Ctrl-Alt-F7) and enter the password there.
Correct.

Re: gpg don't work under CTRL ALT F1 terminal

Posted: Sat Feb 23, 2013 15:29
by mrizzone
Whit gpgconf --reload gpg-agent was enough. Works better than new, thanks!

Re: gpg don't work under ctrl alt F1 terminal [Solved]

Posted: Sun Feb 24, 2013 10:07
by svantoviit
Please, mark your thread as [Solved] then.