* [PATCH] maintenance(systemd): support the Windows Subsystem for Linux
@ 2023-09-10 8:30 Johannes Schindelin via GitGitGadget
0 siblings, 0 replies; only message in thread
From: Johannes Schindelin via GitGitGadget @ 2023-09-10 8:30 UTC (permalink / raw)
To: git; +Cc: Johannes Schindelin, Johannes Schindelin
From: Johannes Schindelin <johannes.schindelin@gmx.de>
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 https://github.com/microsoft/git/issues/604.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
maintenance(systemd): support the Windows Subsystem for Linux
https://github.com/microsoft/git/issues/604 reports a bug where git
maintenance start does not work in the Windows Subsystem for Linux
(WSL), and this patch fixes it.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1586%2Fdscho%2Fscheduled-maintenance-in-wsl-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1586/dscho/scheduled-maintenance-in-wsl-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1586
builtin/gc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index 5c4315f0d81..719cae9a88a 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -2397,7 +2397,7 @@ static int systemd_timer_write_unit_templates(const char *exec_path)
"LockPersonality=yes\n"
"MemoryDenyWriteExecute=yes\n"
"NoNewPrivileges=yes\n"
- "RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6\n"
+ "RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_VSOCK\n"
"RestrictNamespaces=yes\n"
"RestrictRealtime=yes\n"
"RestrictSUIDSGID=yes\n"
base-commit: 43c8a30d150ecede9709c1f2527c8fba92c65f40
--
gitgitgadget
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-10 8:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-10 8:30 [PATCH] maintenance(systemd): support the Windows Subsystem for Linux Johannes Schindelin via GitGitGadget
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).