15

With the Official Ubuntu 16.04 LTS (Xenial Xerus) Vagrant box image (on VirtualBox) I have problems with basic network settings:

My Vagrantfile:

Vagrant.configure(2) do |config|

  config.vm.box = 'ubuntu/xenial64'

  config.vm.define "xenial" do |server|
    server.vm.network "private_network", ip: "192.168.10.10"
  end
end

vagrant up result:

==> xenial: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

/sbin/ifdown eth1 2> /dev/null

Stdout from the command:



Stderr from the command:

sudo: unable to resolve host ubuntu-xenial
mesg: ttyname failed: Inappropriate ioctl for device

Leaving the configuration to DHCP also does not work:

server.vm.network "private_network", type: "dhcp"

At the same time, the above configurations work for ubuntu/trusty64 and ubuntu/wily64 and unofficial gbarbieru/xenial.

Trying the command /sbin/ifdown eth1 2> /dev/null gives no results as the interface has different naming scheme (the main one is enp0s3).

Am I missing something obvious here or is the box just broken?

15

The problem seems to be solved in the next release of vagrant: https://github.com/mitchellh/vagrant/issues/7155

I tried another box from Jeff Geerling https://twitter.com/geerlingguy/status/723571293174427648?lang=fr and it worked perfectly for me. Jeff has done a lot of great work on Vagrant/Ansible so I guess it's the best solution before the release of the next version of Vagrant

| improve this answer | |
  • I had the same problem with the official Ubuntu 16.04 box. After a few hours of trial and error I tried geerlingguy's box and it worked like a charm. The official Ubuntu 14.04 LTS box was also fine. – Jabba Sep 29 '16 at 14:25
2

Despite ubuntu/xenial64 is the Official Ubuntu box, it has some issues regarding network configuration and is not an Vagrant issue as is explained in @Maxime 's answer.
So, as in the issue is mentioned, is preferred to use a bento box (mantained by the comunity and with Opscode Chef as leader of the project), which for this case would be bento/ubuntu-16.04.

| improve this answer | |
1

The issue is due to the network interface naming convention in new Ubuntu versions. Your Vagrant VM failed to be provisioned, but you can still ssh to it (vagrant ssh). There you'll see that there is no interface named eth1 (you can use ifconfig -a or ip link). In my case, I see the interfaces enp0s3 and enp0s8.

As mentioned in issue 6871

... we need a way to detect the interfaces instead of having a static assignment...

... or convince ubuntu to change their cloud image.

At the moment, there is no clean solution.

| improve this answer | |
1

Actually, additionally to Maximes answer, you could change the GRUB commandline in your box until the new version is propagated.

Just go to /etc/default/grub and set the appropriate line to GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0" You have to change the /etc/network/interfacesto reflect the correct names (eth0...).

See the documentaion of in certdepot for more Info.

| improve this answer | |
1

I faced a similar issue as discussed in the original question.

I am using Vagrant 1.8.1. and using the ubuntu/trusty64 box worked just fine, however, when I tried to use the ubuntu/xenial64 box, I faced the same issue. A comment in this issue thread brought me to a solution, which seems to work out.

I changed the line

config.vm.network "private_network", ip: "192.168.33.10"

in the Vagrantfile to

config.vm.network "private_network", ip: "192.168.33.10", auto_config: false
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.