Fedora
在 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
根據vagrant 的文件,預設提供程序應該是
virtualbox
,並且該VAGRANT_DEFAULT_PROVIDER
變數允許您覆蓋它。但是,
VAGRANT_DEFAULT_PROVIDER
是空的,所以應該是virtualbox
,對吧?好吧,如果我將變數設置為virtualbox
,它會再次起作用。所以我猜fedora在其他地方設置了預設變數。解決方案:
$ echo "export VAGRANT_DEFAULT_PROVIDER=virtualbox" >> ~/.bashrc $ source ~/.bashrc
這只是我遇到這個問題的經驗。
在執行時
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
解決了我的問題。