Skip to content
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

maintenance(systemd): support the Windows Subsystem for Linux #605

Merged
merged 1 commit into from
Sep 23, 2023

Conversation

dscho
Copy link
Member

@dscho dscho commented Sep 10, 2023

This is a companion to gitgitgadget#1586 and fixes #604.

@dscho dscho self-assigned this Sep 10, 2023
@dscho dscho mentioned this pull request Sep 10, 2023
2 tasks
Copy link
Collaborator

@derrickstolee derrickstolee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

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>
@dscho dscho force-pushed the scheduled-maintenance-in-wsl branch from 6dc78a4 to ebf93cb Compare September 21, 2023 07:49
@dscho
Copy link
Member Author

dscho commented Sep 22, 2023

The t5559 failures will be addressed via #609.

@dscho dscho merged commit 665fcd5 into microsoft:vfs-2.42.0 Sep 23, 2023
42 of 44 checks passed
@dscho dscho deleted the scheduled-maintenance-in-wsl branch September 23, 2023 10:54
dscho added a commit that referenced this pull request Nov 3, 2023
dscho added a commit that referenced this pull request Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

git-maintenance doesn't work on WSL
2 participants