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

enable windows wsl support #473

Open
ImmortalD opened this issue Dec 2, 2022 · 10 comments
Open

enable windows wsl support #473

ImmortalD opened this issue Dec 2, 2022 · 10 comments

Comments

@ImmortalD
Copy link

Enhancement Request

I successfully mount a drive letter X, but it cannot be seen in wsl. I hope it can be used normally in wsl

image

execute the following instructions in wsl

ls /mnt/ -al

# total 8
# drwxr-xr-x.  8 root root 4096 Nov 15 17:17 .
# dr-xr-xr-x. 17 root root 4096 Dec  2 15:13 ..
# drwxrwxrwx   1 root root 4096 Dec  2 15:24 c
# drwxrwxrwx   1 root root 4096 Dec  2 14:13 d
# drwxrwxrwx   1 root root 4096 Dec  2 13:19 e
# drwxrwxrwx   1 root root  512 Dec  2 13:19 f
# drwxrwxrwt   2 root root   60 Dec  2 15:13 wsl
# drwxrwxrwt   7 root root  300 Dec  2 15:13 wslg
@billziss-gh
Copy link
Collaborator

This is currently disabled for FUSE file systems. Native file systems can support WSL1 if they so choose.

The reason is that there is a mismatch of how WSL1 encodes POSIX attributes on an NTFS file system vs how WinFsp / Cygwin / SFU do it. This mismatch can be overcome, but since Microsoft has effectively abandoned WSL1 in favor of WSL2, it makes little sense to spend the effort.

@r2evans
Copy link

r2evans commented Feb 24, 2023

@billziss-gh , thanks for winfsp, I've only recently started using it. I'm using WSL2 (not 1) and get errors when trying to mount it to /mnt/y. I found this issue, but it appears that you're interpreting the OP to be asking about WSL1 (I didn't).

Regardless of WSL1, is there support for WSL2? If this is unrelated (and you expect it to work in WSL2), then I should likely open a new issue. Thanks again!

@billziss-gh
Copy link
Collaborator

@r2evans which file system are you using? Is it FUSE based?

@r2evans
Copy link

r2evans commented Feb 27, 2023

I'm using bitvise/winfsp to remotely mount / on a remove ubuntu VM. The rootfs there is ext4; on it are a couple of cifs-mounts, but they are subdirs under the rootfs, and I'm mounting the rootfs as a whole (as a non-root user, if that's not too many "root" references).

The WSL2 is running ubuntu 20.04, and its rootfs is also ext4.

root@d2xps:~# mount -t drvfs y: /mnt/y
<3>init: (25586) ERROR: MountPlan9WithRetry:285: mount drvfs on /mnt/y (cache=mmap,rw,msize=262144,trans=virtio,aname=drvfs;path=y:;symlinkroot=/mnt/) failed: 22
mount: Invalid argument

yet Y: is visible/usable in windows explorer. Perhaps I'm doing something wrong?

Bitvise is configured with simple SFTP drive mapping,

image

I'm not sure how Bv is calling/using/configuring winfsp, I'm using the default config on the SFTP tab:

image

(though I don't think any of that is affecting me being able to use it in WSL2).

@billziss-gh
Copy link
Collaborator

@r2evans unfortunately I can only help with file systems that ship with WinFsp. Bitvise's file system may simply not enable WSL support (I do not know).

Non-FUSE WinFsp file systems should support mounting under WSL. FUSE file systems currently do not for the reasons explained in my first comment.

@r2evans
Copy link

r2evans commented Feb 27, 2023

I was hoping your reference earlier was specific to WSL1, thanks for replying. I'll reach out to Bv, I appreciate the help!

@r2evans
Copy link

r2evans commented Feb 28, 2023

The problem is almost certainly not BitVise. A walk-through of what I did to come to that conclusion:

  • Uninstalled BvSSH and its WinFsp. Completely installed from-scratch winfsp-1.12.22301.msi with its developer option.

  • In Windows, correctly mounted \\memfs64\share to the Y: drive and it works in Windows Explorer.

    In WSL2, I cannot see it.

    root@d2xps:~# mount -t drvfs y: /mnt/y
    <3>init: (411) ERROR: MountPlan9WithRetry:285: mount drvfs on /mnt/y (cache=mmap,rw,msize=262144,trans=virtio,aname=drvfs;path=y:;symlinkroot=/mnt/) failed: 22
    mount: Invalid argument
    
  • In Windows, installed sshfs-win-3.5.20357-x64.msi, and successfully mounted a remote SSH drive using it. Again, as the Y: drive (I disconnected the memfs64 share), it works in Windows Explorer.

    In WSL2, same error.

  • To make sure it isn't a problem with WSL2, I connect a usb drive (empty) to Windows, and it appears in Windows Explorer as the D: drive. In WSL2:

    root@d2xps:~# mount -t drvfs d: /mnt/d
    root@d2xps:~# ll /mnt/d
    total 4
    drwxrwxrwx 1 root root  512 Jan  1  1980  ./
    drwxr-xr-x 9 root root 4096 Feb 28 09:44  ../
    drwxrwxrwx 1 root root  512 Feb  9 10:09 'System Volume Information'/
    

I don't know what else I can do to narrow down what's going on, but it appears the theme is consistent: I can generally mount drive letters in WSL2, but WinFsp-mounted drives fail regardless of the source.

@billziss-gh does this make enough sense to you? Is there something I'm missing that could point to another source of error? And finally, is there something I can do to facilitate debugging or extension to support this?

Thanks!

@billziss-gh
Copy link
Collaborator

If this fails with MEMFS then this is certainly a WinFsp problem. MEMFS works (or used to work) with WSL1, but perhaps this is no longer the case with WSL2. I will look into it.

@r2evans
Copy link

r2evans commented Mar 2, 2023

Update: I've installed the beta 2.0.23055 and the error is slightly updated when trying to mount the \\memfa64\share Y: under WSL2:

root@d2xps:~# mount -t drvfs y: /mnt/y
<4>WARNING: mount: waiting for virtio device...
<3>init: (416) ERROR: MountPlan9WithRetry:285: mount drvfs on /mnt/y (cache=mmap,rw,msize=262144,trans=virtio,aname=drvfs;path=y:;symlinkroot=/mnt/) failed: 2
mount: No such file or directory

Not sure if the virtio device error adds any context. Thank you.

@r2evans
Copy link

r2evans commented May 2, 2023

@billziss-gh have you found any insight to what is preventing WSL2 from seeing the mounts? Do you think this is a "bug" in wsl2, a change in syscall, or something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants