vagrant
vagrant copied to clipboard
vagrant 2.2.19 nfs folders uninitialized constant error on Mac OS
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
Same here
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.
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.
thanks @AntonioMeireles! I finally stumbled upon the fix and applied it. Works fine now!
https://github.com/hashicorp/vagrant/issues/12583#issuecomment-964002289 worked great for me! Thank you.
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
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. 🤔
@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. 👍🏾
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. 👍
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 😞
I can confirm that this affects Catalina, too, as I'm on 10.15.7 and experienced the same problem. The patch worked perfectly.
It doesn't appear to fix Bg Sur - any ideas?
@mspacemedia the replace of path.rb fixed it for me on Big Sur 11.6.1
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.rbby full contents ofhttps://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
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.
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!.
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!
Thanks @kojoidrissa
Worked for me on Monterey + Vagrant 2.2.19
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
How is this not released yet? This issue was opened six months ago.
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.rbHa 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?
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 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
The one-line fix by @christopher-hopper worked great on macOS Catalina. Why is this not in the release?
Please release this I just wasted days of my life trying to figure out what was going on. Fixed the issue on Monterey.
@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!
Hey there, this fix has been shipped with Vagrant 2.3.0 🎉