Repository navigation
Closed
Description
- I was not able to find an open
or closed issue matching
what I'm seeing, including in thegit-for-windows/gittracker.
Setup
- Which version of
microsoft/gitare you using? Is it 32-bit or 64-bit?
$ git --version --build-options
git version 2.39.2.vfs.0.0
cpu: x86_64
built from commit: e7fd49f4d278a3c36be6c1ef7e720e893fd5c747
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
- Are you using Scalar or VFS for Git?
I'm using scalar but I'd believe that the vanilla git-maintenance also has the problem.
- Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
WSL, ubuntu, 22.04
- Any other interesting things about your environment that might be related
to the issue you're seeing?
Systemd is enabled. The .gitconfig in WSL refers to the host's git credential provider.
Details
- What commands did you run to trigger this issue? If you can provide a
Minimal, Complete, and Verifiable example
this will help us understand the issue.
- enable systemd in WSL
- add this line to .gitconfig (path may differ)
[credential]
helper = "/mnt/c/Program\\ Files/Git/mingw64/bin/git-credential-manager.exe"
scalar register <your repo>
- What did you expect to occur after running these commands?
the hourly systemd job is executed without an error.
- What actually happened instead?
it fails since WSL can't run the host credential manager.
-
If the problem was occurring with a specific repository, can you specify
the repository?- Other internal repo.
X-posting of microsoft/WSL#10459 . I'd believe that a fix from WSL should be a better solution, but git may also generate a better service unit file to workaround the issue.
Line 2443 in 0e35ce9
| "RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6\n" |
Apparently this list is not enough for WSL to run the host-side cred provider.
Metadata
Metadata
Assignees
Labels
No labels
Activity
dscho commentedon Sep 8, 2023
Is this only the case when Git maintenance runs, or do you also experience this when running
git fetchmanually in WSL?nedsociety commentedon Sep 8, 2023
Only when git maintenance runs through systemd. Both
git fetchandgit for-each-repo --config=maintenance.repo maintenance runruns fine on login shell, though it doesn't really help if it's not scheduled.dscho commentedon Sep 8, 2023
Matthew John Cheetham (@mjcheetham) this seems to be a Git Credential Manager problem more than a microsoft/git problem. Would you have any insights?
nedsociety commentedon Sep 8, 2023
FYI, changing
ExecStartto/mnt/c/Windows/system32/cmd.exe /c "echo test"also shows the same error. I doubt GCM is directly responsible for this issue.dscho commentedon Sep 8, 2023
Oh, you see an error message somewhere? And where is that
ExecStartcoming from that you mentioned?dscho commentedon Sep 8, 2023
And how did you enable systemd? Could you please provide a step-by-step minimal reproducer? Like, using Git Credential Manager or CMD directly in a file in
.config/somewhere I guess?dscho commentedon Sep 8, 2023
Are you saying that it works if you remove that
RestrictAddressFamiliesline?nedsociety commentedon Sep 8, 2023
Reproducer
~/.gitconfigwith the following content: (the path may change if the host git installation path is different)scalar cloneit would have installed a systemd timer calledgit-maintenancein~/.config/systemd/user. This behavior is also expected.systemctl --user start git-maintenance@hourly.service. It fails:Fiddling with the configuration
The file
~/.config/systemd/user/git-maintenance@.servicehas a systemd timer setup for git-maintenance.ExecStartline manually (replacing%itohourly) in the login shell does the maintenance job successfully.ExecStartto something like/mnt/c/Windows/system32/cmd.exe /c "echo test"fails withUtilBindVsockAnyPortas noted above, which suggests that running a host binary fails when systemd runs them with these setups. That explains why git failed to run the credential helper which resides in the host side.UtilBindVsockAnyPort, I commented outRestrictAddressFamiliesto see if it's a socket problem. It made the maintenance job successful.dscho commentedon Sep 8, 2023
Excellent finding, and valuable, important information in the context of this ticket.
Could you see whether it works if you uncomment that line and add
AF_NETLINK?nedsociety commentedon Sep 8, 2023
It didn't work :/ it shows the same socket error.
dscho commentedon Sep 8, 2023
Can you see anything in
dmesgorsyslogthat might give a hint what was blocked?nedsociety commentedon Sep 8, 2023
dmesg.syslogavailable.journalctlshows no more clue than what's already shown insystemctl --user status.dscho commentedon Sep 8, 2023
Myungbae Son (@nedsociety) you seem to know tons more about systemd than I do, maybe you can find a list of all available
AF_*values for that line, and then see whether specifying them all "makes it work"?nedsociety commentedon Sep 8, 2023
okay, I've got the list from here and it seems working when I put everything:
well but binary searching around these list seems too much hassle 😭
dscho commentedon Sep 8, 2023
This sounds awfully close to
UtilBindVsockAnyPort, no?nedsociety commentedon Sep 8, 2023
Huh, good eyes. It actually worked.
OneBlue commentedon Sep 8, 2023
Indeed as a WSL maintainer I confirm that AF_VSOCK is what we use.
nedsociety commentedon Sep 8, 2023
With the issue in WSL repo was concluded as wontfix, I guess adding AF_VSOCK to the list seems to be the only choice left?
maintenance(systemd): support the Windows Subsystem for Linux
dscho commentedon Sep 10, 2023
Blue (@OneBlue) thanks for confirming!
Myungbae Son (@nedsociety) yes, and it is also the correct thing to do. See gitgitgadget#1586 and #605 for the progress of the fix.
maintenance(systemd): support the Windows Subsystem for Linux
maintenance(systemd): support the Windows Subsystem for Linux
maintenance(systemd): support the Windows Subsystem for Linux (#605)
maintenance(systemd): support the Windows Subsystem for Linux
maintenance(systemd): support the Windows Subsystem for Linux (#605)
maintenance(systemd): support the Windows Subsystem for Linux
maintenance(systemd): support the Windows Subsystem for Linux (#605)
maintenance(systemd): support the Windows Subsystem for Linux