I'm working in a Vagrant box pre-packaged with Homestead 5.0 and sometimes after a git pull
or git checkout
, I get
unable to unlink old '<file>' (Permission denied)
After rebooting my box, I can pull or checkout normally. I've also tried to git pull
locally and it worked perfectly.
Setup:
Anyone with this problem ?
It looks like it's a bug with macOS (possibly El Capitan but confirmed on Sierra) and/or NFS.
See these Vagrant issues:
Most people found that it seems to be related to a filesystem caching issue.
Upgrade to High Sierra 10.13.2 Beta 2 as confirmed by JF Bibeau.
Upgraded to High Sierra 10.13.2 Beta 2, removed my cronjob that would periodically do an
ls -laR
as a workaround, [...]I'm happy to report I haven't seen this in almost 2 weeks of using High Sierra. It's completely fixed!
Note that a new, but different, problem seem to have arised on High Sierra related to incorrect listing of files on the guest machine.
If upgrading to High Sierra is not possible, here's a couple workarounds.
If possible, update both, though some people mentioned downgrading helped.
Running the following on the host refreshes the filesystem cache:
ls -alR [synced_directory] > /dev/null
or opening the Get info menu of the synced directory seem to work temporarily.
Some people made a cron job to do that every 5 minutes so they never encounter the problem even if it's not a definitive solution.
Someone pointed out that running a recusive listing of only the directory had the same effect and was faster.
find [synced_directory] -type d > /dev/null
A comment in the issue mentioned:
Disabling NFS lookupcache seems to work, but the performance is unbearable.
On the host machine, give read and write access to Everyone. It also seems to work temporarily, probably for the same caching reason the opening the Get info menu works.
config.vm.synced_folder "./host", "/vagrant-dir", :mount_options => ["dmode=777", "fmode=777"]
But this has a huge performance downside.
This is a vagrant plugin which allows mounting directories with SSHFS. Though from the drawbacks listed on the repo itself:
Performance is worse than an implementation like NFS
Some people mentioned that they were not having this specific "unlink" problem on El Capitan. So downgrading would be a last resort solution to avoid dealing with it.
Some registered Apple developers have reported the problem on bugreport.apple.com (#28927426 and #33043401) but the information is private.
Apple responded and closed the original bug report, saying:
The issue reported in this bug report is fixed but the High Sierra issue is specific to APFS and not the same issue. Please file a new nug (sic) for that issue. Thank you. We are now closing this bug report.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With