3

When I try to make a Vagrant instance with the ubuntu/wily64 box, it hangs when I try to vagrant ssh or vagrant provision (it was working fine with older versions of Ubuntu). I'm pretty sure that I'm having a common issue, due to a change in Wily's networking. I've had some success in making the changes suggested in this post.

(I'm using Vagrant 1.8 and Vbox 5.0.10)

What I’ve done:

Created a Vagrant box and then modified the /etc/network/interfaces.d/*.cfg files as as mentioned in the second part of that post:

First, determine the name(s) of the new interface(s). You may run ifconfig -a or check dmesg (i.e. dmesg | grep renamed) for a line like this:

[2.671805] e1000 0000:00:03.0 enp0s3: renamed from eth0

In this example, the new interface name is enp0s3.

Once you have determined the new interface name(s), go to /etc/network/interfaces.d. There should be a file named eth0.cfg with the following contents:

# The primary network interface
auto eth0
iface eth0 inet dhcp

Now copy eth0.cfg to enp0s3.cfg (or whatever the name of your interface is). Edit the new file and replace all use of eth0 with enp0s3. Do this for each interface you need configured. Remove eth0.cfg when you are finished.

Finally, restart networking with sudo systemctl restart networking.service.

I've tried two options: Modify only the eth0 interface, and then modify both the eth1 and the eth0 interfaces (see Note #1 below). When I modify only eth0, I can then vagrant ssh, but can’t vagrant halt then vagrant up without getting a timeout. Alternatively, when I modify both eth0 and eth1 vagrant up will get past the ssh timeout, but then I see this behavior (see Note #2 below):

$ vagrant halt wharf
$ vagrant up wharf

[ ... ]
==> wharf: Restarted DNS Service
==> wharf: 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/ip addr flush dev eth1 2> /dev/null

Stdout from the command:



Stderr from the command:

mesg: ttyname failed: Inappropriate ioctl for device

Note #1: The eth1 interface is not created when doing a vagrant up from a bare vagrant init. This seems to be created because I'm using private networking)
Note #2: I am creating a file for the renamed eth1, because none exists

Question: Given the steps that I've taken, and the info in that post, what can I do next to debug this issue?

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  # All Vagrant configuration is done here. The most common configuration
  # options are documented and commented below. For a complete reference,
  # please see the online documentation at vagrantup.com.

  config.dns.tld = "dev"
  config.vm.box = "ubuntu/wily64"
  config.vm.box_check_update = false
  config.vm.synced_folder ".", "/vagrant", disabled: true

  config.vm.define "wharf" do |wharf|
    wharf.vm.network :forwarded_port, guest: 80, host: 8080
    wharf.vm.network :private_network, ip: "192.168.33.10"
    wharf.vm.synced_folder ".", "/opt/wharf", create: true
    wharf.vm.hostname = "wharf"
    wharf.dns.patterns = [/^wharf.dev$/, /^shipyard.dev$/, /^.*demo.dev$/]

    wharf.vm.provider :virtualbox do |vb|
        # Use VBoxManage to customize the VM. For example to change memory:
        vb.customize ["modifyvm", :id, "--memory", "1024"]
    end
    wharf.vm.provision "ansible" do |ansible|
        ansible.playbook = "deploy/vagrant_site.yml"
        ansible.inventory_path = "deploy/hosts/vagrant/inventory"
        ansible.sudo = true
        ansible.verbose = 'vvvv'
    end
  end

  config.vm.define "wharfhouse" do |wharfhouse|
    wharfhouse.vm.network :private_network, ip: "192.168.33.20"
    wharfhouse.vm.hostname = "wharfhouse"

    wharfhouse.vm.provider :virtualbox do |vb|
        # Use VBoxManage to customize the VM. For example to change memory:
        vb.customize ["modifyvm", :id, "--memory", "1024"]
    end
    wharfhouse.vm.provision "ansible" do |ansible|
        ansible.playbook = "deploy/site.yml"
        ansible.inventory_path = "deploy/hosts/vagrant/inventory"
        ansible.sudo = true
        ansible.verbose = 'vvvv'
    end
  end
end
4

0 回答 0