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

Stuck at "Configuring and enabling network interfaces" with CentOS 6.5 #5940

Closed
warrenseine opened this issue Jul 12, 2015 · 18 comments
Closed
Labels
Milestone

Comments

@warrenseine
Copy link

The first vagrant up works as expected, but when I vagrant reload, Vagrant gets stuck at "Configuring and enabling network interfaces".

Issue #1842 shows a similar bahavior and issue #997 suggests removing /etc/udev/rules.d/70-persistent-net.rules and /etc/sysconfig/network-scripts/ifcfg-eth1, but none seems to fix my issue.

I was wondering why Vagrant would try to hack /etc/network/interfaces (see log) while it doesn't exist on CentOS. Maybe that's the problem?

I'm using CentOS 6.5 from chef/centos-6.5, on OS X 10.10 and Vagrant 1.7.2. Network is host-only. This doesn't happen when using the guest is Ubuntu.

My VirtualBox settings are:

vbox.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
vbox.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000]
vbox.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vbox.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
vbox.customize ["modifyvm", :id, "--memory", params["memory"] || 4096]
vbox.customize ["modifyvm", :id, "--cpus", 2]
vbox.customize ["modifyvm", :id, "--ioapic", "on"]
vbox.customize ["modifyvm", :id, "--rtcuseutc", "on"]

Below is the (partial) log of the second connection.

