Reputation: 664
I started to create a new VM for developement, cause my ubuntu 14.4 seems out of date.
I desicided to switch to ubuntu 17.10 for the future but fail on first installation.
This is my vagrant file:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "1024"
end
config.vm.box = "generic/ubuntu1710"
config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: false
config.vm.network "private_network", ip: "192.168.37.200"
end
And during the provisioning I got this
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
/sbin/ifdown 'eth1' || true
/sbin/ip addr flush dev 'eth1'
# Remove any previous network modifications from the interfaces file
sed -e '/^#VAGRANT-BEGIN/,$ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces.pre
sed -ne '/^#VAGRANT-END/,$ p' /etc/network/interfaces | tac | sed -e '/^#VAGRANT-END/,$ d' | tac > /tmp/vagrant-network-interfaces.post
cat \
/tmp/vagrant-network-interfaces.pre \
/tmp/vagrant-network-entry \
/tmp/vagrant-network-interfaces.post \
> /etc/network/interfaces
rm -f /tmp/vagrant-network-interfaces.pre
rm -f /tmp/vagrant-network-entry
rm -f /tmp/vagrant-network-interfaces.post
/sbin/ifup 'eth1'
Stdout from the command:
Stderr from the command:
bash: line 4: /sbin/ifdown: No such file or directory
bash: line 20: /sbin/ifup: No such file or directory
The machine is not available via the hosting windows. Do I have to install something before provisioning? Or do you prefer another machine template from hashicorb?
Regards n00n
Upvotes: 1
Views: 1667
Reputation: 285
For RHEL box, you can add the nm_controlled
to get it to work:
qa.vm.network "private_network", ip: "10.11.12.2", nm_controlled: "yes"
Refer to the vagrant source code here.
It works for me on MacOS 13.2.1 (Ventura), Virtualbox 7.0.6, vagrant 2.3.4.
Upvotes: 0
Reputation: 28663
Vagrant cannot be used with Ubuntu 17.10 at the moment, due to the removal of the traditional networking configuration tools and files: /sbin/ifup
and /sbin/ifdown
.
But you can create vagrant VM with a network interface with the following workaround:
1.
Add installing ifupdown
into your Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
$provision_script = <<PROVISION
apt-get -y update
apt-get install ifupdown -y
PROVISION
Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: $provision_script
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "1024"
end
config.vm.box = "generic/ubuntu1710"
config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: false
config.vm.network "private_network", ip: "192.168.37.200"
end
2. Create vagrant VM:
vagrant up
Of course it fails with the error in question.
3.
Start provision script inside just created VM. It installs package ifupdown
with necessary files:
vagrant provision
4. And now reload your VM:
vagrant reload
Upvotes: 6