-
Notifications
You must be signed in to change notification settings - Fork 92
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
git-maintenance doesn't work on WSL #604
Comments
Is this only the case when Git maintenance runs, or do you also experience this when running |
Only when git maintenance runs through systemd. Both |
@mjcheetham this seems to be a Git Credential Manager problem more than a microsoft/git problem. Would you have any insights? |
FYI, changing |
Oh, you see an error message somewhere? And where is that |
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 |
Are you saying that it works if you remove that |
Reproducer
Fiddling with the configurationThe file
|
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 |
It didn't work :/ it shows the same socket error. |
Can you see anything in |
|
@nedsociety you seem to know tons more about systemd than I do, maybe you can find a list of all available |
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 😭 |
This sounds awfully close to |
Huh, good eyes. It actually worked. |
Indeed as a WSL maintainer I confirm that AF_VSOCK is what we use. |
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? |
When running in the Windows Subsystem for Linux (WSL), it is usually necessary to use the Git Credential Manager for authentication when performing the background fetches. This requires interoperability between the Windows Subsystem for Linux and the Windows host to work, which uses so-called vsocks, i.e. sockets intended for communcations between virtual machines and the host they are running on. However, when Git is configured to run background maintenance via `systemd`, the address families available to those maintenance processes are restricted, and did not include `AF_VSOCK`. This leads to problems e.g. when a background fetch tries to access github.com: systemd[437]: Starting Optimize Git repositories data... git[747387]: WSL (747387) ERROR: UtilBindVsockAnyPort:285: socket failed 97 git[747381]: fatal: could not read Username for 'https://github.com': No such device or address git[747381]: error: failed to prefetch remotes git[747381]: error: task 'prefetch' failed systemd[437]: git-maintenance@hourly.service: Main process exited, code=exited, status=1/FAILURE systemd[437]: git-maintenance@hourly.service: Failed with result 'exit-code'. systemd[437]: Failed to start Optimize Git repositories data. Address this (pun intended) by adding the `AF_VSOCK` address family to the allow list. This fixes microsoft#604. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@OneBlue thanks for confirming!
@nedsociety yes, and it is also the correct thing to do. See gitgitgadget#1586 and #605 for the progress of the fix. |
When running in the Windows Subsystem for Linux (WSL), it is usually necessary to use the Git Credential Manager for authentication when performing the background fetches. This requires interoperability between the Windows Subsystem for Linux and the Windows host to work, which uses so-called vsocks, i.e. sockets intended for communcations between virtual machines and the host they are running on. However, when Git is configured to run background maintenance via `systemd`, the address families available to those maintenance processes are restricted, and did not include `AF_VSOCK`. This leads to problems e.g. when a background fetch tries to access github.com: systemd[437]: Starting Optimize Git repositories data... git[747387]: WSL (747387) ERROR: UtilBindVsockAnyPort:285: socket failed 97 git[747381]: fatal: could not read Username for 'https://github.com': No such device or address git[747381]: error: failed to prefetch remotes git[747381]: error: task 'prefetch' failed systemd[437]: git-maintenance@hourly.service: Main process exited, code=exited, status=1/FAILURE systemd[437]: git-maintenance@hourly.service: Failed with result 'exit-code'. systemd[437]: Failed to start Optimize Git repositories data. Address this (pun intended) by adding the `AF_VSOCK` address family to the allow list. This fixes microsoft#604. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
When running in the Windows Subsystem for Linux (WSL), it is usually necessary to use the Git Credential Manager for authentication when performing the background fetches. This requires interoperability between the Windows Subsystem for Linux and the Windows host to work, which uses so-called vsocks, i.e. sockets intended for communcations between virtual machines and the host they are running on. However, when Git is configured to run background maintenance via `systemd`, the address families available to those maintenance processes are restricted, and did not include `AF_VSOCK`. This leads to problems e.g. when a background fetch tries to access github.com: systemd[437]: Starting Optimize Git repositories data... git[747387]: WSL (747387) ERROR: UtilBindVsockAnyPort:285: socket failed 97 git[747381]: fatal: could not read Username for 'https://github.com': No such device or address git[747381]: error: failed to prefetch remotes git[747381]: error: task 'prefetch' failed systemd[437]: git-maintenance@hourly.service: Main process exited, code=exited, status=1/FAILURE systemd[437]: git-maintenance@hourly.service: Failed with result 'exit-code'. systemd[437]: Failed to start Optimize Git repositories data. Address this (pun intended) by adding the `AF_VSOCK` address family to the allow list. This fixes microsoft#604, and is a backport of 5e8515e (maintenance(systemd): support the Windows Subsystem for Linux, 2023-09-10). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This is a companion to gitgitgadget#1586 and fixes #604.
When running in the Windows Subsystem for Linux (WSL), it is usually necessary to use the Git Credential Manager for authentication when performing the background fetches. This requires interoperability between the Windows Subsystem for Linux and the Windows host to work, which uses so-called vsocks, i.e. sockets intended for communcations between virtual machines and the host they are running on. However, when Git is configured to run background maintenance via `systemd`, the address families available to those maintenance processes are restricted, and did not include `AF_VSOCK`. This leads to problems e.g. when a background fetch tries to access github.com: systemd[437]: Starting Optimize Git repositories data... git[747387]: WSL (747387) ERROR: UtilBindVsockAnyPort:285: socket failed 97 git[747381]: fatal: could not read Username for 'https://github.com': No such device or address git[747381]: error: failed to prefetch remotes git[747381]: error: task 'prefetch' failed systemd[437]: git-maintenance@hourly.service: Main process exited, code=exited, status=1/FAILURE systemd[437]: git-maintenance@hourly.service: Failed with result 'exit-code'. systemd[437]: Failed to start Optimize Git repositories data. Address this (pun intended) by adding the `AF_VSOCK` address family to the allow list. This fixes #604, and is a backport of 5e8515e (maintenance(systemd): support the Windows Subsystem for Linux, 2023-09-10). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This is a companion to gitgitgadget#1586 and fixes #604.
When running in the Windows Subsystem for Linux (WSL), it is usually necessary to use the Git Credential Manager for authentication when performing the background fetches. This requires interoperability between the Windows Subsystem for Linux and the Windows host to work, which uses so-called vsocks, i.e. sockets intended for communcations between virtual machines and the host they are running on. However, when Git is configured to run background maintenance via `systemd`, the address families available to those maintenance processes are restricted, and did not include `AF_VSOCK`. This leads to problems e.g. when a background fetch tries to access github.com: systemd[437]: Starting Optimize Git repositories data... git[747387]: WSL (747387) ERROR: UtilBindVsockAnyPort:285: socket failed 97 git[747381]: fatal: could not read Username for 'https://github.com': No such device or address git[747381]: error: failed to prefetch remotes git[747381]: error: task 'prefetch' failed systemd[437]: git-maintenance@hourly.service: Main process exited, code=exited, status=1/FAILURE systemd[437]: git-maintenance@hourly.service: Failed with result 'exit-code'. systemd[437]: Failed to start Optimize Git repositories data. Address this (pun intended) by adding the `AF_VSOCK` address family to the allow list. This fixes #604, and is a backport of 5e8515e (maintenance(systemd): support the Windows Subsystem for Linux, 2023-09-10). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This is a companion to gitgitgadget#1586 and fixes #604.
or closed issue matching
what I'm seeing, including in the
git-for-windows/git
tracker.Setup
microsoft/git
are you using? Is it 32-bit or 64-bit?I'm using scalar but I'd believe that the vanilla
git-maintenance
also has the problem.WSL, ubuntu, 22.04
to the issue you're seeing?
Systemd is enabled. The .gitconfig in WSL refers to the host's git credential provider.
Details
Minimal, Complete, and Verifiable example
this will help us understand the issue.
the hourly systemd job is executed without an error.
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?
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.
git/builtin/gc.c
Line 2443 in 0e35ce9
Apparently this list is not enough for WSL to run the host-side cred provider.
The text was updated successfully, but these errors were encountered: