我正在尝试在 Fedora 23 上使用 vagrant,但它根本不起作用。
它不起作用,因为 virtualbox 的内核模块无法安装和编译 4.4.4-301.fc23.x86_64。
我按照此处的 RPM 说明安装了 virtualbox:https://www.virtualbox.org/wiki/Linux_Downloads
但是,vagrant 仍然不起作用:
$ vagrant up --provider=virtualbox
The provider 'virtualbox' that was requested to back the machine
'vccw.dev' 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
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (4.4.4-301.fc23.x86_64) or it failed to
load. Please recompile the kernel module and install it by
sudo /sbin/rcvboxdrv setup
You will not be able to start VMs until this problem is fixed.
的确。
daniel@EndlessSummer ~/W/s/vccw-2.19.0> modprobe vboxdrsv
modprobe: FATAL: Module vboxdrsv not found in directory /lib/modules/4.4.4-301.fc23.x86_64
奇怪的。
$ sudo /usr/lib/virtualbox/vboxdrv.sh setup
Stopping VirtualBox kernel modules [ OK ]
Recompiling VirtualBox kernel modules [FAILED]
(查看 /var/log/vbox-install.log 找出问题所在)
好的。
$ cat /var/log/vbox-install.log
Makefile:185: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop.
甚至更奇怪。让我们确认一下……
$ sudo dnf install kernel-devel kernel-headers gcc patch <etc>
$ rpm -qva "kernel-*"
kernel-modules-4.3.5-300.fc23.x86_64
kernel-devel-4.4.6-300.fc23.x86_64
kernel-modules-4.4.6-300.fc23.x86_64
kernel-core-4.4.4-301.fc23.x86_64
kernel-core-4.3.5-300.fc23.x86_64
kernel-headers-4.4.6-300.fc23.x86_64
kernel-core-4.4.6-300.fc23.x86_64
kernel-modules-4.4.4-301.fc23.x86_64
我们有内核源代码吗?
$ ls /usr/src/kernels/
4.4.6-300.fc23.x86_64/
$ uname -r
4.4.4-301.fc23.x86_64
不,我们不知道。
sudo dnf install kernel-headers-(uname -r) kernel-devel-(uname -r)
Last metadata expiration check: 0:10:22 ago on Thu Mar 24 18:47:50 2016.
No package kernel-headers-4.4.4-301.fc23.x86_64 available.
Error: Unable to find a match.
目前,这超出了我的修复能力。但这似乎是 Fedora 的问题?
(如果您想知道,将 $KERN_DIR 设置为 /usr/src/xx300xx 也不起作用。)