hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.25k stars 4.43k forks source link

Network Error after upgrade to 1.8.7 #8024

Closed nrganeshbabu closed 7 years ago

nrganeshbabu commented 7 years ago

Vagrant version

Vagrant 1.8.7

Host operating system

Windows 10 Pro version 1511

Guest operating system

centos-70-x86_64

Vagrantfile

# Copy-paste your Vagrantfile here
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
    #config.ssh.private_key_path = "C:\\Users\\gb\\centos-7.0-x86_64\\vagrant_private_key.ppk"  
    #config.ssh.forward_agent = true    
    config.ssh.username = "vagrant"
    config.ssh.password = "vagrant"
    config.ssh.insert_key = false

  # Multi Machine config

    config.vm.define "master" do |master|
    master.vm.box = "centos7"
    master.vm.network "private_network", ip: "192.168.33.11", :adapter => 2 
    master.vm.hostname = "master"
    end

    config.vm.define "web1" do |web1|
    web1.vm.box = "centos7"
    web1.vm.network "private_network", ip: "192.168.33.12", :adapter => 2
    web1.vm.hostname = "web1"
    end

    config.vm.define "db" do |db|
    db.vm.box = "centos7"
    db.vm.network "private_network", ip: "192.168.33.13", :adapter => 2 
    db.vm.hostname = "db"
    end

  config.ssh.insert_key = false  
  config.vm.box = "centos7"

  #config.vm.network "private_network", ip: "192.168.33.10"

   config.vm.provider "virtualbox" do |vb|
    #vb.gui = true
     vb.memory = 4096
     vb.cpus = 2
   end  
end

Please note, if you are using Homestead or a different Vagrantfile format, we may be unable to assist with your issue. Try to reproduce the issue using a vanilla Vagrantfile first.

Debug output

==> master: Configuring and enabling network interfaces... The following SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed!

Down the interface before munging the config file. This might

fail if the interface is not actually set up yet so ignore

errors.

/sbin/ifdown 'enp0s8'

Move new config into place

mv -f '/tmp/vagrant-network-entry-enp0s8-1479653162-0' '/etc/sysconfig/network-scripts/ifcfg-enp0s8'

attempt to force network manager to reload configurations

nmcli c reload || true

Restart network

service network restart

Stdout from the command:

Restarting network (via systemctl): [FEHLGESCHLAGEN]

Stderr from the command:

Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

C:\Users\gb\centos-7.0-x86_64>

Expected behavior

Should create the three VMs. It was working fine on Vagrant version 1.8.6

Actual behavior

After upgrade to Vagrant 1.8.7 the above error appears.

Steps to reproduce

  1. Run the vagrantfile on Vagrant version 1.8.6
  2. Run the vagrantfile on Vagrant version 1.8.7

References

pporada-gl commented 7 years ago

I hit the same thing now. Here's a better formatted error log. Host machine is Ubuntu 16.04 running a Centos7 VM.

Vagrant is 1.8.7

==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

# Down the interface before munging the config file. This might
# fail if the interface is not actually set up yet so ignore
# errors.
/sbin/ifdown 'eth1'
# Move new config into place
mv -f '/tmp/vagrant-network-entry-eth1-1479764565-0' '/etc/sysconfig/network-scripts/ifcfg-eth1'
# attempt to force network manager to reload configurations
nmcli c reload || true

# Restart network
service network restart

Stdout from the command:

Restarting network (via systemctl):  [FAILED]

Stderr from the command:

usage: ifdown <configuration>
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
tomasquith commented 7 years ago

I'm getting the same issue with CentOS 7.2 guests on Vagrant 1.8.7, OSX Sierra

pporada-gl commented 7 years ago

This "fixed" the issue for me, so something is wrong in the new commits to v1.8.7.

# Uninstall Vagrant v1.8.7
# Install Vagrant v1.8.6
sudo su -
cd /opt/vagrant/embedded/gems/gems/vagrant-1.8.6/plugins/guests/linux/cap
mv network_interfaces.rb network_interfaces.rb-PRE-PATCH
wget https://raw.githubusercontent.com/chrisroberts/vagrant/a8970281ced199a43ca9b0a4d5b0b97aff02a2e2/plugins/guests/linux/cap/network_interfaces.rb
andydude commented 7 years ago

