vagrant icon indicating copy to clipboard operation
vagrant copied to clipboard

vagrant 2.2.19 nfs folders uninitialized constant error on Mac OS

Open stolowski opened this issue 2 years ago • 26 comments

Vagrant version

Vagrant 2.2.19 vagrant-vmware-desktop (3.0.1, global)

Host operating system

Mac OS 11.6

Guest operating system

Ubuntu Linux

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "bento/ubuntu-20.04"
  config.vm.hostname = "focal"
  config.vm.define "ubuntu-focal" 
  config.vm.network "public_network"
  config.vm.synced_folder "/Users/pawel/go/src", "/home/vagrant/go/src", type: "nfs", nfs_export: true
  config.vm.provision "shell", path: "snapd-prep.sh"
  config.vm.provision "file", source: "~/.config/gcloud", destination: "$HOME/.config/gcloud"
  config.vm.provider "vmware_desktop" do |v|
    v.vmx["memsize"] = "16384"
    v.vmx["numvcpus"] = "4"
    v.vmx["mks.enable3d"] = false
    v.ssh_info_public = true
  end
end

Actual behavior

vagrant up fails with a traceback right after "Exporting NFS shared folders...". The last line of the traceback is: /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb:20:in `resolve_host_path': uninitialized constant VagrantPlugins::HostDarwin::Cap::Version (NameError)

Full traceback: https://gist.github.com/stolowski/bc2e8e0d96540047c575e6c78e5fd530

stolowski avatar Nov 09 '21 08:11 stolowski

Same here

nlemoine avatar Nov 09 '21 09:11 nlemoine

well, given that https://github.com/hashicorp/vagrant/pull/12581 was already merged upstream until a new release is issued hotfix for those of us affected is just to replace /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb by full contents of https://raw.githubusercontent.com/hashicorp/vagrant/42db2569e32a69e604634462b633bb14ca20709a/plugins/hosts/darwin/cap/path.rb ...

hope this helps.

AntonioMeireles avatar Nov 09 '21 10:11 AntonioMeireles

Ah, it's great the fix already landed, I missed the first report about this problem because it got addressed so fast and closed... Might make sense to keep this issue open until the fix gets released to avoid more reports of this problem. Thank you for pointing at the hotfix.

stolowski avatar Nov 09 '21 10:11 stolowski

thanks @AntonioMeireles! I finally stumbled upon the fix and applied it. Works fine now!

nlemoine avatar Nov 09 '21 10:11 nlemoine

https://github.com/hashicorp/vagrant/issues/12583#issuecomment-964002289 worked great for me! Thank you.

drfuzetto avatar Nov 12 '21 19:11 drfuzetto

One-liner to apply #12581

sudo curl -o /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb https://raw.githubusercontent.com/hashicorp/vagrant/42db2569e32a69e604634462b633bb14ca20709a/plugins/hosts/darwin/cap/path.rb 

christopher-hopper avatar Nov 22 '21 04:11 christopher-hopper

@christopher-hopper I'm trying the fix in https://github.com/hashicorp/vagrant/issues/12583#issuecomment-975070111 from Mac OS 11.6, Vagrant 2.2.19 and I'm getting a no such file or directory error.

❯ sudo curl -o /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb \
 https://raw.githubusercontent.com/hashicorp/vagrant/42db2569e32a69e604634462b633bb14ca20709a/plugins/hosts/darwin/cap/path.rb
curl: (3) URL using bad/illegal format or missing URL
zsh: no such file or directory: https://raw.githubusercontent.com/hashicorp/vagrant/42db2569e32a69e604634462b633bb14ca20709a/plugins/hosts/darwin/cap/path.rb

Do I need to be on Mac OS 12.0.1 for this to work? I may try to just manually replace the file after lunch. 🤔

kojoidrissa avatar Dec 03 '21 18:12 kojoidrissa

@christopher-hopper Nvmdn, I forgot to adjust for the line break character. So:

sudo curl -o /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb https://raw.githubusercontent.com/hashicorp/vagrant/42db2569e32a69e604634462b633bb14ca20709a/plugins/hosts/darwin/cap/path.rb

worked just fine. 👍🏾

kojoidrissa avatar Dec 03 '21 19:12 kojoidrissa

As usual a MacOs upgrade caused a Vagrant issue for me - this one specifically - and also as usual someone within the community came through and figured out how to fix it. Thanks @AntonioMeireles and @kojoidrissa , this fixed my issue updating to Monterey. 👍

switch120 avatar Dec 14 '21 19:12 switch120

I was aware of this issue and did not upgrade to Monterey yet (besides other problems).

I'm still on 10.15.7 macOS Catalina and today I was also hit by this?!

+ $ vagrant --version
Vagrant 2.2.19
+ $ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/ubuntu-18.04' version '202110.25.0' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Exporting NFS shared folders...
Traceback (most recent call last):
	106: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/batch_action.rb:86:in `block (2 levels) in run'
…
	  1: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/capability_host.rb:111:in `call'
/opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb:20:in `resolve_host_path': uninitialized constant VagrantPlugins::HostDarwin::Cap::Version (NameError)

Before blindly running curl commands I checked the diff and it looks sane:

+ $ diff -u /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb.backup-20220104 path.rb
--- /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb.backup-20220104	2022-01-04 12:35:09.000000000 +0100
+++ path.rb	2022-01-04 12:35:21.000000000 +0100
@@ -17,7 +17,8 @@
         def self.resolve_host_path(env, path)
           path = File.expand_path(path)
           # Only expand firmlink paths on Catalina
-          return path if !CATALINA_CONSTRAINT.satisfied_by?(Cap::Version.version(env))
+          host_version = env.host.capability(:version)
+          return path if !CATALINA_CONSTRAINT.satisfied_by?(host_version)

           firmlink = firmlink_map.detect do |mount_path, data_path|
             path.start_with?(mount_path)

TL;DR: like for many others before here, this change worked for me!

Still unclear why my system on Catalina was subject to this problem 😞

mfn avatar Jan 04 '22 11:01 mfn

I can confirm that this affects Catalina, too, as I'm on 10.15.7 and experienced the same problem. The patch worked perfectly.

andronocean avatar Jan 06 '22 23:01 andronocean

It doesn't appear to fix Bg Sur - any ideas?

mspacemedia avatar Jan 12 '22 16:01 mspacemedia

@mspacemedia the replace of path.rb fixed it for me on Big Sur 11.6.1

develth avatar Jan 13 '22 10:01 develth

well, given that #12581 was already merged upstream until a new release is issued hotfix for those of us affected is just to replace /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb by full contents of https://raw.githubusercontent.com/hashicorp/vagrant/42db2569e32a69e604634462b633bb14ca20709a/plugins/hosts/darwin/cap/path.rb ...

hope this helps.

This works. I am on macOS Monterey and using Vagrant 2.2.19

5zurcaledgj avatar Jan 30 '22 17:01 5zurcaledgj

Considering the fix has already been merged, how long will it take for this to be released? It's been months now since the fix.

D3strukt0r avatar Feb 07 '22 11:02 D3strukt0r

sudo curl -o /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb \ 

Thanks @kojoidrissa it worked for me!.

jayakrishnanj avatar Feb 09 '22 17:02 jayakrishnanj

One-liner to apply #12581

sudo curl -o /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb https://raw.githubusercontent.com/hashicorp/vagrant/42db2569e32a69e604634462b633bb14ca20709a/plugins/hosts/darwin/cap/path.rb 

Worked for me on Big Sur (Mac OS 11.6.4) and Vagrant v2.2.19. Thanks!

samheuck avatar Feb 16 '22 21:02 samheuck

Thanks @kojoidrissa

Worked for me on Monterey + Vagrant 2.2.19

bvdputte avatar Mar 08 '22 22:03 bvdputte

One-liner to apply #12581

sudo curl -o /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb https://raw.githubusercontent.com/hashicorp/vagrant/42db2569e32a69e604634462b633bb14ca20709a/plugins/hosts/darwin/cap/path.rb 

Thanks works for me MacOS Monterey

sanjibnarzary avatar Apr 24 '22 17:04 sanjibnarzary

How is this not released yet? This issue was opened six months ago.

zdennis avatar Apr 30 '22 12:04 zdennis

One-liner da applicare #12581

sudo curl -o /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/plugins/hosts/darwin/cap/path.rb https://raw.githubusercontent.com/hashicorp/vagrant/ 42db2569e32a69e604634462b633bb14ca20709a/plugins/hosts/darwin/cap/path.rb

Ha funzionato per me su Big Sur (Mac OS 11.6.4) e Vagrant v2.2.19. Grazie!

I have the same problem with Big Sur and 2.2.19, the command executed from the terminal, executed correctly but continues to give me the same error. could you tell me the correct file that I try to modify it manually?

astratto-agency avatar May 14 '22 00:05 astratto-agency

i just upgraded to Monterey but even with this upgrade it doesn't work. Checking Trellis requirements... Required: [✓] Python [>= 3.8.0]: 3.10.0 Optional: [✓] Vagrant [>= 2.1.0]: 2.2.19 [✓] VirtualBox [>= 4.3.10]: 6.1.34r150636

astratto-agency avatar May 14 '22 10:05 astratto-agency

@astratto-agency said:

have the same problem with Big Sur and 2.2.19, the command executed from the terminal, executed correctly but continues to give me the same error. could you tell me the correct file that I try to modify it manually?

see the diff at #12581

christopher-hopper avatar May 25 '22 02:05 christopher-hopper

The one-line fix by @christopher-hopper worked great on macOS Catalina. Why is this not in the release?

felixstoessel avatar May 29 '22 13:05 felixstoessel

Please release this I just wasted days of my life trying to figure out what was going on. Fixed the issue on Monterey.

g-brizolier avatar Jun 22 '22 20:06 g-brizolier

@chrisroberts Apologies for the direct ping, but it looks like you're the Hashicorp team member who's been most actively contributing to Vagrant lately. Is there any way a patch release could be made in the near future, so this bug stops biting people? The fix for it was merged back in November and has been proven to work — so it really is just a matter of getting a new release out. We'd all really appreciate it!

andronocean avatar Jun 23 '22 22:06 andronocean

Hey there, this fix has been shipped with Vagrant 2.3.0 🎉

soapy1 avatar Feb 27 '23 22:02 soapy1