Solucionado (ver solução)
Solucionado
(ver solução)
6
respostas

Erro no vagrant up quando a vm.network "private_network", ip: "192.168.50.10"

Quando adiciono a linha:

web_config.vm.network "private_network", ip: "192.168.50.10"

e executo o vagrant up ocorre o seguinte erro:

There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: E_INVALIDARG
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: Assertion failed: [!aInterfaceName.isEmpty()] at 'F:\tinderbox\win-5.1\src\VBox\Main\src-server\HostNetworkInterfaceImpl.cpp' (74) in long __cdecl HostNetworkInterface::init(class com::Bstr,class com::Bstr,class com::Guid,enum __MIDL___MIDL_itf_VirtualBox_0000_0000_0038).
VBoxManage.exe: error: Please contact the product vendor!
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreate(struct HandlerArg *)" at line 71 of file VBoxManageHostonly.cpp
6 respostas

Oi, Jonathas!

Pode colocar o seu Vagrantfile completo aqui para vermos?

Vagrant.configure("2") do |config|
    config.vm.box = "bento/debian-8.6"

    config.vm.define :web do |web_config|
        web_config.vm.network "private_network", ip: "192.168.33.10"
    end

end

Ah, você está usando como box um Debian. Apesar do ubuntu ser Debian based, há algumas diferenças. E provavelmente a interface de rede não está configurada. No site do Vagrant tem uma nota com relação a isso:

Guest operating system support. Private networks generally require configuring the network adapters on the guest machine. This process varies from OS to OS. Vagrant ships with knowledge of how to configure networks on a variety of guest operating systems, but it is possible if you are using a particularly old or new operating system that private networks will not properly configure.

Outra nota é:

The files created by Vagrant depend on the OS. For example, for many Linux distros, this is /etc/network/interfaces. In general you should look in the normal location that network interfaces are configured for your distro.

Eu recomendo que mude a sua box para a do Ubuntu que usamos no curso (hashicorp/precise32) para continuar o curso e, em paralelo, pode procurar entender como funciona a box do Debian para configurar ela direitinho.

Fontes: https://www.vagrantup.com/docs/vagrantfile/machine_settings.html https://www.vagrantup.com/docs/networking/ https://www.vagrantup.com/docs/networking/private_network.html

Troquei a box para a mesma da aula mas o erro persiste

solução!

Jonathas,

Qual é a versão do VirtualBox e do Windows que você está utilizando?

Parece que é um bug:

https://www.virtualbox.org/ticket/14040

No último comentário do bug, tem uma explicação de como fazer funcionar.

Tem um um post também no GitHub sobre esse problema:

https://github.com/docker/machine/issues/1521

Usuários disseram que configuraram um IP fixo e outros desinstalaram o VirtualBox e instalaram novamente para o erro sumir.

Virtualbox: 5.2.12 r112440 Win: 10 Pro

Vou tentar para ver se é o mesmo bug.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software