Same issue with Vagrant 1.8.7 on Mac OS X 10.10.5 http://pastie.org/10968105#22

kikitux commented 7 years ago

Hi, could be something in guest cap.

I did try with alvaro/centos7 couldn't repoduce. My box use eth0 / eth1

cwen0 commented 7 years ago

I hit the same error with CentOS 7 guests on Vagrant 1.8.7, Ubuntu 14.04. Vagrant 1.8.6 is ok.

arnarpall commented 7 years ago

I have a similar issue. Vagrant box running a host-only-interface.

My box runs multiple services and in our case it seems to affect the ones where docker has setup NAT rules to all interfaces.

Starting the box on Vagrant 1.8.7

Host is up (0.0027s latency). rDNS record for 192.168.33.3: ssa2 Not shown: 986 closed ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 443/tcp open https 1521/tcp filtered oracle <----- docker container 3000/tcp open ppp 5000/tcp open upnp 8009/tcp open ajp13 8010/tcp open xmpp 8080/tcp open http-proxy

Starting the box on Vagrant 1.8.6 Host is up (0.0027s latency). rDNS record for 192.168.33.3: ssa2 Not shown: 986 closed ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 443/tcp open https 1521/tcp open oracle <----- works fine here 3000/tcp open ppp 5000/tcp open upnp 8009/tcp open ajp13 8010/tcp open xmpp 8080/tcp open http-proxy

Attaching the configuring and enabling interfaces logs for bot versions vagrant-1.8.6.txt vagrant-1.8.7.txt

geerlingguy commented 7 years ago

Same issue with Vagrant 1.9.0 and CentOS 7 box (geerlingguy/centos7) used in Drupal VM project defaults: https://github.com/geerlingguy/drupal-vm/blob/master/Vagrantfile

$ vagrant up
Bringing machine 'drupalvm' up with 'virtualbox' provider...
==> drupalvm: Importing base box 'geerlingguy/centos7'...
==> drupalvm: Matching MAC address for NAT networking...
==> drupalvm: Checking if box 'geerlingguy/centos7' is up to date...
==> drupalvm: Setting the name of the VM: drupalvm.dev
==> drupalvm: Fixed port collision for 22 => 2222. Now on port 2200.
==> drupalvm: Clearing any previously set network interfaces...
==> drupalvm: Preparing network interfaces based on configuration...
    drupalvm: Adapter 1: nat
    drupalvm: Adapter 2: hostonly
==> drupalvm: Forwarding ports...
    drupalvm: 22 (guest) => 2200 (host) (adapter 1)
==> drupalvm: Running 'pre-boot' VM customizations...
==> drupalvm: Booting VM...
==> drupalvm: Waiting for machine to boot. This may take a few minutes...
    drupalvm: SSH address: 127.0.0.1:2200
    drupalvm: SSH username: vagrant
    drupalvm: SSH auth method: private key
    drupalvm: Warning: Remote connection disconnect. Retrying...
    drupalvm: Warning: Remote connection disconnect. Retrying...
    drupalvm: Warning: Remote connection disconnect. Retrying...
==> drupalvm: Machine booted and ready!
...
==> drupalvm: Setting hostname...
==> drupalvm: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

# Down the interface before munging the config file. This might
# fail if the interface is not actually set up yet so ignore
# errors.
/sbin/ifdown 'enp0s8'
# Move new config into place
mv -f '/tmp/vagrant-network-entry-enp0s8-1480537579-0' '/etc/sysconfig/network-scripts/ifcfg-enp0s8'
# attempt to force network manager to reload configurations
nmcli c reload || true

# Restart network
service network restart

Stdout from the command:

Restarting network (via systemctl):  [FAILED]

Stderr from the command:

usage: ifdown <configuration>
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

(Worked in 1.8.6)

chrisroberts commented 7 years ago

