You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pulling this out of #1492. It is possibly a dup of #1420; but I'm thinking maybe not because that issue has no lingering fds. This hits in spades with nfs-ganesha, because the protocol is stateless and file descriptors are cached for a while before being released. Windows Explorer traipses all over thousands of files, causing lots of directory fds to remain open. This in turn causes unexpected mv and rm operations on seemingly random directories on the WSL side to fail.
This will probably also show itself when people start doing web development scenarios, because http servers have a tendency to do the same sort of fd caching.
therealkenc - Apologize for the delay here. I am sure there are other neglected issues, and I personally would like to get through them too.
Anyways, I think this stems from the NTFS limitation that prevents renaming directories which have a handle open to anything below. Sven Groot (@SvenGroot) to confirm.
Other than 'try to not open lots of files' is there any advice on avoiding this issue, given that a fix seems to be escaping us? Is there a way to monitor and close file handles? Is there a more suitable filesystem for hosting WSL filesystems that would avoid hitting this? Is there a node setting we can flag to ignore these errors, given that they're apparently false positives?
There has been chirping crickets since 2016, is is fairly safe to assume, mostly because the problem is understood and there isn't much for Sven or Ben or Brian to add. The problem is caused by underlying limitations in NTFS and the NT APIs you have to work with. I posted an outline of a possible (albeit nontrivial) solution elsewhere, of which they've almost certainly been aware since 2016 as well. There isn't anything new to "look into" here.
Tell you what you can do, if you are looking for something constructive. Right now it is impossible to differentiate between EACCES caused by WSL failing to respect Unix filesystem semantics, versus folks who simply have their permissions wrong (EUSERCONFUSED). You know up in that rename(2) the difference, because you know whether the mode bits (what we tend to call metadata) are okay or not. In the case you can't rename because NTFS won't play ball, return a nonstandard EBUSY instead of EACCES, which will at least stick out like a sore thumb. That way reported issues triggering the known problem can be summarily duped here instead of guessing. This was asked for about a year ago but could have been easily buried versus rejected. Just a thought.
seffyroff I have a recommendation. In my case, what I was trying to do was npm install chalk and other packages, and it was failing with the EACCES error. I was running that command from within a folder inside my WSL ubuntu 18 install's home dir from WSL ubuntu's bash command prompt.
I realized that when I closed all programs that were looking at that folder, the error went away. Specifically, I realized that the windows application MobaXterm was the cause for my specific issues, because when i closed it, npm install chalk would run without issue. HTH!!
This is another motivating reason for WSL to ditch NTFS and the NT filesystem APIs, in favor of Unix-native approaches. Probably ext4, since it has FreeBSD drivers.
Interesting approach. This approach will work around some EACESS errors folks are experiencing, specifically where the open handle triggering #1529 is transient and goes away in one second or less. For other scenarios it won't work, like an editor holding a handle open, or handles being held in some cache or another for more than one second or indefinitely. It won't address the OP test case, for example. Like the effort though. Working around some scenarios (especially your own) is better than it not working at all.
Hotpatching [g]libc to intercept all syscalls is a pretty big hammer though, and might seem a little excessive to some. [Not me, mind. Anything worth doing is worth overdoing.]
Another approach would be to hook higher in the food chain. Perhaps in libuvhere.
I considered switching the hook to libuv to make things faster and lightweight, but figured time was better spent making it work in more scenarios rather than fewer.
Is the WSL team planning to fix this? I ran into this bug today simply trying to build a npm project. wslunpindir worked like a charm (now I use export LD_PRELOAD=~/git/wslunpindir/interceptrename.so) but this is clearly only a workaround and does not solve the problem for all situations.
why is [Install Remote WSL fail with mv - permission denied #109](https://github.com/microsoft/vscode-remote-release/issues/109) even closed? I have the same issue with mv
The problem is caused by underlying limitations in NTFS and the NT APIs you have to work with.
So it's an another facet of the same root problem as #873 and why WSL2 is being added.
… it's fixed in WSL2.
It's not as much fixed in WSL2 as WSL2 is a fundamentally different tool with its own set of significant limitations (deriving from virtualization). Specifically, Hyper-V is not compatible with at least a couple of tools I use, and it also adds significant overhead by running Windows as a guest.
Reacted by std4453, Robin Brown, Naqeeb Rehman and Giuseppe Galano
A correct fix for WSL1 would require massive changes in the NT kernel to
accommodate WSL2. Fixing performance as well would essentially require
reimplementing much of the Linux I/O stack. The BSDs have code that could
be used, but it would still be a huge task.
go get -u github.com/PuerkitoBio/goquery
go: extracting github.com/PuerkitoBio/goquery v1.5.1
go get: rename /home/aman/go/pkg/mod/github.com/!puerkito!bio/[email protected] /home/aman/go/pkg/mod/github.com/!puerkito!bio/[email protected]: permission denied
Permissions
~/go: ls
total 0
drwxr-xr-x 1 aman aman 512 Mar 15 02:43 ..
drwxrwxrwx 1 aman aman 512 Mar 15 02:46 .
drwxrwxrwx 1 aman aman 512 Mar 15 02:46 src
drwxrwxrwx 1 aman aman 512 Mar 15 09:53 pkg
I have a hypothesis that may or may not help illuminate the issue.
I have a machine that uses WSL v1 (no issues on v2). I can replicate EACCES pretty easily by trying to install a package with VSCode. I believe there's some sort of access limit or open handles.
Basically, I know VSCode is monitoring the folder I'm working in. If I install a package with VSCode is open, I'll get EACCES errors. If I close VSCode and install the packages over the Ubuntu bash, no errors.
So, to create this issue, I believe you just have to:
Initiate some sort of file system watcher on a folder (VSCode)
Create and delete files within the same folder very quickly (npm install)
I think what's causing the EACCES issue is that VSCode isn't handling the file system changes faster than npm can create or delete them. That's why this only happens sometimes and on some machines. The machine I'm working on currently is REALLY slow in general and I get this errors consistently if I try it installing a package with VSCode open. WSLv2 may have fixed this issue, or it's just so much faster than WSLv1 that the it's rare for the collision to occur. The fact that the issue goes away when I close VSCode means that the handle is being kept open by the file system watcher.
I'm sure somebody smarter than I can create some sort of test script that creates and deletes a bunch of files with a watcher in the background. You might find the collision. I just don't know where in WSL this issue might occur. Perhaps inotify is bugged somewhere?
Edit: Worth noting, I don't use /mnt/* so it probably has little to do with the Windows drives.
Reacted by zivkr2, Craig, Dakedres, Joshua Cepeda, François Parmentier, Manu, Patrick Rice and Alexandre Payot
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.
Activity
sunilmut commentedon Jul 7, 2017
therealkenc - Apologize for the delay here. I am sure there are other neglected issues, and I personally would like to get through them too.
Anyways, I think this stems from the NTFS limitation that prevents renaming directories which have a handle open to anything below. Sven Groot (@SvenGroot) to confirm.
seffyroff commentedon Nov 17, 2018
Other than 'try to not open lots of files' is there any advice on avoiding this issue, given that a fix seems to be escaping us? Is there a way to monitor and close file handles? Is there a more suitable filesystem for hosting WSL filesystems that would avoid hitting this? Is there a node setting we can flag to ignore these errors, given that they're apparently false positives?
bitcrazed commentedon Dec 19, 2018
Assigned to Sven Groot (@SvenGroot) and Tara Raj (@tara-raj) to take a look, though with Xmas fast approaching, may be a couple of weeks until this gets looked into.
Interested party here: https://twitter.com/rainabba/status/1075192299791908864
therealkenc commentedon Dec 19, 2018
There has been chirping crickets since 2016, is is fairly safe to assume, mostly because the problem is understood and there isn't much for Sven or Ben or Brian to add. The problem is caused by underlying limitations in NTFS and the NT APIs you have to work with. I posted an outline of a possible (albeit nontrivial) solution elsewhere, of which they've almost certainly been aware since 2016 as well. There isn't anything new to "look into" here.
therealkenc commentedon Dec 20, 2018
Tell you what you can do, if you are looking for something constructive. Right now it is impossible to differentiate between
EACCEScaused by WSL failing to respect Unix filesystem semantics, versus folks who simply have their permissions wrong (EUSERCONFUSED). You know up in thatrename(2)the difference, because you know whether the mode bits (what we tend to call metadata) are okay or not. In the case you can't rename because NTFS won't play ball, return a nonstandardEBUSYinstead ofEACCES, which will at least stick out like a sore thumb. That way reported issues triggering the known problem can be summarily duped here instead of guessing. This was asked for about a year ago but could have been easily buried versus rejected. Just a thought.liudonghua123 commentedon Jan 21, 2019
I have the similar problem. I wanted to install rocket.chat according to the instructions on https://rocket.chat/docs/installation/manual-installation/ubuntu/ .
eriksneff commentedon Jan 22, 2019
seffyroff I have a recommendation. In my case, what I was trying to do was
npm install chalkand other packages, and it was failing with the EACCES error. I was running that command from within a folder inside my WSL ubuntu 18 install's home dir from WSL ubuntu's bash command prompt.I realized that when I closed all programs that were looking at that folder, the error went away. Specifically, I realized that the windows application MobaXterm was the cause for my specific issues, because when i closed it,
npm install chalkwould run without issue. HTH!!DemiMarie commentedon Feb 8, 2019
This is another motivating reason for WSL to ditch NTFS and the NT filesystem APIs, in favor of Unix-native approaches. Probably ext4, since it has FreeBSD drivers.
therealkenc commentedon Apr 9, 2019
With ref to #14 (message)
Interesting approach. This approach will work around some
EACESSerrors folks are experiencing, specifically where the open handle triggering #1529 is transient and goes away in one second or less. For other scenarios it won't work, like an editor holding a handle open, or handles being held in some cache or another for more than one second or indefinitely. It won't address the OP test case, for example. Like the effort though. Working around some scenarios (especially your own) is better than it not working at all.Hotpatching [g]libc to intercept all syscalls is a pretty big hammer though, and might seem a little excessive to some. [Not me, mind. Anything worth doing is worth overdoing.]
Another approach would be to hook higher in the food chain. Perhaps in
libuvhere.Anyway, nice to see people seeking plausible mitigations.
fuzzyTew commentedon Apr 9, 2019
In response to therealkenc's comments, I spent some time expanding on this hotpatch, now at https://github.com/fuzzyTew/wslunpindir . When the error happens, it enumerates open filehandles from /proc, spits some messaging out on /dev/tty, and waits until they are closed. This does not find open files from Windows, only from within Linux. Assumes the app is being run interactively.
I considered switching the hook to libuv to make things faster and lightweight, but figured time was better spent making it work in more scenarios rather than fewer.
therealkenc commentedon Apr 10, 2019
Noice 💯. If nothing else, it serves as a very useful troubleshooting tool.
Expand your intercept-all-the-things approach enough and you can fix the problem even for the case where the handle remains open 😉.
jacob-greenfield commentedon Jun 15, 2019
Is the WSL team planning to fix this? I ran into this bug today simply trying to build a
npmproject. wslunpindir worked like a charm (now I useexport LD_PRELOAD=~/git/wslunpindir/interceptrename.so) but this is clearly only a workaround and does not solve the problem for all situations.onomatopellan commentedon Jun 15, 2019
Jacob Greenfield (@Coder-256) it's fixed in WSL2.
therealkenc commentedon Jun 25, 2019
For a good swath of folk's major pain points, yes. The underlying issue remains however. With minor string edits to OP:
and the strace for pedantry:
Which would seem academic, except that it affects everyone using WSL for WSL's raison d'être, which is interop with Windows.
snevs commentedon Aug 28, 2019
why is
[Install Remote WSL fail with mv - permission denied #109](https://github.com/microsoft/vscode-remote-release/issues/109)even closed? I have the same issue with mvslikts commentedon Dec 27, 2019
So it's an another facet of the same root problem as #873 and why WSL2 is being added.
It's not as much fixed in WSL2 as WSL2 is a fundamentally different tool with its own set of significant limitations (deriving from virtualization). Specifically, Hyper-V is not compatible with at least a couple of tools I use, and it also adds significant overhead by running Windows as a guest.
DemiMarie commentedon Dec 27, 2019
amanhigh commentedon Mar 15, 2020
Facing Similar Issue
Permissions
clshortfuse commentedon Mar 23, 2020
I have a hypothesis that may or may not help illuminate the issue.
I have a machine that uses WSL v1 (no issues on v2). I can replicate EACCES pretty easily by trying to install a package with VSCode. I believe there's some sort of access limit or open handles.
Basically, I know VSCode is monitoring the folder I'm working in. If I install a package with VSCode is open, I'll get EACCES errors. If I close VSCode and install the packages over the Ubuntu bash, no errors.
So, to create this issue, I believe you just have to:
npm install)I think what's causing the EACCES issue is that VSCode isn't handling the file system changes faster than
npmcan create or delete them. That's why this only happens sometimes and on some machines. The machine I'm working on currently is REALLY slow in general and I get this errors consistently if I try it installing a package with VSCode open. WSLv2 may have fixed this issue, or it's just so much faster than WSLv1 that the it's rare for the collision to occur. The fact that the issue goes away when I close VSCode means that the handle is being kept open by the file system watcher.I'm sure somebody smarter than I can create some sort of test script that creates and deletes a bunch of files with a watcher in the background. You might find the collision. I just don't know where in WSL this issue might occur. Perhaps
inotifyis bugged somewhere?Edit: Worth noting, I don't use
/mnt/*so it probably has little to do with the Windows drives.wsl fix for mv
Merge pull request #1386 from aantron/eacces
microsoft-github-policy-service commentedon Feb 1, 2024
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!