==> local: Setting hostname...
 INFO ssh: Connection errored, not re-using. Will reconnect.
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO ssh: Attempting SSH connection...
 INFO ssh: Attempting to connect to SSH...
 INFO ssh:   - Host: 127.0.0.1
 INFO ssh:   - Port: 2200
 INFO ssh:   - Username: vagrant
 INFO ssh:   - Password? false
 INFO ssh:   - Key Path: ["/path/to/private_key"]
 INFO ssh: SSH is ready!
 INFO ssh: Connection errored, not re-using. Will reconnect.
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO ssh: Attempting SSH connection...
 INFO ssh: Attempting to connect to SSH...
 INFO ssh:   - Host: 127.0.0.1
 INFO ssh:   - Port: 2200
 INFO ssh:   - Username: vagrant
 INFO ssh:   - Password? false
 INFO ssh:   - Key Path: ["/path/to/private_key"]
 INFO ssh: Execute:  (sudo=false)
 INFO guest: Execute capability: change_host_name [#<Vagrant::Machine: local (VagrantPlugins::ProviderVirtualBox::Provider)>, "minko.io.local"] (mint)
 INFO ssh: Connection errored, not re-using. Will reconnect.
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO ssh: Attempting SSH connection...
 INFO ssh: Attempting to connect to SSH...
 INFO ssh:   - Host: 127.0.0.1
 INFO ssh:   - Port: 2200
 INFO ssh:   - Username: vagrant
 INFO ssh:   - Password? false
 INFO ssh:   - Key Path: ["/path/to/private_key"]
 INFO ssh: Execute: hostname -f (sudo=true)
 INFO warden: Calling OUT action: #<Vagrant::Action::Builtin::SetHostname:0x00000100bc0538>
 INFO warden: Calling OUT action: #<VagrantPlugins::ProviderVirtualBox::Action::ForwardPorts:0x00000100bc08f8>
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO interface: info: Configuring and enabling network interfaces...
 INFO interface: info: ==> local: Configuring and enabling network interfaces...
==> local: Configuring and enabling network interfaces...
 INFO ssh: Connection errored, not re-using. Will reconnect.
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO ssh: Attempting SSH connection...
 INFO ssh: Attempting to connect to SSH...
 INFO ssh:   - Host: 127.0.0.1
 INFO ssh:   - Port: 2200
 INFO ssh:   - Username: vagrant
 INFO ssh:   - Password? false
 INFO ssh:   - Key Path: ["/path/to/private_key"]
 INFO ssh: SSH is ready!
 INFO ssh: Connection errored, not re-using. Will reconnect.
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO ssh: Attempting SSH connection...
 INFO ssh: Attempting to connect to SSH...
 INFO ssh:   - Host: 127.0.0.1
 INFO ssh:   - Port: 2200
 INFO ssh:   - Username: vagrant
 INFO ssh:   - Password? false
 INFO ssh:   - Key Path: ["/path/to/private_key"]
 INFO ssh: Execute:  (sudo=false)
 INFO guest: Execute capability: configure_networks [#<Vagrant::Machine: local (VagrantPlugins::ProviderVirtualBox::Provider)>, [{:type=>:static, :adapter_ip=>"192.168.50.1", :ip=>"192.168.50.42", :netmask=>"255.255.255.0", :auto_config=>true, :interface=>1}]] (mint)
 INFO ssh: Connection errored, not re-using. Will reconnect.
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO ssh: Attempting SSH connection...
 INFO ssh: Attempting to connect to SSH...
 INFO ssh:   - Host: 127.0.0.1
 INFO ssh:   - Port: 2200
 INFO ssh:   - Username: vagrant
 INFO ssh:   - Password? false
 INFO ssh:   - Key Path: ["/path/to/private_key"]
 INFO ssh: Execute: sed -e '/^#VAGRANT-BEGIN/,$ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces.pre (sudo=true)
 INFO ssh: Connection errored, not re-using. Will reconnect.
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO ssh: Attempting SSH connection...
 INFO ssh: Attempting to connect to SSH...
 INFO ssh:   - Host: 127.0.0.1
 INFO ssh:   - Port: 2200
 INFO ssh:   - Username: vagrant
 INFO ssh:   - Password? false
 INFO ssh:   - Key Path: ["/path/to/private_key"]
 INFO ssh: Execute: sed -ne '/^#VAGRANT-END/,$ p' /etc/network/interfaces | tail -n +2 > /tmp/vagrant-network-interfaces.post (sudo=true)
 INFO ssh: Connection errored, not re-using. Will reconnect.
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "showvminfo", "dd35a819-555e-4203-9a62-c1d565590b19", "--machinereadable"]
 INFO ssh: Attempting SSH connection...
 INFO ssh: Attempting to connect to SSH...
 INFO ssh:   - Host: 127.0.0.1
 INFO ssh:   - Port: 2200
 INFO ssh:   - Username: vagrant
 INFO ssh:   - Password? false
 INFO ssh:   - Key Path: ["/path/to/private_key"]
@andytson
Copy link
Contributor

@warrenseine This is a base box issue Chef had fixed in their CentOS 6.6 box https://atlas.hashicorp.com/chef/boxes/centos-6.6

Using CentOS 6.5 without yum updating it to CentOS 6.6 means there will be many security issues, as CentOS doesn't support versions other than the latest minor release of each major version. (i.e. 5.11, 6.6, 7.1)

@andytson
Copy link
Contributor

@warrenseine
Copy link
Author

@andytson Thanks, I'll try the 6.6 box.

I'm unused to Red Hat's release cycle. Is there a difference between 6.6 and 6.5 + yum update?

@sethvargo
Copy link
Contributor

Hi @warrenseine

Did upgrading the box help? This seems to be an upstream issue with the box from Chef, but I want to confirm before closing the issue 😄

@andytson
Copy link
Contributor

@warrenseine if you yum update CentOS 6.5, it'll update to 6.6 in most cases (like this basebox). Sometimes some servers are set up pinned to minor releases though.

yum update wont resolve the issue reported though.

@andytson
Copy link
Contributor

if chef/centos-6.6 doesn't work, I'd recommend downloading Chef's build from their Readme https://github.com/chef/bento/blob/master/README.md

They've been known in the past to not update Vagrant Cloud/Atlas frequently

@warrenseine
Copy link
Author

I've got the exact same issue with chef/centos-6.6 and with opscode-centos-6.6.

@warrenseine
Copy link
Author

I'm still wondering about these lines:

INFO guest: Execute capability: configure_networks [#<Vagrant::Machine: local (VagrantPlugins::ProviderVirtualBox::Provider)>, [{:type=>:static, :adapter_ip=>"192.168.50.1", :ip=>"192.168.50.42", :netmask=>"255.255.255.0", :auto_config=>true, :interface=>1}]] (mint)
INFO ssh: Connection errored, not re-using. Will reconnect.

or

INFO ssh: Execute: sed -e '/^#VAGRANT-BEGIN/,$ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces.pre (sudo=true)
INFO ssh: Connection errored, not re-using. Will reconnect.

They still happen with CentOS 6.6. Maybe it's nothing to worry about but it looks the box is setting the network configuration in a file that doesn't exist. Who's responsible for these lines? The box or Vagrant itself?

There's also this error when provisioning (the second time):

INFO ssh: Execute: chown -R vagrant /tmp/vagrant-shell (sudo=true)
INFO ssh: Connection errored, not re-using. Will reconnect.

@warrenseine
Copy link
Author

Same problem occurs with nrel/CentOS-6.6-x86_64.

@warrenseine
Copy link
Author

I went back to Ubuntu without any issue, so I didn't break anything on my side. That's definitely an issue in the way CentOS is handled by Vagrant. I'll try with a minimal Vagrantfile.

@sethvargo
Copy link
Contributor

Hi @warrenseine

If you are able to provide us with a minimal Vagrantfile that demonstrates that issue, that would be very helpful in getting this fixed for 1.7.4. Thanks!

@sethvargo sethvargo added this to the 1.7.4 milestone Jul 13, 2015
@warrenseine
Copy link
Author

Hum, obviously, a minimal Vagrantfile works as expected:

Vagrant.configure(2) do |config|
  config.vm.box = "chef/centos-6.6"
  config.vm.network "private_network", ip: "192.168.33.10"
  config.vm.synced_folder "../data", "/vagrant_data"
end

shows the right command when provisioning:

INFO ssh: Execute: sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/sysconfig/network-scripts/ifcfg-eth1 > /tmp/vagrant-ifcfg-eth1 (sudo=true)

Still investigating.

@sethvargo
Copy link
Contributor

Hi @warrenseine

Of course 😄 💻. If you are able to narrow it down to a particular line or stanza in your testing, that would also help us get a fix out faster 😄

@warrenseine
Copy link
Author

After bisecting my provisioning code (Ansible-based), I found out what CentOS doesn't like:

- name: switch to root when running "vagrant ssh"
  lineinfile: dest=/home/vagrant/.bashrc line="sudo -i"
  when: is_development_environment

I should have thought of this earlier.

So, what is happening here? Why would Ubuntu behave differently? Does CentOS read my .bashrc?

@sethvargo
Copy link
Contributor

Hi @warrenseine

I'm not really sure what that ansible configuration does. What is in the bashrc?

@warrenseine
Copy link
Author

@sethvargo Sorry I should have detailed.

The lineinfile module ensures the line is in the specified file. Here, sudo -i will be written in /home/vagrant/.bashrc.

So if Vagrant reads this file when SSHing into the box as vagrant, it'll be logged in as root immediately, which is — I can guess — not a good thing. It's very specific to my use case and I can workaround that, but I didn't expect Ubuntu and CentOS to behave differently.

@andytson
Copy link
Contributor

This might be related, chef/bento#388 (comment)

@warrenseine
Copy link
Author

@andytson This looks similar indeed.

I ended up using my workaround by removing that part in my provisioning code. I'm not investigating anymore on the issue.

It should be reproducible by:

  1. Starting chef/centos-6.6
  2. SSHing into the box
  3. Adding sudo -i to /home/vagrant/.bashrc
  4. Reloading the box

If that's not the case, then I suppose you can close the issue.

Thanks for your time.

@sethvargo sethvargo modified the milestones: 1.7.4, 1.8 Jul 17, 2015
@ghost ghost locked and limited conversation to collaborators Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants