Skip to content

feat: implement WSL2 native mount support via path translation and boot-time bind mounting#5189

Open
Nachiket-Roy wants to merge 1 commit into
lima-vm:masterfrom
Nachiket-Roy:feature/wsl2-mount-semantics
Open

feat: implement WSL2 native mount support via path translation and boot-time bind mounting#5189
Nachiket-Roy wants to merge 1 commit into
lima-vm:masterfrom
Nachiket-Roy:feature/wsl2-mount-semantics

Conversation

@Nachiket-Roy

Copy link
Copy Markdown
Contributor

Summary

This PR implements Phase 2 of #5152 by bringing the WSL2 driver in line with Lima's standard mount behavior.

Previously, WSL2 relied solely on its native automounts (C:\ - > /mnt/c) and ignored Lima's mounts configuration (mountPoint, writable, and per-mount location). As a result, templates behaved differently on WSL2 compared to other drivers (QEMU/VZ), with no support for custom mount points or read-only mounts.

Changes

  • Added Windows -> WSL path translation (TranslateWindowsToWSLPath) for default mount point resolution.
  • Improved defaults and validation to gracefully reject unsupported paths (e.g. UNC paths) instead of panicking.
  • Extended cidata to pass mount location and writable metadata into the guest.
  • Added a WSL2 boot-time provisioning script that:
    • creates bind mounts for custom mount points,
    • enforces writable: false via read-only bind mounts,
    • falls back to symlinks when bind mounts cannot be created,
    • safely updates /etc/wsl.conf to enable automount metadata support.
  • Added unit tests and manually verified:
    • custom mount points,
    • read-only mounts,
    • idempotent reboots,
    • safe /etc/wsl.conf updates,
    • graceful validation errors for unsupported UNC paths.

@Nachiket-Roy
Nachiket-Roy marked this pull request as draft July 5, 2026 07:49
@Nachiket-Roy
Nachiket-Roy force-pushed the feature/wsl2-mount-semantics branch 2 times, most recently from a9a283f to fa396d9 Compare July 5, 2026 09:32
…and boot-time bind mounting

Signed-off-by: Nachiket Roy <nachiket.roy.2@gmail.com>
@Nachiket-Roy
Nachiket-Roy force-pushed the feature/wsl2-mount-semantics branch from fa396d9 to aae7d80 Compare July 5, 2026 09:35
@Nachiket-Roy
Nachiket-Roy marked this pull request as ready for review July 5, 2026 09:36
@AkihiroSuda
AkihiroSuda requested a review from jandubois July 13, 2026 02:21
@AkihiroSuda AkihiroSuda added this to the v2.3.0 milestone Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants