当我尝试使用 ubuntu/wily64
框创建一个Vagrant实例时,它会在我尝试使用 vagrant ssh
或 vagrant provision
时挂起(它与旧版本的Ubuntu一起工作正常) . 由于change in Wily's networking,我'm pretty sure that I'有一个common issue . 我在this post中建议进行更改时取得了一些成功 .
(我正在使用Vagrant 1.8和Vbox 5.0.10)
What I’ve done:
创建一个Vagrant框,然后修改/etc/network/interfaces.d/*.cfg文件,如that post第二部分所述:
首先,确定新接口的名称 . 您可以运行ifconfig -a或检查的dmesg |像这样的线(即dmesg的grep的改名):2.671805] E1000 0000:00:03.0 enp0s3:从eth0的改名在这个例子中,新的界面名称是enp0s3 . 确定新接口名称后,请转至/etc/network/interfaces.d . 应该有一个名为eth0.cfg的文件,其中包含以下内容:#主网络接口auto eth0 iface eth0 inet dhcp现在将eth0.cfg复制到enp0s3.cfg(或者接口的名称) . 编辑新文件并将所有eth0替换为enp0s3 . 为您需要配置的每个接口执行此操作 . 完成后删除eth0.cfg . 最后,使用sudo systemctl restart network.service重新启动网络 .
我尝试了两个选项:仅修改 eth0
接口,然后修改 eth1
和 eth0
接口(参见下面的注释#1) . 当我只修改 eth0
时,我可以 vagrant ssh
,但不能 vagrant halt
然后 vagrant up
而不会超时 . 或者,当我修改 eth0
和 eth1
vagrant up时将超过ssh超时,但后来我看到了这种行为(参见下面的注释#2):
$ 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
注意#1:从裸 vagrant init
执行 vagrant up
时,不会创建 eth1
接口 . 这似乎是因为我使用私人网络而创建的)
注意#2:我正在为重命名的 eth1
创建一个文件,因为不存在
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