在Oracle VirtualBox 5.0.16 r105871上,vago up for bento/ubuntu-16.04失败了

AHL*_*AHL 1 vagrant bento ubuntu-16.04

今天我计划使用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命令给出错误,eth1没有显示可解析的ip地址)和StackExchange(https://unix.stackexchange.com/questions/188413/not -able-to-resolve-ip-address-for-eth1-in-vagrant-vm).然而,这些问题涉及xenial64(即 bento)或使用public_network配置.

正如报道https://askubuntu.com/questions/760871/network-settings-fail-for-ubuntu-xenial64-vagrant-box,这个问题不存在ubuntu/trusty64ubuntu/wily64,但似乎是两个问题ubuntu/xenial64bento/ubuntu-16.04(即两个Ubuntu 16盒).

正如您将在Vagrantfile下面看到的,我只有一个简单的设置bento/ubuntu-16.04和使用private_network.要清楚,我不能真正使用这个帖子(vagrant up命令给出错误和eth1没有显示可解析的ip地址),因为它建议注释掉public_network流浪汉配置的一部分.此外,我应该提到在发生此错误时没有其他VM正在运行.

从错误日志中可以看出netowrk界面存在问题eth1,但问题究竟是什么,我不清楚.我以前成功启动了hashicorp/precise32ubuntu/trusty64Ubuntu框相同的流浪汉配置和相同的Oracle VB并没有遇到过这个问题.

任何帮助表示赞赏.我的技术设置和参考文件如下所示.

干杯AHL


建立:

Vagrantfile:

Vagrant.configure(2) do |config|

  config.vm.box = "bento/ubuntu-16.04"

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

end
Run Code Online (Sandbox Code Playgroud)

输出:

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>
Run Code Online (Sandbox Code Playgroud)

Xav*_*ero 6

我遇到了问题,发现由于某种原因,虚拟盒没有将虚拟电缆连接到网络接口.

我通过添加来解决它

    vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
Run Code Online (Sandbox Code Playgroud)

在我的config.vm.provider "virtualbox" do |vb|循环中,例如在我的情况下,我想要1GB RAM,USB3和连接的网络电缆:

config.vm.provider "virtualbox" do |vb|
    vb.memory = "1024"
    vb.customize ["modifyvm", :id, "--usbxhci", "on"]               # Connect USB3 disk
    vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
end
Run Code Online (Sandbox Code Playgroud)

--cableconnected1在我使用过的任何其他盒子里,我都不需要这条线config.vm.box = "bento/ubuntu-16.04".

也许您必须检查是否vagrant up没有连接任何电缆,我还有一个额外的网络,并且eth0是无线连接并且eth1已连线.

检查你的具体情况.也许你必须在选项后玩这个号码.

希望这可以帮助!