Vagrant: Vagrant fails to bring private network up after creating it

Created on 20 Dec 2016  路  7Comments  路  Source: hashicorp/vagrant

It seems that Vagrant is failing to bring the private network it creates up after creating it. Looking though the code and commit history I think this is a regression introduced by https://github.com/mitchellh/vagrant/commit/67f3c8b48cc51c2489d0d9258b778be7355804c2

Vagrant versionf

$ vagrant -v
Vagrant 1.9.1

Host operating system

My host is macOS 10.12.2

Guest operating system

I'm running Bento's CentOS 7.2

Vagrantfile

Vagrant.configure("2") do |config|
    config.vm.box = "bento/centos-7.2"
    config.vm.network "private_network", ip: "192.168.100.100"
end

Debug output

Not sure if it's needed, but if so can be provided

Expected behavior

The 2nd network interface is up

Actual behavior

The 2nd network interface is down. (You have to run ifup manually to fix it.)

Steps to reproduce

  1. Create a basic Vagrant file w/ a private network
  2. vagrant up
  3. vagrant ssh and examine the output of ip link show

References

None that I know of

Most helpful comment

I'm running into this as well. It looks like the commit 67f3c8b dropped the ifup on the interface and expects the network manager to bring it up. However, the script that's installed has NM_CONTROLLED=no. If I set that to yes and restart NetworkManager.service then it does bring the device up. So it seems like either ifup needs to be called manually or NM_CONTROLLED needs to be yes.

All 7 comments

I just checked, and this works fine in Vagrant 1.9.0 so it does look like a regression.

I'm running into this as well. It looks like the commit 67f3c8b dropped the ifup on the interface and expects the network manager to bring it up. However, the script that's installed has NM_CONTROLLED=no. If I set that to yes and restart NetworkManager.service then it does bring the device up. So it seems like either ifup needs to be called manually or NM_CONTROLLED needs to be yes.

I have the same problem:

Vagrant version

vagrant -v
Vagrant 1.9.1

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.vm.network "private_network", ip: "192.168.33.10"
end

Command

vagrant up --debug
Log file: https://www.dropbox.com/s/bvsnid3k2mj3mab/vagrant.log?dl=0

Vagrant version

Vagrant 1.9.1

Host operating system

NixOS 16.09.git.3414ae5 (Flounder)

Guest operating system

Red Hat Enterprise Linux Server release 7.3 (Maipo)

Debug output

# 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-1482363723-0' '/etc/sysconfig/network-scripts/ifcfg-eth1'
# attempt to force network manager to reload configurations
nmcli c reload || true

# Restart network (through NetworkManager if running)
if service NetworkManager status 2>&1 | grep -q running; then
  service NetworkManager restart
else
  service network restart
fi

Expected behavior

in this file, /etc/sysconfig/network-scripts/ifcfg-eth1' we should retrieve :

#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
NM_CONTROLLED=yes
(...)

Actual behavior

But, in this file, I /etc/sysconfig/network-scripts/ifcfg-eth1' i got :

#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
NM_CONTROLLED=no
(...)

And, since network-manager is started, my system only restart network managed using NM.

But, when NM_CONTROLLED=no restarting network using service network restart work perfectly.

Steps to reproduce

  1. Configure private interface in Vagrantfile
  2. vagrant up

@dgersting @tpodom @vbalastegui
It should be fix on this pull request : https://github.com/mitchellh/vagrant/issues/8148
For now, I suggest you to use https://releases.hashicorp.com/vagrant/1.9.0/

Fixed via #8148. Thanks for the report!

Been banging my head against the wall all weekend trying to figure out why my eth1 would not start on vagrant up; now i know why. I manually applied the changes here https://github.com/mitchellh/vagrant/pull/8148/files and all works again. thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DreadPirateShawn picture DreadPirateShawn  路  3Comments

dorinlazar picture dorinlazar  路  3Comments

hesco picture hesco  路  3Comments

luispabon picture luispabon  路  3Comments

Cbeck527 picture Cbeck527  路  3Comments