#623

Host check passes on WSL2, but sandboxes can't start: missing preflight checks for buildx, inotify limits and nft_socket

Opennshanthaopened 1mo ago

Problem

I followed docs/installation.md on WSL2. The "Check the host" block passed (Host checks passed.), but three host gaps then broke the install one after another. Two have workarounds. The third can't be fixed on the stock WSL2 kernel, and nothing reports it until a sandbox fails to start.

Environment: Windows 11, WSL2, Ubuntu 24.04.2 LTS, kernel 6.18.40.1-microsoft-standard-WSL2, x86_64, nested KVM enabled. Docker from Ubuntu's docker.io package (as installed by install-prereqs.sh). Kind install. SPACE at cd958e9e; docs unchanged on main as of 57c7c0c.

1. Docker Buildx missing → Kind node image build fails

GHCR returned unauthorized, so bootstrap fell back to a local build, which failed at once:

Install the buildx component to build images with BuildKit
unknown flag: --provenance

Ubuntu's docker.io package doesn't include Buildx, and the host check doesn't look for it. Fixed by sudo apt-get install docker-buildx.

2. inotify instance limit too low → bootstrap fails after ~22 minutes

With fs.inotify.max_user_instances = 128 (the default here), bootstrap timed out waiting for PostgreSQL. Five of six kube-proxy pods were in CrashLoopBackOff with failed complete: too many open files. Without kube-proxy, CoreDNS and local-path-provisioner couldn't reach the API server, so the Postgres PVC never bound. All nodes still reported Ready.

This is Kind's documented known issue. Fixed by sudo sysctl -w fs.inotify.max_user_instances=512; bootstrap then passed in 158 s.

3. Kernel without CONFIG_NFT_SOCKET → no sandbox can start

Bootstrap, seeding and auth all passed, but examples/first_sandbox.py hung: the sandbox pod stayed in ContainerCreating with FailedCreatePodSandBox. The net-gateway failed to apply its TPROXY nftables rules (Could not process rule: No such file or directory on the TCP/UDP socket transparent matches), from setup_netgtw_tproxy_rules in crates/libs/node/mgr/server/src/firewall.rs.

The WSL2 kernel compiles this out:

# CONFIG_NFT_SOCKET is not set
CONFIG_NFT_TPROXY=m

modinfo nft_socket → Module nft_socket not found. This can't be fixed with modprobe; it needs a custom WSL kernel.

Why it matters

The host check is the only gate before a long install. Each of these gaps cost time after the check had passed. The last one appears only after a full bootstrap (plus image builds), and it can't be fixed on the stock WSL2 kernel. WSL2 meets the documented requirements (Linux x86_64, /dev/kvm, /dev/net/tun), so Windows users will reasonably try it.

Proposed approach

  1. Extend the "Check the host" block:
    • fail if docker buildx version fails, with the install hint
    • warn if fs.inotify.max_user_instances is below 512, with Kind's recommendation
    • fail if the kernel lacks nft socket support, e.g. modinfo nft_socket fails and CONFIG_NFT_SOCKET isn't =y in /boot/config-$(uname -r) or /proc/config.gz
  2. Add the three symptoms and fixes to docs/troubleshooting.md.
  3. State in installation.md that the stock WSL2 kernel is currently unsupported for running sandboxes.

Happy to open a PR for this if you agree with the scope.

Related area: #617 (same TPROXY path, different cause).

Severity (self-assessed)

Low. Not a security issue, and production Linux hosts are unaffected. But it costs a new user hours on a common developer setup, and the last failure has no workaround on stock WSL2.

Activity

1
NancyKwongPerplexity1mo ago

Thanks for opening this issue! A SPACE maintainer will take a look.

CONTRIBUTING.md explains how we review outside contributions.