Skip to content

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

Closed

Description

@jgoz

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 +++

Activity

  1. SvenGroot commented on Apr 25, 2017

    @SvenGroot
    Member
  2. jgoz commented on Apr 25, 2017

    @jgoz
    Author

    logs-issue-1954.zip

    Sven Groot (@SvenGroot) Zipped and attached. If there's anything else you need, just let me know.

  3. laktak commented on Jun 26, 2017

    @laktak

    Sven Groot (@SvenGroot) do you have any updates for this issue? Also see #1959 which is similar to this for VMware. Thanks!

  4. SvenGroot commented on Jun 26, 2017

    @SvenGroot
    Member

    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.

  5. sunilmut commented on Jun 27, 2017

    @sunilmut
    Member

    John Gozde (@jgoz), Christian Zangl (@laktak) - Thanks for your comments. If you would like to see support for more file systems (other than the ones mentioned by Sven Groot (@SvenGroot)), it would be good if you can open a User Voice ticket for that.

  6. laktak commented on Jun 27, 2017

    @laktak
  7. morgan-greywolf commented on Jan 8, 2018

    @morgan-greywolf

    I'm getting exactly the same issue with an SMB file system on Windows 10 Enterprise Build 16299

  8. jha commented on Jul 25, 2018

    @jha

    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 John Gozde (@jgoz) ls does not work because the getdent call fails

  9. enovella commented on Oct 1, 2018

    @enovella

    Hi John Gozde (@jgoz),

    did you solve it? How?

    Cheers

  10. jgoz commented on Oct 1, 2018

    @jgoz
    Author

    Eduardo Novella (@enovella) No, the issue is still open.

  11. kennethz3 commented on Dec 31, 2018

    @kennethz3

    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

  12. tingjhenjiang commented on Feb 14, 2019

    @tingjhenjiang

    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.

  13. EmilObermayr commented on Feb 19, 2019

    @EmilObermayr

    I have a mount with type cifs and got the strange result that ls works on one sub-directory and gives the error discussed here on another.
    The only real difference I can see is the number of files. It does not work in directories with more than about 70.000 files.

  14. EmilObermayr commented on Feb 20, 2019

    @EmilObermayr

    Now I found a strange solution: Option vers was on default which is 1.0 according to the man-page. But after I have set this to 1.0 explicitly it worked on all sub-directories, including the large ones.

  15. 14 remaining items

  16. aureliendavid commented on Sep 14, 2020

    @aureliendavid

    Some more info:

    • the bug appeared on 1909 after updates installed KB4574727 which updated the wsl kernel
    • rolling that update back (replaced by KB4565351) fixed the issue (uname -a: 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)

    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.

    Thanks

  17. aureliendavid commented on Sep 14, 2020

    @aureliendavid

    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.

  18. alexbrodersen commented on Oct 3, 2020

    @alexbrodersen

    David (@Clonkex) I found this issue was caused for me by the offline file sync feature of the mapped network drive. If I click "work online" under the easy access dropdown in the explorer page I was able to access the files. I enabled offline files around the same time as the update so it is hard to say if it is related.

  19. Clonkex commented on Oct 5, 2020

    @Clonkex

    alexbrodersen Unfortunately it looks like this for me (even though it's already a mapped network drive):

    image

  20. AhmedHatipoglu commented on Aug 30, 2021

    @AhmedHatipoglu

    Having this issue when vim is open in the dir.

  21. juneE-cloud commented on Sep 3, 2021

    @juneE-cloud

    Having the same issue!

    Restarting the whole system works for me, but you never know when is the next 'sudden stop'

    Sigh

  22. timadye commented on Oct 19, 2021

    @timadye

    David (@Clonkex), alexbrodersen, I have the same issue. When I'm online I can access network drives without trouble. When I'm offline, I can't list directories, although I can access explicitly named files:

    % ls /mnt/h
    ls: reading directory /mnt/h: Invalid argument
    % echo hi > /mnt/h/hi.txt
    % cat /mnt/h/hi.txt
    hi
    

    Offline files are implemented by the "CSC-CACHE" file system type (that's what the drive properties show when offline). That isn't in the list of supported filesystems, but it is a core Windows feature (not a third-party filesystem), so it jolly well ought to be supported.

    I see this on WSL1 and WSL2 in CentOS and Ubuntu.

    Hey, WSL developers (Sven Groot (@SvenGroot)?), can this be fixed?

    Thanks,
    Tim.

    Windows 10 Enterprise 20H2
    WSL1 4.4.0-19041-Microsoft CentOS7
    WSL2 5.10.16.3-microsoft-standard-WSL2 CentOS7 and Ubuntu 20.04

  23. snowman commented on Apr 28, 2022

    @snowman
    sudo umount -l /mnt/d
  24. berlincount commented on Oct 14, 2023

    @berlincount

    Running into the same issue: offline files are not available in WSL when mounted volume is actually offline.

  25. jelinj8 commented on May 23, 2024

    @jelinj8

    Same issue still here - Win10PRO + WSL running inside VMWareWorkstation PRO on a WIN11 host, mounted VM shared drive (folder shared from host to virtual machine, then mounted in WSL Ubuntu) - root can't ls files, subdirectories are working OK. Mounting a subdirectory from the netdrive results in the same behavior - its subdirectories are accessible, can't stat mount root (so it is a problem just for a mount root, not a source FS).

  26. microsoft-github-policy-service commented on May 29, 2025

    @microsoft-github-policy-service
    Contributor

    This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

    Thank you!

  27. timadye commented on May 29, 2025

    @timadye

    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.

  28. alkanen commented on Jun 23, 2025

    @alkanen

    I'm having the issue in Windows 10 as well. Until a few days ago I was about to mount my NAS using a cifs entry into my fstab file, but for some reason that has stopped working (complains that the old NAS using SMB 1.0 is too old all of a sudden) but I can still mount it in Windows so I can mount that drive in WSL using drvfs.

    I have the same issue with being unable to list directory contents even though I can cat files I know exist.

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions