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 doesn't work on Fedora 20 with libvirt #4104

Closed
purpleidea opened this issue Jun 26, 2014 · 6 comments
Closed

Vagrant doesn't work on Fedora 20 with libvirt #4104

purpleidea opened this issue Jun 26, 2014 · 6 comments

Comments

@purpleidea
Copy link
Contributor

After building a Fedora 20 base box, and testing it with vagrant-libvirt, I would see this error:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

/sbin/ifdown 

Stdout from the command:



Stderr from the command:

usage: ifdown 

It seemed weird that vagrant was getting the syntax wrong. Tracing this, got me:

 INFO interface: info: Configuring and enabling network interfaces...
 INFO interface: info: ==> annex1: Configuring and enabling network interfaces...
 INFO ssh: SSH is ready!
 INFO guest: Execute capability: configure_networks [#, [{:type=>:static, :ip=>"192.168.143.3", :netmask=>"255.255.255.0", :interface=>1}, {:type=>:static, :ip=>"192.168.142.101", :netmask=>"255.255.255.0", :interface=>2}]] (fedora)
 INFO ssh: SSH is ready!
 INFO guest: Execute capability: network_scripts_dir [#] (fedora)
 INFO ssh: Execute: /usr/sbin/biosdevname -d | grep Kernel | cut -f2 -d: | sed -e 's/ //;' (sudo=true)
 INFO ssh: Execute: touch /etc/sysconfig/network-scripts/ifcfg- (sudo=true)
 INFO ssh: Execute: sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/sysconfig/network-scripts/ifcfg- > /tmp/vagrant-ifcfg- (sudo=true)
 INFO ssh: Execute: cat /tmp/vagrant-ifcfg- > /etc/sysconfig/network-scripts/ifcfg- (sudo=true)
 INFO ssh: Execute: rm /tmp/vagrant-ifcfg- (sudo=true)
 INFO ssh: Execute: touch /etc/sysconfig/network-scripts/ifcfg- (sudo=true)
 INFO ssh: Execute: sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/sysconfig/network-scripts/ifcfg- > /tmp/vagrant-ifcfg- (sudo=true)
 INFO ssh: Execute: cat /tmp/vagrant-ifcfg- > /etc/sysconfig/network-scripts/ifcfg- (sudo=true)
 INFO ssh: Execute: rm /tmp/vagrant-ifcfg- (sudo=true)
 INFO ssh: Execute: cat /tmp/vagrant-network-entry_ >> /etc/sysconfig/network-scripts/ifcfg- (sudo=true)
 INFO ssh: Execute: /sbin/ifdown  (sudo=true)
 INFO retryable: Retryable exception raised: #

...

Which shows: ifcfg-
which is missing something.

I traced this down to the following command in the configure_networks.rb file:

machine.communicate.sudo("/usr/sbin/biosdevname -d | grep Kernel | cut -f2 -d: | sed -e 's/ //;'") do |_, result|

which if you run, you'll see that it doesn't work in a kvm powered virtual machine. Why? The man page of biosdevname has the answer:

Returns 4 if running in a virtual machine.

Which means that this script is bogus when running in a real virtual machine that knows it is one.

I haven't worked out how to patch this yet, since I'm not as familiar with the vagrant source, so if someone else could step up this would be appreciated. Of worthy mention: running CentOS 6.5 works fine. I think this is because there doesn't seem to be a specific capability with this bug in it, and whatever the default is, works great. If someone has more info on this, that would be great too. Workarounds are appreciated.

Cheers,
James

@purpleidea
Copy link
Contributor Author

Label: priority -> high
Label: severity -> high

@CyrilPeponnet
Copy link

Looks like the same as #4078 for el/centos7

@gildub
Copy link
Contributor

gildub commented Aug 5, 2014

I've submitted PR#4297 as workaround.

@purpleidea
Copy link
Contributor Author

@gildub oh awesome, thank you! I didn't test yet, but glad to see you've written a patch for this!

@gildub
Copy link
Contributor

gildub commented Aug 5, 2014

@purpleidea , my pleasure! Well I finally took the time to jump on Vagrant, and I can't go back now!
Let's see how this patch goes. I really don't see why Fedora is using biosdevname and RHEL is not. RHEL7 is based on Fedora18/19 so there isn't much difference.

@mitchellh
Copy link
Contributor

The PR looks good. Thanks! This should be fixed.

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

No branches or pull requests

4 participants