@geerlingguy can you reduce down your Vagrantfile to a minimal representation to reproduce the error you're getting there. I'm using the Vagrantfile below and am not having an issues bringing the instance up. Just not sure if I'm missing something that would be set in your Vagrantfile that would allow me to reproduce. Thanks!

Vagrant.configure('2') do |config|
  config.vm.box = 'geerlingguy/centos7'
  config.vm.network :private_network, ip: '192.168.99.2'
  config.vm.provider 'virtualbox' do |v|
    v.name = 'spox-node'
    v.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
    v.customize ['modifyvm', :id, '--ioapic', 'on']
  end
  config.vm.hostname = 'spox-node'
end
geerlingguy commented 7 years ago

@chrisroberts - Will do! (You were testing with 1.9.0, I presume? That's the first version I noticed this error, I hadn't tested in 1.8.7).

chrisroberts commented 7 years ago

@geerlingguy I'm running off master which is effectively 1.9.0 right now. Thanks!

geerlingguy commented 7 years ago

@chrisroberts - Well... now that I downloaded/installed 1.8.6, then re-upgraded to 1.9.0, I can't reproduce the error at all anymore. Something in the install/downgrade/install process must've knocked things straight? I did have to do a vagrant plugin repair on the first 1.9.0 upgrade.

$ vagrant plugin list
vagrant-cachier (1.2.1)
vagrant-hostsupdater (1.0.2)
vagrant-share (1.1.6, system)
vagrant-vbguest (0.13.0)
chrisroberts commented 7 years ago

@geerlingguy Weird, but good it's sorted! Thanks for confirming.

@nrganeshbabu Can you see if the problematic behavior you're experiencing is still showing up in the 1.9.0 release? Thanks!

m2calabr commented 7 years ago

I found the issue on my boxes. I am running boxes that do not have Network Manager installed. With commit 67f3c8b48cc51c2489d0d9258b778be7355804c2 network manager became required. I think we need to revert that comment and find another solution. Many boxes built with no GUI will not have Network Manager installed.

spoage commented 7 years ago

I am experiencing this problem as well. After upgrading from 1.8.5 to 1.9.1, I can no longer spin up any VMs using the boxes I was originally building on (bento/centos-6.8) because those boxes were not built with the NetworkManager package installed. Specifically, it fails when attempting to run nmcli to force network manager to reload configs - nmcli is not present in the machine.

chrisroberts commented 7 years ago

Hi there,

It looks like this has been resolved within a previously shipped version of Vagrant so I am now closing this issue. If the original issue was not fully resolved, please reopen this issue or create a new one.

Cheers!

m2calabr commented 7 years ago

This issues does not look fixed, looking at the current code. I can test if you would like.

jamieburchell commented 7 years ago

Just hit this upgrading Virtual Box to 5.1.8 and vagrant to 1.9.3

==> base: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

# Down the interface before munging the config file. This might
# fail if the interface is not actually set up yet so ignore
# errors.
/sbin/ifdown 'eth1'
# Move new config into place
mv -f '/tmp/vagrant-network-entry-eth1-1492075149-0' '/etc/sysconfig/network-scripts/ifcfg-eth1'
# attempt to force network manager to reload configurations
nmcli c reload || true

# Restart network
service network restart

Stdout from the command:

Restarting network (via systemctl):  [FAILED]

