WSL: drvfs fmask=111 breaks (e.g.) cmd.exe without workarounds?

  • Your Windows build number: (Type ver at a Windows Command Prompt)

Microsoft Windows [Version 10.0.17134.81]

  • What you’re doing and what’s happening: (Copy&paste specific commands and their output, or include screen shots)

Not sure if I’m just missing something here? When using fmask=111 as used as an example in the post introducing the feature using windows .exes doesn’t work - OK, that’s as expected. The problem is that there doesn’t seem to be a way to chmod +x things in /mnt/c/Windows - even UAC elevated + sudo doesn’t help:

% sudo chmod +x /mnt/c/Windows/System32/cmd.exe
[sudo] password for simon:
chmod: changing permissions of '/mnt/c/Windows/System32/cmd.exe': Permission denied

Removing +x permission from drvfs files by default is a really big win, because git preserves the +x permission on filemode-supporting filesystems, and otherwise can only be set via git add --chmod=+x or git update-index --chmod=+x (from memory).

  • What’s wrong / what should be happening instead:

Not really sure what the right answer here would be: pre-chmod’ing windows executables? Path/glob-based *mask configuration? Permitting chmod of system files somehow?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 22

Most upvoted comments

Sorry replying to an old issue, but maybe this workaround can help someone else (at least works for me):

/etc/wsl.conf

[automount]
enabled = false
mountFsTab = true

/etc/fstab

LABEL=cloudimg-rootfs   /        ext4   defaults        0 0
C: /mnt/c drvfs defaults,noatime,uid=1000,gid=1000,fmask=111,metadata,case=off 0 0
//localhost/C$/Windows/System32 /mnt/c/Windows/System32 drvfs defaults,ro,noatime,uid=1000,gid=1000,fmask=222,umask=222,case=off 0 0

Tell you what; I will mark this as discussion for the time being and let it play out. I will not be participating further. Having rejected (or misunderstood) my intent, I have nothing further to offer you on this topic. Bonne chance.

And I have no idea where the line on “companion tooling” is

Companion tooling are applications like ls, stat, chown, chmod, mount, and other *nix tools.

Presumably fsutil.exe does, what if this is an option to that?

If you are proposing a win32 side solution to your ask, sure. Sounds good to me.

that’s a “win”

If you believe it is a win, great.

It was not my intent to come across as passive aggressive; apologies if it did. Once you have a concrete proposal to improve WSL it is very welcome in UserVoice.