WSL: ls: reading directory '.': Invalid argument (share mounted via drvfs)

Microsoft Windows [Version 10.0.16176] 64-bit

  • Running in a Windows 10 VM in Parallels on Mac OS
  • Y: is a mapped network drive to a Parallels shared folder
$ sudo mkdir /mnt/y
$ sudo mount -t drvfs Y: /mnt/y
$ cd /mnt/y
$ ls
ls: reading directory '.': Invalid argument

Note that other operations like cd and cat do work, so the mount operation was successful.

Strace output:

(strace -ff ls)

execve("/bin/ls", ["ls"], [/* 16 vars */]) = 0
brk(NULL)                               = 0x8e9000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f53543f0000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=20939, ...}) = 0
mmap(NULL, 20939, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f53543ea000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260Z\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=130224, ...}) = 0
mmap(NULL, 2234080, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5353dd0000
mprotect(0x7f5353def000, 2093056, PROT_NONE) = 0
mmap(0x7f5353fee000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e000) = 0x7f5353fee000
mmap(0x7f5353ff0000, 5856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f5353ff0000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\t\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1864888, ...}) = 0
mmap(NULL, 3967392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5353a00000
mprotect(0x7f5353bbf000, 2097152, PROT_NONE) = 0
mmap(0x7f5353dbf000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bf000) = 0x7f5353dbf000
mmap(0x7f5353dc5000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f5353dc5000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpcre.so.3", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\25\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=456632, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f53543e0000
mmap(NULL, 2552072, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5353790000
mprotect(0x7f53537fe000, 2097152, PROT_NONE) = 0
mmap(0x7f53539fe000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6e000) = 0x7f53539fe000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\r\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14608, ...}) = 0
mmap(NULL, 2109680, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5353580000
mprotect(0x7f5353583000, 2093056, PROT_NONE) = 0
mmap(0x7f5353782000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f5353782000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260`\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=138696, ...}) = 0
mmap(NULL, 2212904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5353360000
mprotect(0x7f5353378000, 2093056, PROT_NONE) = 0
mmap(0x7f5353577000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f5353577000
mmap(0x7f5353579000, 13352, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f5353579000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f53543d0000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f53543c0000
arch_prctl(ARCH_SET_FS, 0x7f53543c0800) = 0
mprotect(0x7f5353dbf000, 16384, PROT_READ) = 0
mprotect(0x7f5353577000, 4096, PROT_READ) = 0
mprotect(0x7f5353782000, 4096, PROT_READ) = 0
mprotect(0x7f53539fe000, 4096, PROT_READ) = 0
mprotect(0x7f5353fee000, 4096, PROT_READ) = 0
mprotect(0x61d000, 4096, PROT_READ)     = 0
mprotect(0x7f5354225000, 4096, PROT_READ) = 0
munmap(0x7f53543ea000, 20939)           = 0
set_tid_address(0x7f53543c0ad0)         = 2019
set_robust_list(0x7f53543c0ae0, 24)     = 0
rt_sigaction(SIGRTMIN, {0x7f5353365b50, [], SA_RESTORER|SA_SIGINFO, 0x7f5353371390}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7f5353365be0, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f5353371390}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=8192*1024}) = 0
statfs("/sys/fs/selinux", 0x7fffe09b1510) = -1 ENOENT (No such file or directory)
statfs("/selinux", 0x7fffe09b1510)      = -1 ENOENT (No such file or directory)
brk(NULL)                               = 0x8e9000
brk(0x90a000)                           = 0x90a000
open("/proc/filesystems", O_RDONLY)     = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "nodev      sysfs\nnodev      root"..., 4096) = 367
read(3, "", 4096)                       = 0
close(3)                                = 0
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1668976, ...}) = 0
mmap(NULL, 1668976, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5354228000
close(3)                                = 0
ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TIOCGWINSZ, {ws_row=56, ws_col=147, ws_xpixel=0, ws_ypixel=0}) = 0
open(".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFDIR|0777, st_size=512, ...}) = 0
getdents(3, 0x8eecd0, 32768)            = -1 EINVAL (Invalid argument)
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=2995, ...}) = 0
read(4, "# Locale name alias data base.\n#"..., 4096) = 2995
read(4, "", 4096)                       = 0
close(4)                                = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "ls: ", 4)                     = 4
write(2, "reading directory '.'", 21)   = 21
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale-langpack/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": Invalid argument", 18)      = 18
write(2, "\n", 1)                       = 1
close(3)                                = 0
close(1)                                = 0
close(2)                                = 0
exit_group(2)                           = ?
+++ exited with 2 +++

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 20
  • Comments: 41 (4 by maintainers)

Most upvoted comments

I have the same issue after updating windows to 2004 (may 2020 update).

I’m mounting a Samba network drive with drvfs that used to work before the update. Like the OP it fails on getdents().

  • Updated the disto (ubuntu 18.04) to wsl2: probem present
  • Rolled-back distro to wsl1: probem present
  • Rolled-back windows to 1909: problem absent

kernel info with issue present:

Linux HOST 4.4.0-19041-Microsoft #1-Microsoft Fri Dec 06 14:06:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux

kernel info with issue absent:

Linux HOST 4.4.0-18362-Microsoft #836-Microsoft Mon May 05 16:04:00 PST 2020 x86_64 x86_64 x86_64 GNU/Linux

So I guess there’s a regression in drvfs somewhere. Hope this info can help.

All of these issues are caused by file systems that either do not support some of the functionality DrvFs is trying to use, or behave in unexpected ways. Officially, DrvFs currently support NTFS, ReFS, FAT, CDFS, and SMB.

We will try to accommodate other file systems when possible, but it’s unlikely we will get to all of them.

Also I noticed that for me, when the bug is present for samba drives, it depends on smbd version at the other end:

  • bug present with smbd 3.6.25

  • bug absent with smbd 4.4.16 and 4.8.0

Don’t know if that’s true in general however.

This is now preventing me for updating my machine since I need network drives access in wsl. If there’s a workaround somewhere while waiting for a fix that’d be great.

Digging a little further it looks like my drive that won’t work uses SMB1 dialect and the ones that work use SMB2 or 3 (checked with Get-SmbConnection in powershell).

Turns out wsl2 supports directly mounting cifs shares where we can specify the version to use:

sudo apt install cifs-utils
sudo mount -t cifs -o user=pif,pass=paf,vers=1.0 //server/share /mnt/cifs

works as a workaround in my case.

I’m seeing the same issue on Windows 10 Build 18990 after joining the Insiders Program and installing said build about an hour ago. I did this specifically to enable WSL 2 but I seem to have gone 2.5 years back in time instead of 6 months forward! What gives?!

Same issue here when I enable folder sharing in remote desktop connection(RDS). In remote desktop client host environment windows I can access “\\tsclient\blah”, and under Windows subsystem for Linux I can mount “mount -t drvfs ‘\\TSCLIENT\blah’ /mnt/blah” but I just cannot explore the content of /mnt/blah.

This is happening to me when I disconnect and reconnect a Bitlocker encrypted external hard drive. When I try umount it says that the disk is in use

I still get this issue, now with Windows 11. Is there another way to press to get it fixed? Another issue? Maybe someone can re-file this one.

Also here to confirm this is an issue with BUILD 2004… I upgraded to it and one of my drives could not be seen when doing an LS (cd /mnt/x/ and then ls). Uninstalled BUILD 2004 and boom, ls worked and was able to see files again… Only took my 3 hours to find this thread to solve this issue.

I as well am having this issue

@enovella No, the issue is still open.

Support for NFS would greatly be appreciated! I have a NFS drive mounted on my Windows system directly. I used

mount -t drvfs Z: /mnt/z

to mount the drive. I’m able to go to directories on the NFS I know exist (and get an error message for bad directories), and I’m able to read the contents of files I know to exist (and get error messages for those that do not)

However, just like @jgoz ls does not work because the getdent call fails