berkshelf / vagrant-berkshelf

A Vagrant plugin to add Berkshelf integration to the Chef provisioners

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Shared folders that Chef requires are missing on the virtual machine" using NFS

phillipsnick opened this issue Β· comments

Upon bringing a VM back online I'm getting the following error message when using NFS shares with VMware Fusion.

==> web: Running provisioner: chef_solo...
==> web: Detected Chef (latest) is already installed
Shared folders that Chef requires are missing on the virtual machine.
This is usually due to configuration changing after already booting the
machine. The fix is to run a `vagrant reload` so that the proper shared
folders will be prepared and mounted on the VM.

I understand that there was this issue in the past under #182 which has since been resolved, but I am now getting the issue again on two separate OS X computers. I'm not 100% sure this is actually an issue with vagrant-berkshelf, might be an issue with Vagrant's implementation of Chef Solo and NFS shared folders. Either way I'm hoping it's not me missing something blatantly obvious as I have spent hours testing this!

Anyway I have setup a basic repo used to replicate this across my two computers. https://github.com/phillipsnick/vagrant-vmware/tree/v0.1.0

To replicate the issue I have used the following commands

git clone https://github.com/phillipsnick/vagrant-vmware.git
cd vagrant-vmware
git checkout v0.1.0
vagrant up

At this point it will have spun up two VMs and provisioned them just fine and my NFS exports file will look like this:

# VAGRANT-BEGIN: 501 /Users/x1nick/Development/vagrant-vmware/.vagrant/machines/web/vmware_fusion/805b65a9-4ae5-407a-81f7-81d663b2b09f/packer-ubuntu-14.04-amd64.vmx
"/Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web" 176.16.10.100 -alldirs -mapall=501:20
"/Users/x1nick/Development/vagrant-vmware" "/Users/x1nick/Development/vagrant-vmware/roles" "/Users/x1nick/Development/vagrant-vmware/environments" 176.16.10.100 -alldirs -mapall=501:20
# VAGRANT-END: 501 /Users/x1nick/Development/vagrant-vmware/.vagrant/machines/web/vmware_fusion/805b65a9-4ae5-407a-81f7-81d663b2b09f/packer-ubuntu-14.04-amd64.vmx
# VAGRANT-BEGIN: 501 /Users/x1nick/Development/vagrant-vmware/.vagrant/machines/db/vmware_fusion/30ae944c-8542-43b7-870a-3d2e2099bd02/packer-ubuntu-14.04-amd64.vmx
"/Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-16vg5qd-db" 176.16.10.115 -alldirs -mapall=501:20
"/Users/x1nick/Development/vagrant-vmware" "/Users/x1nick/Development/vagrant-vmware/roles" "/Users/x1nick/Development/vagrant-vmware/environments" 176.16.10.115 -alldirs -mapall=501:20
# VAGRANT-END: 501 /Users/x1nick/Development/vagrant-vmware/.vagrant/machines/db/vmware_fusion/30ae944c-8542-43b7-870a-3d2e2099bd02/packer-ubuntu-14.04-amd64.vmx

All looks good πŸ‘
Now shutdown the VMs and bring them back up.

vagrant halt
vagrant up

Checking the NFS exports file, and it's now missing all Chef related items.

# VAGRANT-BEGIN: 501 /Users/x1nick/Development/vagrant-vmware/.vagrant/machines/web/vmware_fusion/805b65a9-4ae5-407a-81f7-81d663b2b09f/packer-ubuntu-14.04-amd64.vmx
"/Users/x1nick/Development/vagrant-vmware" 176.16.10.100 -alldirs -mapall=501:20
# VAGRANT-END: 501 /Users/x1nick/Development/vagrant-vmware/.vagrant/machines/web/vmware_fusion/805b65a9-4ae5-407a-81f7-81d663b2b09f/packer-ubuntu-14.04-amd64.vmx
# VAGRANT-BEGIN: 501 /Users/x1nick/Development/vagrant-vmware/.vagrant/machines/db/vmware_fusion/30ae944c-8542-43b7-870a-3d2e2099bd02/packer-ubuntu-14.04-amd64.vmx
"/Users/x1nick/Development/vagrant-vmware" 176.16.10.115 -alldirs -mapall=501:20
# VAGRANT-END: 501 /Users/x1nick/Development/vagrant-vmware/.vagrant/machines/db/vmware_fusion/30ae944c-8542-43b7-870a-3d2e2099bd02/packer-ubuntu-14.04-amd64.vmx

Versions in use

➜  ~  sw_vers
ProductName:    Mac OS X
ProductVersion: 10.10.1
BuildVersion:   14B25

➜  ~  vagrant version
Installed Version: 1.7.2
Latest Version: 1.7.2

➜  ~  vagrant plugin list
vagrant-berkshelf (4.0.2)
vagrant-cachier (1.2.0)
vagrant-hostmanager (1.5.0)
vagrant-omnibus (1.4.1)
vagrant-parallels (1.3.7)
vagrant-share (1.1.3, system)
vagrant-vmware-fusion (3.2.0)

➜  ~  chef -v
Chef Development Kit Version: 0.3.6

It would appear this is in fact a potential bug in Vagrant.

After doing some more digging here are some specific parts of the the debug log for vagrant up

...
==> web: Updating Vagrant's Berkshelf...
 INFO subprocess: Starting process: ["/usr/bin/berks", "vendor", "/Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web", "--berksfile", "/Users/x1nick/Development/vagrant-vmware/Berksfile"]
DEBUG subprocess: Command not in installer, not touching env vars.
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: Resolving cookbook dependencies...
DEBUG subprocess: stdout: Using build-essential (2.1.3)
DEBUG subprocess: stdout: Using dmg (2.2.2)
DEBUG subprocess: stdout: Using runit (1.5.14)
DEBUG subprocess: stdout: Using yum (3.5.2)
DEBUG subprocess: stdout: Using git (4.1.0)
DEBUG subprocess: stdout: Using windows (1.36.1)
Using yum-epel (0.6.0)
DEBUG subprocess: stdout: Using chef_handler (1.1.6)
DEBUG subprocess: stdout: Vendoring build-essential (2.1.3) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/build-essential
DEBUG subprocess: stdout: Vendoring chef_handler (1.1.6) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/chef_handler
DEBUG subprocess: stdout: Vendoring dmg (2.2.2) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/dmg
DEBUG subprocess: stdout: Vendoring git (4.1.0) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/git
DEBUG subprocess: stdout: Vendoring runit (1.5.14) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/runit
DEBUG subprocess: stdout: Vendoring windows (1.36.1) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/windows
DEBUG subprocess: stdout: Vendoring yum (3.5.2) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/yum
DEBUG subprocess: stdout: Vendoring yum-epel (0.6.0) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/yum-epel
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 31999
DEBUG subprocess: Exit status: 0
 INFO interface: output: Resolving cookbook dependencies...
Using build-essential (2.1.3)
Using dmg (2.2.2)
Using runit (1.5.14)
Using yum (3.5.2)
Using git (4.1.0)
Using windows (1.36.1)
Using yum-epel (0.6.0)
Using chef_handler (1.1.6)
Vendoring build-essential (2.1.3) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/build-essential
Vendoring chef_handler (1.1.6) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/chef_handler
Vendoring dmg (2.2.2) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/dmg
Vendoring git (4.1.0) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/git
Vendoring runit (1.5.14) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/runit
Vendoring windows (1.36.1) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/windows
Vendoring yum (3.5.2) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/yum
Vendoring yum-epel (0.6.0) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/yum-epel

 INFO interface: output: ==> web: Resolving cookbook dependencies...
==> web: Using build-essential (2.1.3)
==> web: Using dmg (2.2.2)
==> web: Using runit (1.5.14)
==> web: Using yum (3.5.2)
==> web: Using git (4.1.0)
==> web: Using windows (1.36.1)
==> web: Using yum-epel (0.6.0)
==> web: Using chef_handler (1.1.6)
==> web: Vendoring build-essential (2.1.3) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/build-essential
==> web: Vendoring chef_handler (1.1.6) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/chef_handler
==> web: Vendoring dmg (2.2.2) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/dmg
==> web: Vendoring git (4.1.0) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/git
==> web: Vendoring runit (1.5.14) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/runit
==> web: Vendoring windows (1.36.1) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/windows
==> web: Vendoring yum (3.5.2) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/yum
==> web: Vendoring yum-epel (0.6.0) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/yum-epel
==> web: Resolving cookbook dependencies...
==> web: Using build-essential (2.1.3)
==> web: Using dmg (2.2.2)
==> web: Using runit (1.5.14)
==> web: Using yum (3.5.2)
==> web: Using git (4.1.0)
==> web: Using windows (1.36.1)
==> web: Using yum-epel (0.6.0)
==> web: Using chef_handler (1.1.6)
==> web: Vendoring build-essential (2.1.3) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/build-essential
==> web: Vendoring chef_handler (1.1.6) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/chef_handler
==> web: Vendoring dmg (2.2.2) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/dmg
==> web: Vendoring git (4.1.0) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/git
==> web: Vendoring runit (1.5.14) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/runit
==> web: Vendoring windows (1.36.1) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/windows
==> web: Vendoring yum (3.5.2) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/yum
==> web: Vendoring yum-epel (0.6.0) to /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web/yum-epel
 INFO warden: Calling IN action: #<VagrantPlugins::Berkshelf::Action::Upload:0x00000104800d68>
 INFO upload: Provisioner does need to upload
 INFO warden: Calling IN action: #<VagrantPlugins::Cachier::Action::ConfigureBucketRoot:0x00000104849bf8>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::Provision:0x0000010489a4e0>
 INFO provision: Checking provisioner sentinel file...
 INFO provision: Sentinel found! Not provisioning.
