New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GPG with Yubikey doesn't work on WSL2 with systemd activated #9817
Comments
Thanks for reporting this @huangnazu. I wonder if the issue is that the What's the output of |
Thank you for your reply. I tried it in both cases of systemd was activated or not. |
Interesting. Does the socket actually exist in both cases ? What's the output of |
Okay. In both cases, the outputs of
In the case of systemd activated,
In the case of systemd not activated,
|
FYI, I picked the suspicious lines up from diff of both outputs.
|
I wonder if you have another gpg deamon running with systemd. What's the output of |
Sorry for replying late.
|
With systemd enabled, |
Thank you for your advice.
|
I had this problem, too. I don't remember if all of these are required but I took a rather heavy handed approach. The following will disable the unit files that create the sockets found in the GPG socket directory. After you restart WSL2 you should be golden. sudo systemctl disable --global gpg-agent.socket
sudo systemctl disable --global gpg-agent-extra.socket
sudo systemctl disable --global gpg-agent-ssh.socket
sudo systemctl disable --global gpg-agent-browser.socket
sudo systemctl disable --global dirmngr.socket Edit: My statement about the use of the |
Getting the same issue. Disabling systemd, gpg works as expected. @mosullivan93 I tried disabling those, but no luck. |
@internalsystemerror Ah, you're right. I had to go back and double check all of the changes I made to my startup scripts. I've had my YubiKey+GPG working in systemd/WSL2 for some time, but there was one more problem I had to track down. What I found was that after WSL2 starts (i.e. you open Ubuntu in Windows Terminal) and your first terminal is ready, a second login shell spawns in the background that serves as a persistent systemd login session (it remains when you exit your terminal and can be seen with My solution now (which works regardless of whether I enable systemd) is two fold: use if [[ -n "${XDG_SESSION_ID}" && "${TERM}" == "dumb" &&
"$(ps -p $PPID -o comm=)" == "login" ]]; then
# Running in the background login process. Do nothing.
return
fi |
I solved the problem by just following this. |
Old post I know but I had to sort out why it seemed to break on my Debian install when I had it working in Ubuntu. I figured out for the reason why I had my script a certain way and your mention of disabling the socket services resolved why some of my sockets were not being created. In the end all is working again. My additional heavy handedness is that I create sockets in both /run/user/UID and /home/USER/.gnupg because for whatever reason it doesn't just use the copy in /run/user/UID or /home/USER/.gnupg. It might pick one randomly and break if that one doesn't exist so this ensures that they will exist. |
Windows Version
Microsoft Windows [Version 10.0.22624.1465]
WSL Version
1.1.5.0
Are you using WSL 1 or WSL 2?
Kernel Version
5.15.90.1
Distro Version
Ubuntu 22.04
Other Software
In Windows,
In Ubuntu on WSL,
Repro Steps
In order to use Yubikey on WSL, I followed articles about using Yubikey on WSL such as here.
And I succeeded to use GPG with Yubikey on WSL.
But in another matter, I modified
/etc/wsl.conf
as follows:Expected Behavior
On WSL, execute
gpg --card-status
and it outputs as follows:Actual Behavior
Diagnostic Logs
No response
The text was updated successfully, but these errors were encountered: