WSL: Cannot access btrfs drive from Windows

Environment

Windows build number: Microsoft Windows [Version 10.0.21337.1010]
Your Distribution version: Release:        10
Whether the issue is on WSL 2 and/or WSL 1: Linux version 5.4.91-microsoft-standard-WSL2 (oe-user@oe-host) (gcc version 9.3.0 (GCC)) #1 SMP Mon Jan 25 18:39:31 UTC 2021

Steps to reproduce

  • give wsl a disk wsl --mount \\.\PHYSICALDRIVE1 --bare
  • format it in btrfs sudo mkfs.btrfs /dev/sdc
  • mount the filesystem sudo mount -o ssd,noatime,space_cache,commit=120,compress /dev/sdc /mnt/test
  • optional, be incredibly liberal with permissions chown $USERNAME:$USERNAME /mnt/test; chmod ugo+rwx /mnt/test
  • attempt to open \\wsl$\Debian\mnt\test in explorer

WSL logs: wsl.etl.log

Expected behavior

Windows has access to the btrfs drive.

Actual behavior

Untitled "is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.

Attempt to access invalid address."

The exact same issue was reported on the original blogpost about --mount but the fix is sshfs-specific

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23

Most upvoted comments

@Hashbrown777: The root cause is an issue in the plan9 server running inside WSL.

The problem was that when a mountpoint is accessed, the code would check for the device on which the file is, and fail if no matching mountpoint is found in /proc/self/mountinfo (and that appears to be the case for btrfs mounts). The reason for that logic is to prevent access to drvfs shares ( /mnt/X ) from the linux 9p server.

So we made a code change to not disallow file accesses on this scenario, which solves this issue. The fix will now work its way through the Windows release pipeline and will eventually reach a future insider build.

@Hashbrown777 : Indeed I can repro the same behavior.

I’ll have a deeper look and update this issue when I’ll have more info.

Thanks for the logs @jpeeler.

Actually, it turns out that the fix is not on your build yet, sorry for the miscommunication.

To work around this, you could install the latest WSL from the store, which has the fix.

I had this issue as well and can confirm installing WSL Preview fixed the issue. I can now see the @ and @home etc. from within File Explorer (whereas before I could only access those directories via WSL itself.)

Thank you!

There aren’t any plans to do something like that right now. \wsl.localhost only resolves in the current machine and isn’t at all exposed at the networking level.

Exposing this to other machines would require an actual networking protocol, with all the authentication & security requirements that this would imply.

Overall if you wish to share a wsl mountpoint to other machines, I’d recommend looking at ssh tunnels or samba as you mentioned (nfs and sftp might also be valid options, maybe with better performance if you want to remotely access those mountpoints from wsl).

@Hashbrown777: Unfortunately the fix still hasn’t made it to insider builds. It will hopefully be in the next one.