diablodale / pinentry-wsl-ps1

GUI for GPG within Windows WSL for passwords, pinentry, etc.
Mozilla Public License 2.0
97 stars 9 forks source link

Fix WSL interoperability when invoked via systemd #14

Closed andsens closed 2 years ago

andsens commented 2 years ago

It's now possible to run systemd in wsl: https://itzenplitz.net/posts/wsl-enabling-systemd-ubuntu22.04/

This means there is no need to have all these workarounds for starting gpg-agent. However, there are still some pain points regarding systemd interoperability with WSL. Specifically $PATH is reset to the system paths, meaning we can't invoke powershell.exe. Additionally WSL_INTEROP is not set. This changes works around both issues.

p.s.: Note that to interact with systemctl --user you need to change $XDG_RUNTIME_DIR so it points to /run/user/1000.

diablodale commented 2 years ago

Ehhh, this one seems cool, but I hestitate for....

  1. experimental in ubuntu https://bugs.launchpad.net/ubuntu/+source/wsl-setup/+bug/1962556
  2. various related hacks on the WSL_INTEROP env var https://github.com/microsoft/WSL/issues/5065
  3. may have a complex setup dependency on user 1000, which typically exists, but introduces a whole side conversation that is far outside a casual user's knowledge
andsens commented 2 years ago

All fair points. (3) could be fixed with $(id -u) or something, but I get your point. It's all quite experimental.

diablodale commented 2 years ago

I would prefer to keep this as an unmerged PR or "tips" issue. So people can find it by search/query and see the ideas.

andsens commented 2 years ago

Update! Closing this one as the workaround is no longer needed :-D

Make sure you have wsl >= v0.67.6 (https://github.com/microsoft/WSL/releases) and enable systemd by following this guide: https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/

andsens commented 2 years ago

Actually... pinentry-qt and pinentry-gtk2 work now as well. It would seem the latest update addresses a lot of issues.