lucyllewy / one-script-wsl2-systemd

The one-script variant of the systemd hack for WSL2
MIT License
231 stars 38 forks source link

seems to help with issue #17 #30

Open FerdinandSu opened 2 years ago

FerdinandSu commented 2 years ago

I met the same issue as #17, since my wsl is using 'root' as default user.

It's caused by 00-wsl2-systemd:94

exec /usr/bin/nsenter --mount --pid --target "$SYSTEMD_PID" -- su - "$SUDO_USER"

that, variable "SUDO_USER" is empty when using root.

So I added line 17 SUDO_USER="root" to the file, and it seems to be working now (partially).

However, gpg-agent.sh:12 caused another issue: the wslvar 'ProgramFiles(x86)' useage, which is actually invalid:

image

It seems that wslvar imports an raw $env:ProgramFiles(x86) usage.

What's more, I do think most people may prefer to use git's gpg (Git\usr\bin\gpg.exe)?

FerdinandSu commented 2 years ago

Actually, after changing gpg-agent.sh:12 to

ln -sf "$(wslpath "$(wslvar 'ProgramFiles')/Git/usr/bin/gpg.exe")" "$HOME/.wsl-cmds/gpg"

It works quite well. Such change is not included in this pull request.