DEBUG chef_solo: Not sharing /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web, exists as /tmp/vagrant-chef/502ce27a6c8e59a74d01392ffa38f706/cookbooks
DEBUG chef_solo: Not sharing /Users/x1nick/Development/vagrant-vmware/roles, exists as /tmp/vagrant-chef/0cbbaf0e09888042d68677cf81e7d0a4/roles
DEBUG chef_solo: Not sharing /Users/x1nick/Development/vagrant-vmware/environments, exists as /tmp/vagrant-chef/027c3605c92b2cddeb8d333c7718e3a2/environments
 INFO warden: Calling IN action: #<VagrantPlugins::Omnibus::Action::InstallChef:0x000001048e35f0>
 INFO warden: Calling IN action: #<VagrantPlugins::Cachier::Action::InstallBuckets:0x00000104932d58>
 INFO warden: Calling IN action: VMware Middleware: PrepareSyncedFolderCleanup
 INFO subprocess: Starting process: ["/Applications/VMware Fusion.app/Contents/Library/vmrun", "list"]
DEBUG subprocess: Command not in installer, not touching env vars.
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: Total running VMs: 0
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 31999
DEBUG subprocess: Exit status: 0
 INFO warden: Calling IN action: #<VagrantPlugins::SyncedFolderNFS::ActionCleanup:0x000001049782b8>
DEBUG host: Searching for cap: nfs_prune
DEBUG host: Checking in: darwin
DEBUG host: Checking in: bsd
DEBUG host: Found cap: nfs_prune in bsd
 INFO nfs: NFS pruning. Valid IDs: []