Stderr from the command:

Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
Apr 13 10:19:07 dev.base.co.uk systemd[1]: Starting LSB: Bring up/down networking...
-- Subject: Unit network.service has begun start-uprdlinking files done ***
-- Defined-By: systemdse.co.uk dracut[8481]: *** Stripping files ***
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel**
--  13 10:17:51 dev.base.co.uk dracut[8481]: *** Generating early-microcode cpio image contents ***
-- Unit network.service has begun starting up.** Constructing GenuineIntel.bin ****
Apr 13 10:19:08 dev.base.co.uk network[1938]: Bringing up loopback interface:  [  OK  ]***
Apr 13 10:19:08 dev.base.co.uk NetworkManager[562]: <info>  [1492075148.4683] audit: op="connection-activate" uuid="8924a5b0-f9f4-453b-910d-118a91dac1ec" name="enp0s3" result="fail" reason="No suitable device found for this connection."
Apr 13 10:19:08 dev.base.co.uk network[1938]: Bringing up interface enp0s3:  Error: Connection activation failed: No suitable device found for this connection.
Apr 13 10:19:08 dev.base.co.uk network[1938]: [FAILED]ed microcode section ***
Apr 13 10:19:08 dev.base.co.uk kernel: IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
Apr 13 10:19:10 dev.base.co.uk kernel: e1000: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
Apr 13 10:19:10 dev.base.co.uk kernel: IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready=======================
Apr 13 10:19:10 dev.base.co.uk NetworkManager[562]: <info>  [1492075150.6583] device (eth1): link connected
Apr 13 10:19:13 dev.base.co.uk network[1938]: Bringing up interface eth1:  [  OK  ]==================================
Apr 13 10:19:13 dev.base.co.uk network[1938]: RTNETLINK answers: File exists         0 Apr 13 10:17 .
Apr 13 10:19:13 dev.base.co.uk network[1938]: RTNETLINK answers: File exists         2 Apr 13 10:17 early_cpio
Apr 13 10:19:13 dev.base.co.uk network[1938]: RTNETLINK answers: File exists         0 Apr 13 10:17 kernel
Apr 13 10:19:13 dev.base.co.uk network[1938]: RTNETLINK answers: File exists         0 Apr 13 10:17 kernel/x86
Apr 13 10:19:13 dev.base.co.uk network[1938]: RTNETLINK answers: File exists         0 Apr 13 10:17 kernel/x86/microcode
Apr 13 10:19:13 dev.base.co.uk network[1938]: RTNETLINK answers: File exists     12288 Apr 13 10:17 kernel/x86/microcode/GenuineIntel.bin
Apr 13 10:19:13 dev.base.co.uk network[1938]: RTNETLINK answers: File exists=========================================
Apr 13 10:19:13 dev.base.co.uk network[1938]: RTNETLINK answers: File exists
Apr 13 10:19:13 dev.base.co.uk network[1938]: RTNETLINK answers: File exists
Apr 13 10:19:13 dev.base.co.uk systemd[1]: network.service: control process exited, code=exited status=1
Apr 13 10:19:13 dev.base.co.uk systemd[1]: Failed to start LSB: Bring up/down networking.
-- Subject: Unit network.service has failed: dracut modules:
-- Defined-By: systemdse.co.uk dracut[8481]: bash
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--  13 10:18:01 dev.base.co.uk dracut[8481]: *** Creating initramfs image file '/boot/initramfs-3.10.0-514.10.2.el7.x86_64.img' done ***
-- Unit network.service has failed..33.10 closed by remote host.
-- nection to 192.168.33.10 closed.
-- The result is failed.d/web$ ssh vagrant
Apr 13 10:19:13 dev.base.co.uk systemd[1]: Unit network.service entered failed state.
Apr 13 10:19:13 dev.base.co.uk systemd[1]: network.service failed.
Vagrant.configure(2) do |config|

    # General settings
    config.vm.box = "ib3-centos7-0.0.3"
    config.vm.hostname = "dev.base.co.uk"
    config.vm.define "base"
    config.vm.network "private_network", ip: "192.168.33.10", name: "VirtualBox Host-Only Ethernet Adapter #2"

    config.vm.provider "virtualbox" do |vb|
      vb.customize ["modifyvm", :id, "--memory", "2048"]
      vb.customize ["modifyvm", :id, "--cpus", "1"]
      vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
      vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    end
end
jamieburchell commented 7 years ago

Oh boy. What world of pain have I opened now. Trying to downgrade to 1.8.1 and can't install any plugins

$ vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

Checksum of /versions does not match the checksum provided by server! Something is wrong.

Warning: this Gemfile contains multiple primary sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. To upgrade this warning to an error, run `bundle config disable_multisource true`.
jamieburchell commented 7 years ago

Downgraded to 1.8.6 and "resolved" both issues.

ghost commented 4 years ago

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.