【发布时间】:2017-01-11 23:58:49
【问题描述】:
今天我打算使用 vagrant 将最新的 Ubuntu 版本放入我的虚拟盒子中。加载镜像并运行vagrant up后,出现如下报错,与虚拟盒子的网络配置有关。
有趣的是,网上已经有一些帖子(主要在 GitHub 上,例如:https://github.com/mitchellh/vagrant/issues/7155),还有 AskUbuntu (https://askubuntu.com/questions/760871/network-settings-fail-for-ubuntu-xenial64-vagrant-box)、StackOverflow (vagrant up command giving error and eth1 not showing a resolvable ip address) 和 StackExchange (https://unix.stackexchange.com/questions/188413/not-able-to-resolve-ip-address-for-eth1-in-vagrant-vm)。但是,这些问题与 xenial64(即 not bento)或使用 public_network 配置有关。
正如https://askubuntu.com/questions/760871/network-settings-fail-for-ubuntu-xenial64-vagrant-box 中所报告的,ubuntu/trusty64 或ubuntu/wily64 不存在此问题,但似乎ubuntu/xenial64 和bento/ubuntu-16.04 都存在此问题(即两个Ubuntu 16 机器)。
正如您将在下面的Vagrantfile 中看到的,我对bento/ubuntu-16.04 进行了简单设置,并且仅使用private_network。需要明确的是,我不能真正使用这篇文章 (vagrant up command giving error and eth1 not showing a resolvable ip address),因为它建议注释掉 vagrant 配置的 public_network 部分。另外,我应该提到在发生此错误时没有其他 VM 正在运行。
从错误日志看来,netowrk 接口eth1 似乎很明显存在问题,但究竟是什么问题,我不清楚。之前我已经成功启动hashicorp/precise32和ubuntu/trusty64的Ubuntu盒子,同样的vagrant配置和同样的Oracle VB,没有遇到过这个问题。
感谢任何帮助。下面列出了我的技术设置和参考文件。
干杯 AHL
设置:
- 流浪者:v1.8.1
- Oracle VirtualBox:v5.0.16 r105871
- Ubuntu 盒子:bento/ubuntu-16.04 (https://atlas.hashicorp.com/bento/boxes/ubuntu-16.04)
- 主机:Lenovo X1 Carbon,Windows 10
流浪文件:
Vagrant.configure(2) do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.network "private_network", ip: "192.168.33.10"
end
输出:
C:\Users\AHL\workspace>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/ubuntu-16.04' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
GuestAdditions 5.0.16 running --- OK.
==> default: Checking for guest additions in VM...
==> default: 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:
mesg: ttyname failed: Inappropriate ioctl for device
C:\Users\AHL\workspace>
【问题讨论】:
标签: vagrant ubuntu-16.04 bento