Fedora 21 上默认使用 VirtualBox 提供程序

Fedora 21 上默认使用 VirtualBox 提供程序

现在,每当我使用 vagrant 时,它都会尝试用作libvirt提供者。我想默认使用 VirtualBox。

vagrant-libvirt未安装。

这很麻烦,因为有些命令不起作用,例如vagrant status

[florian@localhost local]$ vagrant status
The provider 'libvirt' could not be found, but was requested to
back the machine 'foobar'. Please use a provider that exists.
[florian@localhost local]$ vagrant status --provider=virtualbox
An invalid option was specified. The help for this command
is available below.

Usage: vagrant status [name]
    -h, --help                       Print this help

答案1

根据流浪者的文档,默认提供程序应该是virtualbox,并且该VAGRANT_DEFAULT_PROVIDER变量允许您覆盖它。

不过,VAGRANT_DEFAULT_PROVIDER是空的,所以应该是virtualbox吧?好吧,如果我将变量设置为virtualbox,它会再次起作用。所以我猜 Fedora 在其他地方设置了默认变量。

解决方案:

$ echo "export VAGRANT_DEFAULT_PROVIDER=virtualbox" >> ~/.bashrc
$ source ~/.bashrc

答案2

这只是我遇到这个问题的经验。

在执行时vagrant up,我得到了这个

The provider 'libvirt' could not be found, but was requested to
back the machine 'default'. Please use a provider that exists.

我尝试了上面提供的命令

echo "export VAGRANT_DEFAULT_PROVIDER=virtualbox" >> ~/.bashrc
source ~/.bashrc

然后我执行了vagrant up

The provider 'virtualbox' that was requested to back the machine
'default' is reporting that it isn't usable on this system. The
reason is shown below:

VirtualBox is complaining that the kernel module is not loaded. Please
run `VBoxManage --version` or open the VirtualBox GUI to see the error
message which should contain instructions on how to fix this error.

使用VBoxManage --version,它给了我

The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (4.0.4-303.fc22.x86_64) or it failed to
load. Please recompile the kernel module and install it

并提示我执行sudo /etc/init.d/vboxdrv setup这解决了我的问题。

相关内容