I am trying to build a vagrant box from a VirtualBox machine. When I give vagrant up
, I get an error saying
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
/sbin/ifup eth1
If I try to run the command manually, I get
/etc/network/interfaces:17: duplicate interface
ifup: couldn't read interfaces file "/etc/network/interfaces"
The network-related part of the vagrantfile is
config.vm.network :hostonly, "192.168.56.11"
(if I disable this line and use only a NAT interface, things work, but I would like both a NAT and a host-only network connection)
The contents of /etc/network/interfaces
is
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
allow-hotplug eth1
iface eth1 inet dhcp
#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
auto eth1
iface eth1 inet static
address 192.168.56.11
netmask 255.255.255.0
#VAGRANT-END
I tried commenting out the iface eth1 inet dhcp
before packaging the machine, but it didn't have any effect (the line was not commented out on the vagrant box).
Take a look at this:
https://github.com/mitchellh/vagrant/issues/997
Removing the entries other than eth0 in the /etc/udev/rules.d/70-persistent-net.rules
and removing all but the eth0 ifcfg-eth files in /etc/sysconfig/network/
did the trick for me.
Running virtualbox on ubuntu 12.1, with a suse 11 operating system on the vbox