Closed EdricChan03 closed 4 years ago
Hi. In reviewing what you provided I noticed a few things...
PERSISTENCE
to a value that is not supported. The only values that are supported are: "", "Session", "LocalMachine", or "Enterprise"agent.log
and pintrace.log
from the same gpg session so that I can review them both to trace activity? Please do check it for any data that needs to be redacted before attaching it.uname -a
. Personally, I continue to use WSL1 for its stable and known behaviors -- I have never tried this pinentry solution in WSL2.S.gpg-agent
to /dev/shm/S.gpg-agent
. I used to do that also but it is no longer needed. Recent versions of WSL1 and all versions of WSL2 support sockets in the filesystem. Have you experimented if this issue is related to the socket redirection or the filesystem?:-)
Thanks for the swift reply! As for your questions:
PERSISTENCE
value to "Session"
instead of "System"
. That was a wrong move on my part.pintrace.log
:
OPTION no-grab
OPTION ttyname=/dev/pts/0
OPTION ttytype=xterm-256color
OPTION lc-ctype=C.UTF-8
OPTION lc-messages=C.UTF-8
OPTION allow-external-password-cache
OPTION default-ok=_OK
OPTION default-cancel=_Cancel
OPTION default-yes=_Yes
OPTION default-no=_No
OPTION default-prompt=PIN:
OPTION default-pwmngr=_Save in password manager
OPTION default-cf-visi=Do you really want to make your passphrase visible on the screen?
OPTION default-tt-visi=Make passphrase visible
OPTION default-tt-hide=Hide passphrase
OPTION touch-file=/home/edricchan/.gnupg/S.gpg-agent
OPTION owner=355 Edrics-PC
GETINFO flavor
GETINFO version
GETINFO ttyinfo
GETINFO pid
SETKEYINFO n/<redacted>
SETDESC Please enter the passphrase to unlock the OpenPGP secret key:%0A%22Edric Chan (Key used for Github commit signing) <edric.chan.1997@gmail.com>%22%0A4096-bit RSA key, ID <redacted>,%0Acreated 2020-04-17 (main key ID <redacted>).%0A
SETPROMPT Passphrase:
GETPIN
BYE
gpg-agent.log
(separate session):
2020-09-22 10:42:29 gpg-agent[357] redirecting socket '/home/edricchan/.gnupg/S.gpg-agent' to '/dev/shm/S.gpg-agent'
2020-09-22 10:42:29 gpg-agent[357] listening on socket '/dev/shm/S.gpg-agent'
2020-09-22 10:42:29 gpg-agent[357] redirecting socket '/home/edricchan/.gnupg/S.gpg-agent.extra' to '/dev/shm/S.gpg-agent.extra'
2020-09-22 10:42:29 gpg-agent[357] listening on socket '/dev/shm/S.gpg-agent.extra'
2020-09-22 10:42:29 gpg-agent[357] redirecting socket '/home/edricchan/.gnupg/S.gpg-agent.browser' to '/dev/shm/S.gpg-agent.browser'
2020-09-22 10:42:29 gpg-agent[357] listening on socket '/dev/shm/S.gpg-agent.browser'
2020-09-22 10:42:29 gpg-agent[357] redirecting socket '/home/edricchan/.gnupg/S.gpg-agent.ssh' to '/dev/shm/S.gpg-agent.ssh'
2020-09-22 10:42:29 gpg-agent[357] listening on socket '/dev/shm/S.gpg-agent.ssh'
2020-09-22 10:42:29 gpg-agent[358] gpg-agent (GnuPG) 2.2.19 started
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK Pleased to meet you, process 355
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- RESET
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- OPTION ttyname=/dev/pts/0
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- OPTION ttytype=xterm-256color
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- OPTION lc-ctype=C.UTF-8
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- OPTION lc-messages=C.UTF-8
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- GETINFO version
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> D 2.2.19
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- OPTION allow-pinentry-notify
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- OPTION agent-awareness=2.1.0
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- SCD SERIALNO
2020-09-22 10:42:29 gpg-agent[358] no running SCdaemon - starting it
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 <- ERR 67109133 can't exec `/usr/lib/gnupg/scdaemon': No such file or directory
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 -> BYE
2020-09-22 10:42:29 gpg-agent[358] can't connect to the SCdaemon: IPC connect call failed
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> ERR 67108983 No SmartCard daemon <GPG Agent>
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- HAVEKEY <redacted>
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> ERR 67108881 No secret key <GPG Agent>
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- HAVEKEY <redacted>
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- HAVEKEY <redacted> <redacted> <redacted> <redacted> <redacted>
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- HAVEKEY <redacted>
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- HAVEKEY <redacted>
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- KEYINFO <redacted>
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> S KEYINFO <redacted> D - - - P - - -
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- RESET
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- SIGKEY <redacted>
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- SETKEYDESC Please+enter+the+passphrase+to+unlock+the+OpenPGP+secret+key:%0A%22Edric+Chan+(Key+used+for+Github+commit+signing)+<edric.chan.1997@gmail.com>%22%0A4096-bit+RSA+key,+ID+<redacted>,%0Acreated+2020-04-17+(main+key+ID+<redacted>).%0A
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- SETHASH 10 <redacted>
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 -> OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_10 <- PKSIGN
2020-09-22 10:42:29 gpg-agent[358] starting a new PIN Entry
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 <- OK Your orders please
2020-09-22 10:42:29 gpg-agent[358] DBG: connection to PIN entry established
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 -> OPTION no-grab
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 -> OPTION ttyname=/dev/pts/0
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 -> OPTION ttytype=xterm-256color
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 -> OPTION lc-ctype=C.UTF-8
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 -> OPTION lc-messages=C.UTF-8
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:29 gpg-agent[358] DBG: chan_11 -> OPTION allow-external-password-cache
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 -> OPTION default-ok=_OK
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 -> OPTION default-cancel=_Cancel
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 -> OPTION default-yes=_Yes
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 -> OPTION default-no=_No
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 -> OPTION default-prompt=PIN:
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 -> OPTION default-pwmngr=_Save in password manager
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 -> OPTION default-cf-visi=Do you really want to make your passphrase visible on the screen?
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 -> OPTION default-tt-visi=Make passphrase visible
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:30 gpg-agent[358] DBG: chan_11 -> OPTION default-tt-hide=Hide passphrase
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 -> OPTION touch-file=/home/edricchan/.gnupg/S.gpg-agent
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 -> OPTION owner=355 Edrics-PC
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 -> GETINFO flavor
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 <- ERR 83886355 unknown command
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 -> GETINFO version
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 <- D 0.2.1
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 -> GETINFO ttyinfo
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 <- ERR 83886355 unknown command
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 -> GETINFO pid
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 <- D 361
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_10 -> INQUIRE PINENTRY_LAUNCHED 361 unknown 0.2.1 ? ? ?
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_10 <- END
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 -> SETKEYINFO n/<redacted>
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 -> SETDESC Please enter the passphrase to unlock the OpenPGP secret key:%0A%22Edric Chan (Key used for Github commit signing) <edric.chan.1997@gmail.com>%22%0A4096-bit RSA key, ID <redacted>,%0Acreated 2020-04-17 (main key ID <redacted>).%0A
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 -> SETPROMPT Passphrase:
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 <- OK
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 -> [[Confidential data not shown]]
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 <- [[Confidential data not shown]]
2020-09-22 10:42:31 gpg-agent[358] DBG: error calling pinentry: Operation cancelled <Pinentry>
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_11 -> BYE
2020-09-22 10:42:31 gpg-agent[358] failed to unprotect the secret key: Operation cancelled
2020-09-22 10:42:31 gpg-agent[358] failed to read the secret key
2020-09-22 10:42:31 gpg-agent[358] command 'PKSIGN' failed: Operation cancelled <Pinentry>
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_10 -> ERR 83886179 Operation cancelled <Pinentry>
2020-09-22 10:42:31 gpg-agent[358] DBG: chan_10 <- [of]
uname -a
: Linux Edrics-PC 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
lsb_release -a
:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal
I don't see an immediate fix, and I don't see an immediate cause. More research will be needed.
PERSISTENCE=""
? You should get a Windows UI prompt for your passwords but they will never be persisted. Personally, I use Enterprise
persistence though all three should function.Our gpg versions are slightly different. There could be an issue there.
Your pintrace.log
suggests the pinentry-wsl-ps1.sh
is working as expected. I turned on the debug log with my WSL1 setup and got line-for-line same log entries except for...
/dev/tty1
. Your WSL2 has /dev/pts/0
. If I open a WSL2 Debian on my machine, my tty is /dev/pts/0
. That's good to see we can have similar tty setups.I'm booked with other work this week, but will have some time next week to dig further into this. Your answers to the above 2 inquires can help me discover what is different between our setups and isolate the issue/fix. :-)
Seems that running the same setup on WSL1 yields a different error message without the pinentry-program
config:
gpg: using "<redacted>" as default secret key for signing
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
test
gpg: signing failed: Permission denied
gpg: [stdin]: clear-sign failed: Permission denied
Which can be resolved by adding a flag --pinentry-mode=loopback
to the command (more info from this AskUbuntu question), where an "Enter passphrase:" prompt appears.
However, uncommenting the pinentry-program
results in the same error message being outputted:
gpg: using "<redacted>" as default secret key for signing
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
test
gpg: signing failed: Operation cancelled
gpg: [stdin]: clear-sign failed: Operation cancelled
PERSISTENCE
back to its original value has no effect - the same error message is outputted.I think this is something external to this project's script. Your first experiment in WSL1 not using theis project's script hints this. The "permission denied" errors in your WSL1 attempt are coming direct from gpg due to some unknown user/group/permission/process/etc issue. If basic GPG doesn't work, there is little chance this project's script will work.
I recommend focusing on getting basic gpg pinentry methods working. I do not recommend the loopback
option as it is primarily focused on backwards compatibility and piping passwords via commandline. You should not need to enable that. Basic pinentry function should work without it.
Since you are experiencing GPG problems when not using this project's script (your first WSL1 try), this is not something I can provide support. I believe you are experiencing it. However, I don't have the bandwidth to help you resolve issues with GPG itself. I recommend you seek support for GPG on the internet to see if others can help you identify why GPG doesn't work for you in the simple case. You should be able to get it working in WSL1, using pinentry-curses
and no other workarounds (e.g. loopback). When the fix is identified, then you can increase your complexity (WSL2, this project's script, etc.)
As reference, this setup works great on my computer using only GPG code. It exercises gpg, the agent, and the pinentry workflow. If this doesn't work, then you will need to explore the cause of the failure and resolve it.
gpg --version
, it should report gpg (GnuPG) 2.2.4
and libgcrypt 1.8.1
gpg-connect-agent 'keyinfo --list' /bye
. You should see a list of keygrips for your gpg keys.apt install pinentry-curses
and you should have pinentry-curses/bionic,now 1.1.0-1
wsl --shutdown
echo "test" | gpg --clearsign
gpg-agent.conf file
pinentry-program /usr/bin/pinentry-curses
I guess it could be one of many reasons why it did not work:
Something might've gone wrong with the way I migrated my current WSL2 setup to WSL1. These were the steps I took to migrate it (using a Command Prompt in administrator mode, as well as the steps as indicated in this StackOverflow answer):
cd: C:\Users\edric\Desktop
wsl --export Ubuntu ubuntu2.tar
wsl --import UbuntuWSL1 .\UbuntuWSL1 ubuntu2.tar --version 1
Or I suppose that Ubuntu 20.04 isn't supported with WSL1?
Or something's wrong with my local setup? I've set up the GPG keys such that it uses a sub-key system, where the main keys are stored on a thumb drive and removed from the main system such that it cannot be easily compromised.
Anyways, I've tried creating a new setup with WSL1 and Ubuntu 18.04, installed from the Windows Store and done the following:
I then shut down the WSL instance, re-opened Ubuntu 18.04 and then ran the following commands:
So I guess it would be something wrong with my current WSL2 setup.
I installed a fresh WSL2 Ubuntu 20.04 LTS distribution today.
Installing, this may take a few minutes
and prompted me for my username/password.wsl --set-version Ubuntu-20.04 2
wsl -l -v
sudo apt update
then sudo apt upgrade
then exit
wsl -t Ubuntu-20.04
then launch Ubuntu 20.04 againI then followed your same commands (using my Ubuntu 20.04) that you listed in the first group after you write Anyways, I've tried creating a new setup with WSL1 and Ubuntu 18.04, installed from the Windows Store and done the following:
And I got the same error you got. Mine reported...
dale@dale-euro:~$ ls -l /usr/bin/pinentry-curses
-rwxr-xr-x 1 root root 68240 Mar 22 2020 /usr/bin/pinentry-curses
dale@dale-euro:~$ gpgconf --kill gpg-agent
dale@dale-euro:~$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 892 572 ? Sl 14:34 0:00 /init
root 6 0.0 0.0 892 80 ? Ss 14:34 0:00 /init
root 7 0.0 0.0 892 80 ? R 14:34 0:00 /init
dale 8 0.0 0.0 10168 5224 pts/0 Ss 14:34 0:00 -bash
dale 120 0.0 0.0 10612 3432 pts/0 R+ 14:46 0:00 ps aux
dale@dale-euro:~$ echo "test" | gpg --clearsign
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
test
gpg: signing failed: Inappropriate ioctl for device
gpg: [stdin]: clear-sign failed: Inappropriate ioctl for device
This is a pure WSL, Ubuntu, GPG issue and has nothing to do with this project's script. I can reproduce your error, but it isn't this project that causes it. This is outside my project's code and I recommend you seek GPG assistance elsewhere to resolve it.
That written, I did try a few things because eventually I want to migrate to WSL2 on my primary machines.
.bashrc
and put at the top export GPG_TTY=$(tty)
and savedexit
the distroecho "test" | gpg --clearsign
I know you also saw improvements defining that value. So I continued forward to see if now this project's script will work.
pinentry-wsl-ps1.sh
from the repo to my home directory in Ubuntu 20.04chmod ug=rx,o= pinentry-wsl-ps1.sh
exit
the distroecho "test" | gpg --clearsign
This is a pure WSL, Ubuntu, GPG issue and has nothing to do with this project's script. I can reproduce your error, but it isn't this project that causes it. This is outside my project's code and I recommend you seek GPG assistance elsewhere to resolve it.
Sorry, but I didn't mention that I had then run export GPG_TTY=$(tty)
which resolved the issue. (I had only run this once I restarted the instance.)
- copied
pinentry-wsl-ps1.sh
from the repo to my home directory in Ubuntu 20.04chmod ug=rx,o= pinentry-wsl-ps1.sh
exit
the distro- In cmd prompt terminated the distro
- Launched Ubuntu 20.04
echo "test" | gpg --clearsign
- It prompted me with this project's GUI UI for my password and successfully clearsigned the message 👍
Yup, I can confirm that these steps work for me on my WSL1 Ubuntu 18.04 setup, where a GUI shows up:
I can also confirm that migrating the Ubuntu 18.04 setup to WSL2 also works (using the following steps):
wsl --set-version Ubuntu-18.04 2
.
C:\WINDOWS\system32>wsl --set-version Ubuntu-18.04 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Conversion complete.
wsl --list --verbose
:
C:\WINDOWS\system32>wsl --list --verbose
NAME STATE VERSION
* Ubuntu Running 2
UbuntuWSL1 Stopped 1
Ubuntu-18.04 Stopped 2
echo "test" | gpg --clearsign
, where once again the password dialog successfully appeared.So it seems it's most likely something to do with my current WSL2 setup.
Good progress! Yes, export GPG_TTY=$(tty)
is needed on every login.
I just finished completing a migration of my WSL1 Ubuntu 18.04 -> WSL2 Ubuntu 20.04. I only had to copy my customizations for .profile, .bashrc, /etc/fstab, and /etc/wsl.conf. I'm able to use GPG with the GUI UI and persistence. Thank you for inquiring on this issue, it pushed me to go ahead with WSL2.
I did notice two things I do in my setup on WSL1 and now with WSL2
.profile
. I put it there because that is also loaded by shells like sh
export GPG_TTY=$(tty)
gpgconf --launch gpg-agent
gpgconf --launch dirmngr
~/.gnupg/gpg.conf
I have the following. I think these are leftover from the early WSL1 time when I manually redirected the SSH sockets. Because I needed to do the link/directory work in the .profile/.bashrc before the agent was launched. So I did that and then manually launched the agent. That's why you see that agent launch above. Also, this guarantees that the GPG_TTY
is set before the agent is launched. It is probably not needed anymore, but I am going to leave it because there is no need for me to change what it already working.
use-agent
no-autostart
Be sure to set your GPG_TTY in WSL2. And read https://dev.gnupg.org/T3716 and try their debug/log setup at the 19 April 2018 comment.
I'm going to close this issue as an "external" issue since you have 18.04 working in WSL1/2. And I'm able to do the same + Ubuntu 20.04 in WSL2. If you find an issue with this project's GUI or persistence script, please open a new issue so we can focus on that specific issue.
Cheers!
Could this be a GPG version issue? It seems that the pre-installed version of GPG on Ubuntu 18.04 is stuck at 2.2.4:
While GPG on Ubuntu 20.04 is currently tied to 2.2.19:
I've also tried creating a new temporary GPG home directory using the following steps on my default WSL2 setup:
mkdir -p ~/temp/.gnupg
.GNUPGHOME
to the temporary directory with export GNUPGHOME=/home/<username>/temp/.gnupg
.gpg -K
.gpg --full-generate-key
.gpg-agent.conf
file with the following contents:
pinentry-program /home/<username>/bin/pinentry-wsl-ps1.sh
gpgconf --kill gpg-agent
.echo "test" | gpg --clearsign
, where the same "Operation cancelled" error is shown.I've also tried to retrieve a fresh copy of the pinentry script and redid most of the steps but to no avail.
A reminder that I can not provide support for GPG. I recommend you visit https://www.google.com/search?q=gpg+support+forum to find a group that can provide you assistance with your core GPG issues.
Description
When attempting to sign with gpg, an error is thrown indicating the operation was cancelled.
Setup
Computer Hardware
OS version
Other
gpg
version:2.2.19
pinentry-wsl-ps1.sh
: master (last updated: 19 Nov 2018)2.0
pinentry-wsl-ps1.sh
on your computer:bin
repository. (Located in$HOME/bin
)wget https://raw.githubusercontent.com/diablodale/pinentry-wsl-ps1/master/pinentry-wsl-ps1.sh
.chmod ug=rx pinentry-wsl-ps1.sh
.pinentry-wsl-ps1.sh
filePERSISTENCE
value to"System"
.NOTIFY
value to"0"
.DEBUGLOG
value to"$HOME/pintrace.log"
.Steps to reproduce
~/.gnupg/gpg-agent.conf
file and include the following settings. Replaceusername
or the whole path to a location you want to create the log file.echo "test" | gpg --clearsign
. An error should appear on the console.Actual Result
Running
echo "test" | gpg --clearsign
results in the log below:Expected Result
I would expect a password prompt dialog to appear requesting for the key's password.
Workarounds
Use the TTY instead for the password prompt:
~/.profile
:GPG-agent log file