Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vagrant fails to find correct network interface under Centos and after installing Docker #7961

Closed
andronat opened this issue Nov 3, 2016 · 4 comments

Comments

@andronat
Copy link

andronat commented Nov 3, 2016

Vagrant version

Vagrant 1.8.6

Host operating system

Mac OS X 10.11.6

Guest operating system

Centos 7

Vagrantfile

$script = <<SCRIPT
yum -y install epel-release
yum -y install yum-fastestmirror git mercurial subversion curl nc gcc net-tools wget vim htop


tee /etc/yum.repos.d/docker.repo <<-'EOF'
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
EOF

yum -y install docker-engine docker-engine-selinux

echo "" > /etc/sysconfig/docker
mkdir -p /etc/systemd/system/docker.service.d
tee /etc/systemd/system/docker.service.d/docker.conf <<-'EOF'
[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon --selinux-enabled -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375
EOF

systemctl daemon-reload
systemctl start docker
systemctl enable docker
SCRIPT



Vagrant.configure("2") do |config|
  config.vbguest.no_install = true

  config.vm.box = "centos/7"

  ip = "10.1.2.3"
  config.vm.network "private_network", ip: ip

  config.vm.provision "shell", inline: $script
end

Debug output

debug info here

Expected behavior

VM should restart normally

Actual behavior

Vagrant hangs and can not connect to the VM

Steps to reproduce

  1. vagrant up
  2. vagrant reload <- hangs

References

No references

Additional info

The first time I use vagrant up, Vagrant creates /etc/sysconfig/network-scripts/ifcfg-eth1 as it should.

But after reload Vagrant overwrites /etc/sysconfig/network-scripts/ifcfg-eth0 with the same content of /etc/sysconfig/network-scripts/ifcfg-eth1. (I saw this through the VirtualBox console)

To be noted: I have vagrant-vbguest disabled

I found that the problem is wrong sorting:

...
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: /sbin/ip -o -0 addr | grep -v LOOPBACK | awk '{print $2}' | sed 's/://' (sudo=true)
DEBUG ssh: Exit status: 0
DEBUG network_interfaces: Unsorted list: ["eth0", "eth1", "docker0"]
DEBUG network_interfaces: Sorted list: ["docker0", "eth0", "eth1"]
DEBUG ssh: Uploading: /var/folders/2k/14hhz7z14nv29v3b07wvwzz0_84k23/T/vagrant-redhat-configure-networks20161102-16633-18xtva2 to /tmp/vagrant-network-entry-eth0-1478137285-0
DEBUG ssh: Re-using SSH connection.
DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: # 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 'eth0' || true

# Move new config into place
mv '/tmp/vagrant-network-entry-eth0-1478137285-0' '/etc/sysconfig/network-scripts/ifcfg-eth0'

# Bring the interface up
ARPCHECK=no /sbin/ifup 'eth0'
 (sudo=true)
...
@amatas
Copy link

amatas commented Nov 3, 2016

Same issue as #7950

@chrisroberts
Copy link
Member

#7866 should have resolved this issue which is in the 1.8.7 release. Please let me know if it does not resolve your issue. Thanks!

@andronat
Copy link
Author

I just checked. Everything works properly!

@ghost
Copy link

ghost commented Apr 3, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants