Vagrant: Cannot create a private network with an Ubuntu 17.10 VM

Created on 2 Nov 2017  ·  18Comments  ·  Source: hashicorp/vagrant

Vagrant version

Vagrant 2.0.0

Host operating system

Windows 7 Enterprise 64 bits

Guest operating system

Ubuntu 17.10 Artful Aardvark 64 bits

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/artful64"

  config.vm.provision "docker"

  config.vm.provider "virtualbox" do |v|
    v.memory = 8192
    v.cpus = 4
  end

  config.vm.synced_folder ".", "/vagrant", disabled: true

  #config.vm.network :forwarded_port, guest: 8888, host: 8888
  config.vm.network "private_network", ip: "192.168.56.2"

end

Debug output

https://gist.github.com/EMegamanu/6a5668c4bfa8355d6779abbf1c692fe5

Expected behavior

Private network should be configured with commands ifdown / ifup

Actual behavior

Private network setting fails because these commands were removed in Ubuntu 17.10 : https://wiki.ubuntu.com/ArtfulAardvark/ReleaseNotes

Steps to reproduce

  1. vagrant up with the provided Vagrantfile
bug enhancement guesubuntu has-pr networking

Most helpful comment

My box fso/artful64 said that net-tools is "already the newest version"; i.e., installed. However, installing ifupdown did the trick.

To be perfectly clear, first vagrant up will crash. Then vagrant ssh into the machine and run:

sudo apt-get update
sudo apt-get install -y ifupdown

Ex out and run vagrant reload. Boom. Network configured. A bit messy, but I guess it's doable for now.

Does anyone know when Vagrant 2.0.2 will be released?

All 18 comments

Yeah, vagrant cannot be used with Ubuntu 17.10 at the moment, due to the removal of the traditional networking configuration tools and files. Ubuntu has decided that systemd should completely destroy yet another component of the OS. Vagrant will need to support both the new netplan networking config for 17.10+, while maintaining the legacy /etc/network/interfaces method.

As a workaround until the guest capabilities have been updated, installing the net-tools package on the guest should make things work.

My box fso/artful64 said that net-tools is "already the newest version"; i.e., installed. However, installing ifupdown did the trick.

To be perfectly clear, first vagrant up will crash. Then vagrant ssh into the machine and run:

sudo apt-get update
sudo apt-get install -y ifupdown

Ex out and run vagrant reload. Boom. Network configured. A bit messy, but I guess it's doable for now.

Does anyone know when Vagrant 2.0.2 will be released?

@chrisroberts I suspect net-tools might be the wrong package as it does not contain /sbin/ifup and friends (see file list).

ifupdown looks like a better choice.

is this issue going to be addressed any time soon?

This problem still persists with the current v20171220.0.0 box image (dunno if the box update even affects it).

Or, if you can handle a more beautiful desktop that according to my experience is even faster than GNOME, use box pristine/ubuntu-budgie-17-x64. It has net-tools and ifupdown baked in. Plus, you know exactly how it was built.

@domnulnopcea @mpdude - a pull request has been made that includes support netplan in Ubuntu 17.10. You can see that at #9338

Thanks!

I just tested the freshly released Vagrant 2.0.2 with the current version of the ubuntu/artful64 box (20180126.0.0) and the Vagrantfile mentioned in this issue (after a more complex Vagrant setup failed to bring up the private networks). I was hoping that pull request #9338 solved the issue, it is even mentioned in the ChangeLog, but Vagrant still tries to use the old /sbin/ifup way of configuring private networks, which fails.

Should I open a new issue, or can someone reopen this one?

Haven't yet checked Vagrant 2.0.2.

But, if you're using the workaround above and are installing ifupdown, you might also run into issues on vagrant reload when vagrant tries to re-configure network interfaces.

This is due to this bug. So, you additionally need to download a fixed version of ubuntu-fan and dpkg -i install it.

@mpdude I'm not using the workaround to install ifupdown. Vagrant 2.0.2 added netplan support, and that does work with bento/ubuntu-17.10 but for whatever reason, it doesn't with ubuntu/artful64.

I'm also using Vagrant 2.0.2 and seeing errors like this with bento/ubuntu-17.10

/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 18: /sbin/ifup: No such file or directory

@NoahO Use vagrant ssh to ssh into the box after this error occured.

Then, try

sudo apt-get update
sudo apt-get install -y ifupdown wget
wget http://de.archive.ubuntu.com/ubuntu/pool/main/u/ubuntu-fan/ubuntu-fan_0.12.9_all.deb
dpkg -i ubuntu-fan_0.12.9_all.deb

Exit the SSH session and vagrant reload.

@briancain Could you please re-open this issue? Seems it is not properly resolved.

Hi all. I've created a new issue to track this here: #9428

Cheers!

For me, Vagrant 2.0.3 works on ubuntu/artful64 👍

Installing the ifupdown package in the VM solved the problem for me.

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gwagner picture gwagner  ·  3Comments

janw-me picture janw-me  ·  3Comments

dorinlazar picture dorinlazar  ·  3Comments

tomhking picture tomhking  ·  3Comments

bbaassssiiee picture bbaassssiiee  ·  3Comments