DEBUG host: Searching for cap: nfs_prune
DEBUG host: Checking in: darwin
DEBUG host: Checking in: bsd
DEBUG host: Found cap: nfs_prune in bsd
 INFO host: Execute capability: nfs_prune [#<Vagrant::Environment: /Users/x1nick/Development/vagrant-vmware>, #<Vagrant::UI::Prefixed:0x00000104bc17b8 @logger=#<Log4r::Logger:0x00000104bc1768 @fullname="vagrant::ui::interface", @outputters=[], @additive=true, @name="interface", @path="vagrant::ui", @parent=#<Log4r::Logger:0x00000100874b90 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x000001010543d8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x00000101054310>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x00000101813290 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x00000100874a00 @level=0, @outputters=[]>, @level=1, @trace=false>, @level=1, @trace=false>, @opts={}, @prefix=:web, @ui=#<Vagrant::UI::Colored:0x000001008efbb0 @logger=#<Log4r::Logger:0x000001008efa20 @fullname="vagrant::ui::interface", @outputters=[], @additive=true, @name="interface", @path="vagrant::ui", @parent=#<Log4r::Logger:0x00000100874b90 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x000001010543d8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x00000101054310>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x00000101813290 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x00000100874a00 @level=0, @outputters=[]>, @level=1, @trace=false>, @level=1, @trace=false>, @opts={:color=>:default}, @lock=#<Mutex:0x00000102855680>>>, []] (darwin)
 INFO bsd: Pruning invalid NFS entries...
 INFO interface: info: Pruning invalid NFS exports. Administrator privileges will be required...
 INFO interface: info: ==> web: Pruning invalid NFS exports. Administrator privileges will be required...
==> web: Pruning invalid NFS exports. Administrator privileges will be required...
 INFO bsd: Invalid ID, pruning: /Users/x1nick/Development/vagrant-vmware/.vagrant/machines/db/vmware_fusion/30ae944c-8542-43b7-870a-3d2e2099bd02/packer-ubuntu-14.04-amd64.vmx
 INFO bsd: Invalid ID, pruning: /Users/x1nick/Development/vagrant-vmware/.vagrant/machines/web/vmware_fusion/805b65a9-4ae5-407a-81f7-81d663b2b09f/packer-ubuntu-14.04-amd64.vmx
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::SyncedFolderCleanup:0x000001049f3da0>
DEBUG host: Searching for cap: nfs_installed
DEBUG host: Checking in: darwin
DEBUG host: Checking in: bsd
DEBUG host: Found cap: nfs_installed in bsd
 INFO host: Execute capability: nfs_installed [#<Vagrant::Environment: /Users/x1nick/Development/vagrant-vmware>] (darwin)
 INFO synced_folder_cleanup: Invoking synced folder cleanup for: nfs
 INFO nfs: NFS pruning. Valid IDs: []
DEBUG host: Searching for cap: nfs_prune
DEBUG host: Checking in: darwin
DEBUG host: Checking in: bsd
DEBUG host: Found cap: nfs_prune in bsd
 INFO host: Execute capability: nfs_prune [#<Vagrant::Environment: /Users/x1nick/Development/vagrant-vmware>, #<Vagrant::UI::Prefixed:0x00000104bc17b8 @logger=#<Log4r::Logger:0x00000104bc1768 @fullname="vagrant::ui::interface", @outputters=[], @additive=true, @name="interface", @path="vagrant::ui", @parent=#<Log4r::Logger:0x00000100874b90 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x000001010543d8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x00000101054310>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x00000101813290 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x00000100874a00 @level=0, @outputters=[]>, @level=1, @trace=false>, @level=1, @trace=false>, @opts={}, @prefix=:web, @ui=#<Vagrant::UI::Colored:0x000001008efbb0 @logger=#<Log4r::Logger:0x000001008efa20 @fullname="vagrant::ui::interface", @outputters=[], @additive=true, @name="interface", @path="vagrant::ui", @parent=#<Log4r::Logger:0x00000100874b90 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x000001010543d8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x00000101054310>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x00000101813290 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x00000100874a00 @level=0, @outputters=[]>, @level=1, @trace=false>, @level=1, @trace=false>, @opts={:color=>:default}, @lock=#<Mutex:0x00000102855680>>>, []] (darwin)
 INFO bsd: Pruning invalid NFS entries...
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::SyncedFolders:0x0000010091f978>
DEBUG host: Searching for cap: nfs_installed
DEBUG host: Checking in: darwin
DEBUG host: Checking in: bsd
DEBUG host: Found cap: nfs_installed in bsd
 INFO host: Execute capability: nfs_installed [#<Vagrant::Environment: /Users/x1nick/Development/vagrant-vmware>] (darwin)
 INFO synced_folders: Synced Folder Implementation: nfs
 INFO synced_folders:   - /vagrant: . => /vagrant
 INFO synced_folders: Invoking synced folder prepare for: nfs
 INFO warden: Calling IN action: VMware Middleware: PrepareNFSSettings
 INFO warden: Calling IN action: VMware Middleware: Network
...

Specifically these three lines of debug

DEBUG chef_solo: Not sharing /Users/x1nick/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150121-14677-1ddtg4i-web, exists as /tmp/vagrant-chef/502ce27a6c8e59a74d01392ffa38f706/cookbooks
DEBUG chef_solo: Not sharing /Users/x1nick/Development/vagrant-vmware/roles, exists as /tmp/vagrant-chef/0cbbaf0e09888042d68677cf81e7d0a4/roles
DEBUG chef_solo: Not sharing /Users/x1nick/Development/vagrant-vmware/environments, exists as /tmp/vagrant-chef/027c3605c92b2cddeb8d333c7718e3a2/environments

If I log into the VM and look in the /tmp directory

vagrant@web:/tmp$ ls -la
total 16
drwxrwxrwt  4 root root 4096 Jan 21 22:17 .
drwxr-xr-x 23 root root 4096 Jan 21 21:26 ..
drwxrwxrwt  2 root root 4096 Jan 21 21:47 VMwareDnD
drwx------  2 root root 4096 Jan 21 21:47 vmware-root

Seems to have been caused by this commit by @mitchellh hashicorp/vagrant@155516f

Specifically this block of code

            if existing_set.include?(remote_path)
              @logger.debug("Not sharing #{local_path}, exists as #{remote_path}")
              next

Wondering if my Ubuntu box isn't clearing the /tmp directory quick enough during boot.

I'll get this issue created over on Vagrant issue tracker tomorrow.

Seems someone has already beaten me to it
hashicorp/vagrant#5200