Closed uchagani closed 7 years ago
@uchagani what metadata.json
are you referring to? Could you please post your Vagrantfile
as well? What version of Vagrant (vagrant -v
)?
The metadata.json
that vagrant package
adds when you package a base box. For my two boxes that I created metadata.json
says: {"provider":"virtualbox"}
After I installed the vmware plugin, I started noticing the behavior above.
Base Box Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.communicator = "winrm"
config.vm.box = "base"
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.network "forwarded_port", host: 3389, guest: 3389, auto_correct: true
config.vm.network "public_network", id: "p-network", bridge: "Broadcom BCM5709C NetXtreme II GigE (NDIS VBD Client) #60"
end
end
Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.define "controller" do |controller|
controller.vm.provider "virtualbox" do |vb|
vb.name = controller.vm.hostname
end
end
config.vm.define "client" do |client|
client.vm.provider "virtualbox" do |vb|
vb.name = client.vm.hostname
end
end
end
Thank you @uchagani. I will try to get a reproduction case.
This is correct. Vagrant core chooses a provider before it reads the box. Available boxes is not taken into account in choosing the box. This sounds like a decent feature request, though.
Is it possible for vagrant to see what box the user is spinning up and choose that provider?
For example, if I have both VirtualBox and VMWare boxes registered in vagrant, but my vagrant file is referencing the VirtualBox boxes, then virtual box provider is used.
@uchagani Not in the current flow of things.
Technically, of course, but it would require a bit of a rearchitecture of how Vagrant works internally.
I'm seeing possibly the same problem. I have the following Vagrantfiles.
When I try to bring up both containers via vagrant up I get:
An error occurred while executing multiple actions in parallel.
Any errors that occurred are shown below.
An error occurred while executing the action on the 'socat'
machine. Please handle this error then try again:
The box you're attempting to add doesn't support the provider
you requested. Please find an alternate box or use an alternate
provider. Double-check your requested provider to verify you didn't
simply misspell it.
If you're adding a box from HashiCorp's Atlas, make sure the box is
released.
Name: ubuntu/trusty64
Address: https://atlas.hashicorp.com/ubuntu/trusty64
Requested provider: ["vmware_desktop", "vmware_fusion", "vmware_workstation"]
An error occurred while executing the action on the 'pv'
machine. Please handle this error then try again:
The box you're attempting to add doesn't support the provider
you requested. Please find an alternate box or use an alternate
provider. Double-check your requested provider to verify you didn't
simply misspell it.
If you're adding a box from HashiCorp's Atlas, make sure the box is
released.
Name: ubuntu/trusty64
Address: https://atlas.hashicorp.com/ubuntu/trusty64
Requested provider: ["vmware_desktop", "vmware_fusion", "vmware_workstation"]
The strangest thing is that when I try to bring up the machine using the Vagrantfile referred to in d.vagrant_vagrantfile
on its own I get similar error:
Bringing machine 'dockerhost' up with 'vmware_fusion' provider...
==> dockerhost: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
dockerhost: Box Provider: vmware_desktop, vmware_fusion, vmware_workstation
dockerhost: Box Version: >= 0
==> dockerhost: Loading metadata for box 'ubuntu/trusty64'
dockerhost: URL: https://atlas.hashicorp.com/ubuntu/trusty64
The box you're attempting to add doesn't support the provider
you requested. Please find an alternate box or use an alternate
provider. Double-check your requested provider to verify you didn't
simply misspell it.
If you're adding a box from HashiCorp's Atlas, make sure the box is
released.
Name: ubuntu/trusty64
Address: https://atlas.hashicorp.com/ubuntu/trusty64
Requested provider: ["vmware_desktop", "vmware_fusion", "vmware_workstation"]
Basically, looks like when you have installed vmware fusion plugin you are doomed :-)
+1
@uchagani did you figure out a workaround for this?
@xacaxulu you can provide the --provider
flag to force a specific provider.
@milosgajdos83, I just ran into the same thing as you... was trying to move from VirtualBox to VMware Fusion, and had the following Vagrantfile:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "development", autostart: false do |dev|
dev.vm.box = "ubuntu/precise64"
dev.vm.provider "vmware_fusion" do |v|
v.memory = 512
end
dev.vm.provision "ansible" do |ansible|
ansible.playbook = "vagrant-provision.yml"
end
end
end
Attempting to up the development machine gives:
$ vagrant up development
Bringing machine 'development' up with 'vmware_fusion' provider...
==> development: Box 'ubuntu/precise64' could not be found. Attempting to find and install...
development: Box Provider: vmware_desktop, vmware_fusion, vmware_workstation
development: Box Version: >= 0
==> development: Loading metadata for box 'ubuntu/precise64'
development: URL: https://atlas.hashicorp.com/ubuntu/precise64
The box you're attempting to add doesn't support the provider
you requested. Please find an alternate box or use an alternate
provider. Double-check your requested provider to verify you didn't
simply misspell it.
If you're adding a box from HashiCorp's Atlas, make sure the box is
released.
Name: ubuntu/precise64
Address: https://atlas.hashicorp.com/ubuntu/precise64
Requested provider: ["vmware_desktop", "vmware_fusion", "vmware_workstation"]
Looking at the atlas site (https://vagrantcloud.com/ubuntu/boxes/precise64), I see that ubuntu/precise64 does not support the vmware_fusion provider. Using hashicorp/precise64 (https://vagrantcloud.com/hashicorp/boxes/precise64) instead does work. So I changed the Vagrantfile to:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "development", autostart: false do |dev|
dev.vm.box = "hashicorp/precise64"
dev.vm.provider "vmware_fusion" do |v|
v.memory = 512
end
dev.vm.provision "ansible" do |ansible|
ansible.playbook = "vagrant-provision.yml"
end
end
end
Now vagrant up development
works:
$ vagrant up development
Bringing machine 'development' up with 'vmware_fusion' provider...
==> development: Box 'hashicorp/precise64' could not be found. Attempting to find and install...
development: Box Provider: vmware_desktop, vmware_fusion, vmware_workstation
development: Box Version: >= 0
==> development: Loading metadata for box 'hashicorp/precise64'
development: URL: https://atlas.hashicorp.com/hashicorp/precise64
==> development: Adding box 'hashicorp/precise64' (v1.1.0) for provider: vmware_fusion
development: Downloading: https://vagrantcloud.com/hashicorp/boxes/precise64/versions/1.1.0/providers/vmware_fusion.box
==> development: Successfully added box 'hashicorp/precise64' (v1.1.0) for 'vmware_fusion'!
==> development: Cloning VMware VM: 'hashicorp/precise64'. This can take some time...
==> development: Checking if box 'hashicorp/precise64' is up to date...
==> development: Verifying vmnet devices are healthy...
==> development: Preparing network adapters...
==> development: Starting the VMware VM...
==> development: Waiting for machine to boot. This may take a few minutes...
development: SSH address: XX.XX.XX.XX:22
development: SSH username: XXXX
development: SSH auth method: private key
development:
development: Vagrant insecure key detected. Vagrant will automatically replace
development: this with a newly generated keypair for better security.
development:
development: Inserting generated public key within guest...
development: Removing insecure key from the guest if its present...
development: Key inserted! Disconnecting and reconnecting using new SSH key...
==> development: Machine booted and ready!
==> development: Forwarding ports...
development: -- 22 => 2222
==> development: Configuring network adapters within the VM...
==> development: Waiting for HGFS kernel module to load...
==> development: Enabling and configuring shared folders...
development: -- /Users/XXXXX/XXXX/XXXXX: /vagrant
==> development: Running provisioner: ansible...
Certainly not related to the original post, but thought it might help others...
Yeah that works but we want trusty, not precise. I'm already regretting the vmware plugin, it's pretty much useless since most boxes are for the default vbox provider.
I'm having similar problems. now that I've installed the vmware provider, vagrant always wants to use vmware unless I use the --provider flag explicitly.
It'd be nice to be able to set a default provider so I do'nt go through a lot of false starts.
@chasrmartin you can set a default provider. Just add this to your .bashrc or whatever:
export VAGRANT_DEFAULT_PROVIDER=virtualbox # chooses virtualbox as the default provider
Hope that helps.
I have solved this problem either with
export VAGRANT_DEFAULT_PROVIDER=virtualbox
environment variable or by using the CLI flag:
vagrant up --provider virtualbox
however it is very surprising to me that my Vagrantfile
setting is not sufficient:
config.vm.provider "virtualbox"
Can anyone comment?
I had some success with this code fragment:
Vagrant.configure(2) do |config|
config.vm.provider "virtualbox" do |v| v.gui = true end
config.vm.provider "vmware_fusion" do |v| v.gui = true end
but didn't explore it further because I wasn't happy with Vmware anyway so uninstalled the plugin.
On Thu, Jan 21, 2016 at 4:20 PM, Ian Stokes-Rees notifications@github.com wrote:
I have solved this problem either with
export VAGRANT_DEFAULT_PROVIDER=virtualbox
environment variable or by using the CLI flag:
vagrant up --provider virtualbox
however it is very surprising to me that my Vagrantfile setting is not sufficient:
config.vm.provider "virtualbox"
Can anyone comment?
— Reply to this email directly or view it on GitHub https://github.com/mitchellh/vagrant/issues/4654#issuecomment-173747041.
+1 I (guessing it wasnt intentional) used to be able to vagrant up
If anyone has any trouble with this, add the following to the top of your Vagrantfile
:
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox'
This should be fixed now via #7756. Please let me know if you are still experiencing this issue. Thanks!
@chrisroberts I have verified (with Vagrant 1.8.7 and vagrant-vmware-fusion 4.0.14). The issue is still present: By default, the VMware provider is automatically selected (even if the base box does not support it).
@gildegoma Okay, thanks for the confirmation! I'll have a look today and see if it's something that can be easily fixed up.
After getting this reproduced locally, it is "partially" fixed based on expectations described within this issue. #7756 fixed the provider selection when "hinted" by the Vagrantfile
. This means that:
Vagrant.configure(2) do |config|
config.vm.box = 'hashicorp/precise64'
end
will result in a provider of vmware
. If we hint the provider:
Vagrant.configure(2) do |config|
config.vm.box = 'hashicorp/precise64'
config.vm.provider :virtualbox
end
this will result in virtualbox
as the provider. This still doesn't help for a box that doesn't support the selected provider, so I'm digging into that.
The modifications required for doing detection on the box metadata to choose a supported provider is much more intensive than the benefit gained. If anyone wants to provide a PR for it, I will be happy to help with reviews and guidance. At this point, however, the changes required are too drastic for a small gain where setting the provider explicitly via CLI flag or defaulting it via env var is easy enough. Cheers!
I wouldn't call this one a "small gain". I think it is the opposite, to be honest. I am dumbfounded every time I run into this issue. I have a VirtualBox box, but Vagrant crash and whines on up
and says he can't start the box with VMware. I'm like, "yeah, who the f### asked you too?" Really, it's like putting in the first gear in the car and when you hit the gas pedal the car reverses.
The fact that the box itself is not taken into account when selecting which provider to run with is a bit of a handicap which I think we can all agree too. I totally understand that sometimes what appears like a small change can require lots of work and big architectural changes. But why close the issue as if it has gone away? This is a real handicap for Vagrant, a sort of "laughable" one if you ask me. We should at least leave it open and let it gain some attraction. And I think that even without a PR from the outside, Hashicorp should want to fix this issue sooner or later.
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.
Boxes were created for virtualbox and the vagrant file configures for virtualbox but because I have the vmware_workstation plugin installed, it always defaults to that.
I would think that if metadata.json specifies virtualbox and the vagrant file configures for virtualbox i shouldn't have to force vagrant up with the --provider flag.