Windows 10
Vagrant file is located on Drive E:\Vagrant\ubuntu-trusty-vb
Virtualbox machine folder F:
When vagrant up runs the HardDisk entry in the.vbox files does not get changed to the correct directory and is f:\ubuntu-cloudimg-trusty-vagrant-amd64_1465748344502_5020
instead of the one actually created F:\ubuntu-trusty-vb_default_1465748361721_37792
<HardDisks>
<HardDisk uuid="{e1fce00d-2c78-4d36-9bff-5fcb08ff1b32}" location="f://ubuntu-cloudimg-trusty-vagrant-amd64_1465855041577_18173/box-disk1.vmdk" format="VMDK" type="Normal"/>
</HardDisks>
E:\Vagrant\ubuntu-trusty-vb>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Setting the name of the VM: ubuntu-trusty-vb_default_1465855058236_73527
==> 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: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["startvm", "197fba85-e448-449d-a7d3-14565879a8e4", "--type", "headless"]
Stderr: VBoxManage.exe: error: Could not open the medium 'f:\\ubuntu-cloudimg-trusty-vagrant-amd64_1465855041577_18173\box-disk1.vmdk'.
VBoxManage.exe: error: VD: error VERR_PATH_NOT_FOUND opening image file 'f:\\ubuntu-cloudimg-trusty-vagrant-amd64_1465855041577_18173\box-disk1.vmdk' (VERR_PATH_NOT_FOUND)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component MediumWrap, interface IMedium
Is this a bug or is there something I can change in the vagrantfile or configuration?
Thanks
Ok, this post is quite old but I have recently got this error and it was solved using a workaround. You have to end up set --uartmode1
to disconnected
like following in Vagrant config file:
config.vm.provider "virtualbox" do |v|
v.memory = 4096
v.cpus = 4
v.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
end
Greetings, good luck!
I stumbled upon the same issue. Strange that it hasn't been fixed in these two years.
Essentially, the fix is to apply the patch mention here: https://github.com/hashicorp/vagrant/issues/8275#issuecomment-291031171
The problem - the patch refers to a code fragment in version_5_1.rb file but that code has been moved to version_5_0.rb. This means, you cannot apply the patch as is. In the future, it might change even more, and thus my instructions may become obsolete...
I was too lazy to edit the patch and learn how to apply it properly, so I ended up applying the changes one by one to the relevant files, as described in the patch. On Windows, I had to also change file permissions to give Modify permissions to computer users.
So, the steps are as follows:
open the path where Vagrant Ruby files were installed. For example, C:\Program Files\Vagrant\embedded\gems\2.1.2\gems\vagrant-2.1.2\plugins\providers\virtualbox
open subfolder action
and in give Modify permissions to Users group on files import.rb
and set_name.rb
(permissions can be edited as usual through context menu, in Properties, tab Security, button Edit.., select Users and check the checkbox under Allow for Modify option)
open file import.rb
and replace line
id = env[:machine].provider.driver.import(ovf_file) do |progress|
with
id = env[:machine].provider.driver.import(ovf_file,env) do |progress|
There should be just one line to replace.
open file set_name.rb
and find def call(env)
and add the following lines right under it:
return @app.call(env)
open subfolder driver
and in give Modify permissions to Users group on file version_5_0.rb
open file version_5_0.rb
and replace line
def import(ovf)
with
def import(ovf,env)
in the same file version_5_0.rb
replace line
specified_name = "#{suggested_name}_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
with the following fragment
name = env[:machine].provider_config.name
# If no name was manually set, then use a default
if !name
prefix = "#{env[:root_path].basename.to_s}_#{env[:machine].name}"
prefix.gsub!(/[^-a-z0-9_]/i, "")
# milliseconds + random number suffix to allow for simultaneous
# `vagrant up` of the same box in different dirs
name = prefix + "_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
end
specified_name = "#{name}_#{(Time.now.to_f * 1000.0).to_i}_#{rand(100000)}"
find and delete the broken virtual machine and all of its files on the other disk, and also from .vagrant\machines
folder where you launched vagrant up
command. Then run vagrant up
again.
Now the virtual machine should be created with a proper name and should work normally.
User contributions licensed under CC BY-SA 3.0