vagrant up 报VirtualBox错误

Debug output

$ $ vagrant.exe up
==> default: Checking if box 'janihur/ubuntu-1404-desktop' is up to date...
==> default: Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["modifyvm", "60a76137-2c0e-46ab-a50e-7a37a6865051", "--nic2", "none", "--nic3", "none", "--nic4", "none", "--nic5", "none", "--nic6", "none", "--nic7", "none", "--nic8", "none", "--nic9", "none", "--nic10", "none", "--nic11", "none", "--nic12", "none", "--nic13", "none", "--nic14", "none", "--nic15", "none", "--nic16", "none", "--nic17", "none", "--nic18", "none", "--nic19", "none", "--nic20", "none", "--nic21", "none", "--nic22", "none", "--nic23", "none", "--nic24", "none", "--nic25", "none", "--nic26", "none", "--nic27", "none", "--nic28", "none", "--nic29", "none", "--nic30", "none", "--nic31", "none", "--nic32", "none", "--nic33", "none", "--nic34", "none", "--nic35", "none", "--nic36", "none"]

Stderr: VBoxManage.exe: error: Invalid NIC number 9
VBoxManage.exe: error: Invalid NIC number 10
VBoxManage.exe: error: Invalid NIC number 11
VBoxManage.exe: error: Invalid NIC number 12
VBoxManage.exe: error: Invalid NIC number 13
VBoxManage.exe: error: Invalid NIC number 14
VBoxManage.exe: error: Invalid NIC number 15
VBoxManage.exe: error: Invalid NIC number 16
VBoxManage.exe: error: Invalid NIC number 17
VBoxManage.exe: error: Invalid NIC number 18
VBoxManage.exe: error: Invalid NIC number 19
VBoxManage.exe: error: Invalid NIC number 20
VBoxManage.exe: error: Invalid NIC number 21
VBoxManage.exe: error: Invalid NIC number 22
VBoxManage.exe: error: Invalid NIC number 23
VBoxManage.exe: error: Invalid NIC number 24
VBoxManage.exe: error: Invalid NIC number 25
VBoxManage.exe: error: Invalid NIC number 26
VBoxManage.exe: error: Invalid NIC number 27
VBoxManage.exe: error: Invalid NIC number 28
VBoxManage.exe: error: Invalid NIC number 29
VBoxManage.exe: error: Invalid NIC number 30
VBoxManage.exe: error: Invalid NIC number 31
VBoxManage.exe: error: Invalid NIC number 32
VBoxManage.exe: error: Invalid NIC number 33
VBoxManage.exe: error: Invalid NIC number 34
VBoxManage.exe: error: Invalid NIC number 35
VBoxManage.exe: error: Invalid NIC number 36


Confirm the problem. It is reproduced with Windows10/Vagrant 1.8.3/VirtualBox 5.0.20 andhashicorp/precise64 box.

Looks like it is caused by the recent change "Set maximum network adapters to 36 [GH-7293GH-7286]". Indeed if change back max_network_adapters from 36 to 8 atC:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.8.3\plugins\providers\virtualbox\driver\base.rb it starts successfully.

 

OK, I am able to make it works by this fix:
In C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.8.0\lib\vagrant\util\platform.rb, change this method

        def windows_unc_path(path)
          "\\\\?\\" + path.gsub("/", "\\")
        end

to

        def windows_unc_path(path)
          path = path.gsub("/", "\\")
          # Check if the path is drive only (e.g D:/), then return it as-is (e.g D:\\) 
          # since UNC format will cause Protocol error
          if path =~ /^[a-zA-Z]:[\\]$/
            return path + "\\"
          end

          "\\\\?\\" + path
        end

 

posted @ 2016-06-13 22:10  乡村猫  阅读(3013)  评论(0编辑  收藏  举报