Vagrant: EACCES for vmware-nat.json.lock

Created on 10 Oct 2017  ยท  11Comments  ยท  Source: hashicorp/vagrant

Vagrant version

Vagrant 2.0.0

Host operating system

Mac OS X 10.13

Guest operating system

FreeBSD 11.1-RELEASE

Vagrantfile

Vagrant.configure("2") do |config|
    config.vm.define "compile" do |vm|
        vm.vm.box = "jen20/FreeBSD-11.1-RELEASE"

        vm.vm.network "private_network", ip: "172.21.10.10"
    end

    config.vm.define "gen" do |vm|
        vm.vm.box = "jen20/FreeBSD-11.1-RELEASE"

        vm.vm.network "private_network", ip: "172.21.10.11"
    end
end

Debug output

Bringing machine 'compile' up with 'vmware_fusion' provider...
Bringing machine 'gen' up with 'vmware_fusion' provider...
==> compile: Checking if box 'jen20/FreeBSD-11.1-RELEASE' is up to date...
==> compile: Verifying vmnet devices are healthy...
==> compile: Starting the VMware VM...
==> compile: Waiting for machine to boot. This may take a few minutes...
    compile: SSH address: 192.168.11.143:22
    compile: SSH username: vagrant
    compile: SSH auth method: private key
==> compile: Machine booted and ready!
==> compile: Forwarding ports...
    compile: -- 22 => 2222
    compile: SSH address: 192.168.11.143:22
    compile: SSH username: vagrant
    compile: SSH auth method: private key
==> gen: Checking if box 'jen20/FreeBSD-11.1-RELEASE' is up to date...
==> gen: Verifying vmnet devices are healthy...
/Users/James/.vagrant.d/gems/2.3.4/gems/vagrant-vmware-fusion-4.0.24/lib/vagrant-vmware-fusion/helper/nat_conf.rb:169:in `initialize': Permission denied @ rb_sysopen - /Users/James/.vagrant.d/data/vmware/vmware-nat.json.lock (Errno::EACCES)
    from /Users/James/.vagrant.d/gems/2.3.4/gems/vagrant-vmware-fusion-4.0.24/lib/vagrant-vmware-fusion/helper/nat_conf.rb:169:in `open'
    from /Users/James/.vagrant.d/gems/2.3.4/gems/vagrant-vmware-fusion-4.0.24/lib/vagrant-vmware-fusion/helper/nat_conf.rb:169:in `save'
    from /Users/James/.vagrant.d/gems/2.3.4/gems/vagrant-vmware-fusion-4.0.24/lib/vagrant-vmware-fusion/helper/nat_conf.rb:337:in `save'
    from /Users/James/.vagrant.d/gems/2.3.4/gems/vagrant-vmware-fusion-4.0.24/lib/vagrant-vmware-fusion/helper/nat_conf.rb:455:in `fix_config_rewrite!'
    from /Users/James/.vagrant.d/gems/2.3.4/gems/vagrant-vmware-fusion-4.0.24/lib/vagrant-vmware-fusion/helper/nat_conf.rb:330:in `block in reload'
    from /Users/James/.vagrant.d/gems/2.3.4/gems/vagrant-vmware-fusion-4.0.24/lib/vagrant-vmware-fusion/helper/nat_conf.rb:321:in `open'
    from /Users/James/.vagrant.d/gems/2.3.4/gems/vagrant-vmware-fusion-4.0.24/lib/vagrant-vmware-fusion/helper/nat_conf.rb:321:in `open'
    from /Users/James/.vagrant.d/gems/2.3.4/gems/vagrant-vmware-fusion-4.0.24/lib/vagrant-vmware-fusion/helper/nat_conf.rb:321:in `reload'
    from /Users/James/.vagrant.d/gems/2.3.4/gems/vagrant-vmware-fusion-4.0.24/lib/vagrant-vmware-fusion/helper/nat_conf.rb:244:in `initialize'

Expected behavior

Boxes should have been brought up correctly.

Actual behavior

/Users/James/.vagrant.d/gems/2.3.4/gems/vagrant-vmware-fusion-4.0.24/lib/vagrant-vmware-fusion/helper/nat_conf.rb:169:ininitialize': Permission denied @ rb_sysopen - /Users/James/.vagrant.d/data/vmware/vmware-nat.json.lock (Errno::EACCES)`

This appears to be new racy behaviour in dealing with NAT configuration.

Steps to reproduce

  1. vagrant up (sometimes)
providevmware

Most helpful comment

For people coming to this issue, it seems that parts of the ~/.vagrant.d tree have incorrect permissions set on install. The following appears to fix this.

sudo chown -R $USER: ~/.vagrant.d/data/vmware

I'll leave the issue open since it's not yet fixed in a release so far as I'm aware.

All 11 comments

A second vagrant up will often resolve this issue, though usually it still requires editing nat.conf to remove port forwarding conflicts.

@jen20 - Can you please provide details concerning editing "nat.conf" - The second "vagrant up" did not solve it for me - I have other VMs running using the VMWare Fusion UI.

Try this:

sudo chown -R $USER: ~/.vagrant.d/data/vmware/

After installing ~/.vagrant.d/data/vmware/ seems to be owned by root.

@jen20

$ ls -la /Users/James/.vagrant.d/data/vmware/vmware-nat.json.lock

check permissions, if it's not owned by you, chown it

I have the same issue with freshly released vagrant-vmware-fusion-5.0.0.
I have vagrant 2.0.0. I have reinstalled the plugin, vagrant as well as Laravel Homestead in the most recent version with VM Ware Fusion 10.0.1. Any recommendations?

/Users/somebody/.vagrant.d/gems/2.3.4/gems/vagrant-vmware-fusion-5.0.0/lib/vagrant-vmware-fusion/helper/nat_conf.rb:169:in `initialize': Permission denied @ rb_sysopen - /Users/somebody/.vagrant.d/data/vmware/vmware-nat.json.lock (Errno::EACCES)

@external's comment resolved my problem. Thanks!

For people coming to this issue, it seems that parts of the ~/.vagrant.d tree have incorrect permissions set on install. The following appears to fix this.

sudo chown -R $USER: ~/.vagrant.d/data/vmware

I'll leave the issue open since it's not yet fixed in a release so far as I'm aware.

Thanks, @chrisroberts. This post got very active while I was posting, so I saw that one too late. In the meantime I have gotten rid of my .vagrant and ~/.vargant.d folders and restarted and reinstalled and then it all went fine. Thanks for pointing it out though.

A new VMware plugin has been released. You can read more about it here:

https://www.hashicorp.com/blog/introducing-the-vagrant-vmware-desktop-plugin

The new plugin has a new implementation for the networking configuration which resolves this original issue completely (as the file in question is no longer required).

Cheers!

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luispabon picture luispabon  ยท  3Comments

rhencke picture rhencke  ยท  3Comments

jsirex picture jsirex  ยท  3Comments

bbaassssiiee picture bbaassssiiee  ยท  3Comments

hesco picture hesco  ยท  3Comments