Linux 上的 Vagrant Up 错误

Error on Vagrant Up on Linux

我尝试在我的 Ubuntu 14.04 上 运行 vagrant。所以,我做了这些步骤:

-安装vagrant -安装虚拟机 -为提供者添加框

然后我运行

vagrant up

命令。

在 运行 执行命令后,我得到了这些输出,然后出现了一条错误消息,我不知道该如何解决,运行 它正确。

Bringing machine 'default' up with 'virtualbox' provider...

==> default: Checking if box 'udacity/ud381' 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: Forwarding ports...

default: 5000 (guest) => 5000 (host) (adapter 1)

default: 22 (guest) => 2222 (host) (adapter 1)

==> default: Booting VM... There was an error while executing VBoxManage, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "0399f946-6a87-4310-a22d-c1a4525ae2f0", "--type", "headless"]

Stderr: VBoxManage: error: The virtual machine 'ud381_default_1463617458900_49294' has terminated unexpectedly during startup with exit code 1 (0x1) VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine

我应该怎么做才能修复这些错误?

将所有可用的插件安装到容器。

  1. 获取插件列表-执行

vagrant plugin list

它将列出所有可用的插件。

  1. 安装插件-执行

vagrant plugin install

完成后发出 vagrant up

我按照以下步骤操作并修复了它。

  1. 确保在 BIOS 中启用了虚拟化。例如

http://www.sysprobs.com/disable-enable-virtualization-technology-bios

https://askubuntu.com/questions/410813/how-to-enable-virtualization-on-booting-ubuntu-13-10

  1. 安装virtualbox-5.0,但在此之前你需要卸载旧版本的virtualbox。 link 以下会有帮助:

http://ubuntuhandbook.org/index.php/2015/07/install-virtualbox-5-0-ubuntu-15-04-14-04-12-04/

  1. 在 Vagrantfile 的下一行添加 v.gui = false

    override.vm.network :private_network, ip: machine_type['ip']
    v.gui = false 
    
  2. 重启 Vagrant:

    vagrant reload
    

希望有用。

重要序言:

请注意,我在 2015/2016 年写了这个答案,目标是 VirtualBox 和 Vagrant 以及 Ubuntu headless 14.04。

一段时间后您的里程可能会有所不同。

如果你有类似的问题但版本不同,请随时编辑此答案并将你的答案附加在我对 Ubuntu 14.04 的答案之上让我们帮助大家共同进步。

当我开始使用新版本时,我自己也会这样做并更新这个答案。

答案:

Ubuntu 14.04 无头与 Vagrant 和 VirtualBox

当我遇到同样的问题时,我找到了这个页面。

现在我的问题解决了。希望我的解决方案能帮到你。

为 virtualbox 下载最新的 AMD64 并安装

  1. https://www.virtualbox.org/wiki/Linux_Downloads
  2. 选择 deb 的 AMD64,因为我正在尝试 运行 vagrant on a 64 bit Ubuntu 14.04 server 64-bit edition(我最初的问题是我使用了 i386)
  3. 然后作为 root,dpkg -i whatever_is_the_latest_version_virtualbox.deb
  4. apt-get -f install 这将安装依赖项

为 vagrant 下载最新的 AMD64 并安装

  1. https://www.vagrantup.com/downloads.html
  2. 选择 Debian 64 位
  3. 然后作为 root,dpkg -i whatever_is_the_latest_version_vagrant.deb
  4. apt-get -f install 这将安装依赖项

然后完成剩下的 vagrant box 设置。

现在应该可以了。

在我的 ubuntu 14.02 上,我切换到 virtualbox-5.0 为我工作

sudo apt-get install virtualbox-5.0

有帮助:

sudo /sbin/vboxconfig

然后启动您的虚拟机。 它帮助了我 ;-)

在我的 ubuntu 16.04 上,我将 virtualbox-5.1 与 BOSH-LITE 一起使用,但在执行

时出现了同样的错误
vagrant up --provider=virtualbox

我卸载 virtualbox-5.1 并安装 virtualbox-5.0 然后它现在可以工作了。

在 Ubuntu 16.04 上确保卸载任何以前版本的 virtualbox:

sudo apt-get purge virtualbox virtualbox-dkms virtualbox

从 virtualbox.org

下载的重新安装 virtualbox
sudo dpkg -i Downloads/virtualbox-5.1_5.1.22-115126-Ubuntu-xenial_amd64.deb

这为我修复了错误。

在此讨论中添加一些新内容,根据我的经验,尝试在不支持图形的终端中启动非无头 VM 时会抛出此错误。像 vagrant 和 packer 这样的包装器脚本倾向于选择最简单的选项,因此默认情况下,它们的虚拟机(或盒子)似乎经常启动一个 GUI,除非它没有。修复图形终端问题(比如 x11 转发),一切正常。

最佳方案:
sudo /sbin/vboxconfig

修复错误:

homestead up Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: A newer version of the box 'laravel/homestead' is
available! You currently
==> homestead-7: have version '1.0.1'. The latest is version '3.0.0'. Run
==> homestead-7: vagrant box update to update.
==> homestead-7: Clearing any previously set network interfaces...
There was an error while executing VBoxManage, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg*)" at line 71 of file VBoxManageHostonly.cpp

在 Mac OS 10.12 上,重新安装 Virtual Box 为我解决了这个问题(Vagrant 2.0.0 和 Virtual Box 5.1.28)。

在我的 MAC 上升级 OS 后,事情停止工作并出现与 OP 相同的错误。我也升级了所有其他组件。

我有这样的环境: - MacOS Mojave v10.14 - 流浪汉 2.0.1 - VirtualBox-5.2.20-125813-OSX.dmg - VBoxGuestAdditions_5.2.20.iso

之后,我"vagrant box update"获得了最新版本 的盒子。

之后,我能够旋转 new 虚拟机。 如果您已经创建了 VM,则可能需要处理主机和来宾之间的来宾添加版本不匹配问题。

您的 BIOS 中可能禁用了虚拟化。要启用虚拟化,请按照指南 here 为不同的笔记本电脑 types/makes。