Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant up fails to start network interface on cloud images

Vagrant fails to bring up ubuntu/vivid32. During start up vagrant tries to connect several times and eventually times out. If I connect to the box via VirtualBox manager ifconfig shows that eth0 is up but no IP is assigned to it. I then do

sudo ifdown eth0 && sudo ifup eth0 

After that, ifconfig shows that eth0 has an IP address. I can then connect from vagrant with vagrant ssh If I power off and power on the guest with VirtualBox manager, the guest comes up ok (with IP address) and vagrant that, ifconfig shows that eth0 has an IP address. I can then connect from vagrant with vagrant ssh.

If I power off and power on the guest with VirtualBox manager, the guest comes up ok (with IP address) and vagrant can connect via vagrant ssh.

If I power off via vagrant (vagrant halt) and power on (vagrant up), I get the same problem (timeout on vagrant side and no IP address) and cannot connect to the guest via vagrant ssh.

While vagrant tries to connect, the guest shows:

cloud-init-nonet[4.54]: waiting 10 seconds for network device
cloud-init-nonet[14.57]: waiting 120 seconds for network device
cloud-init-nonet[134.57]: gave up waiting for a network device

I tried several proposed solutions on the guest side like this.

Whatever I tried didn't help on the vagrant side.

After initial fix to the IP address in the guest, VirtualBox manager can bring the box up and now several times without problem. But if I power off via vagrant (vagrant halt) and power on (vagrant up), I get the same timeout problem and cannot connect to the guest via vagrant ssh. I suspect that "vagrant up" clears the network interface and sets it up again and in this process causes the problem to reappear.

(this also happens with guest: ubuntu/trusty32)

f:\Programs\HashiCorp\Vagrant\bin>vagrant up
Bringing machine 'vivid32' up with 'virtualbox' provider...
==> vivid32: Checking if box 'ubuntu/vivid32' is up to date...
==> vivid32: Clearing any previously set forwarded ports...
==> vivid32: Clearing any previously set network interfaces...
==> vivid32: Preparing network interfaces based on configuration...
    vivid32: Adapter 1: nat
==> vivid32: Forwarding ports...
    vivid32: 22 => 2222 (adapter 1)
==> vivid32: Booting VM...
==> vivid32: Waiting for machine to boot. This may take a few minutes...
    vivid32: SSH address: 127.0.0.1:2222
    vivid32: SSH username: vagrant
    vivid32: SSH auth method: private key
    vivid32: Warning: Connection timeout. Retrying...
    vivid32: Warning: Connection timeout. Retrying...
...
    vivid32: Warning: Connection timeout. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
  • Vagrant 1.7.4
  • VirtualBox - VirtualBox-5.0.0-101573
  • Host - Windows Vista
  • Guest ubuntu/vivid32
like image 203
Avner Moshkovitz Avatar asked Jul 31 '15 06:07

Avner Moshkovitz


1 Answers

For ubuntu/trusty32 at least, the problem appears to be that the default VirtualBox Intel network adapter isn't compatible with the image.

The solution is to change the network adapter to the AMD alternative:

PCnet-FAST III (Am79C973)

You can do this using the VirtualBox UI or by changing you Vagrantfile as shown on this GitHub issue.

like image 191
thisismyrobot Avatar answered Nov 13 '22 14:11

thisismyrobot