Qoh*_*let 2 linux fedora virtualbox kernel fedora-30
我使用的是 Fedora 31,并使用网站上的 RPM 安装了 VirtualBox (VirtualBox-6.1-6.1.14_140239_fedora31-1.x86_64.rpm),这应该是最新版本。
启动它给我以下错误:
$ virtualbox
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (5.8.11-100.fc31.x86_64) or it failed to
load. Please recompile the kernel module and install it by
sudo /sbin/vboxconfig
You will not be able to start VMs until this problem is fixed.
Run Code Online (Sandbox Code Playgroud)
从内核版本来看,一切似乎都很好。
$ uname -a
Linux localhost.localdomain 5.8.11-100.fc31.x86_64 #1 SMP Wed Sep 23 15:15:42 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)
当我尝试启动虚拟机时,我会得到:
**Kernel driver not installed (rc=-1908)**
The VirtualBox Linux kernel driver is either not loaded or not set up correctly. Please try setting it up again by executing
'/sbin/vboxconfig'
as root.
If your system has EFI Secure Boot enabled you may also need to sign the kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load them. Please see your Linux system's documentation for more information.
where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT.
Run Code Online (Sandbox Code Playgroud)
但模块不会安装:
$ sudo /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
This system is currently not set up to build kernel modules.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root. If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.
Run Code Online (Sandbox Code Playgroud)
大多数页面都提到安装类似的东西:sudo dnf install -y kernel-devel kernel-devel-$(uname -r)
但这给了我一个错误,因为找不到包。
我查看了一些与 Fedora 相关的VirtualBox-Forums 。他们还建议安装标头,只是使用稍微不同的命令。要么找不到,要么已经安装:
Das Paket kernel-headers-5.8.11-100.fc31.x86_64 ist bereits installiert.
No match for argument: kernel-devel-5.8.11-100.fc31.x86_64
Fehler: Es konnte kein Treffer gefunden werden.: kernel-devel-5.8.11-100.fc31.x86_64
Run Code Online (Sandbox Code Playgroud)
在大多数 Ubuntu 论坛中,似乎使用相同的命令(只需使用 apt-get)就可以快速解决该问题。有时声称这些软件包已经过时,但由于 Fedora 的更新比 Ubuntu 更频繁,我想知道其背后的问题是什么。
我找到了一篇文章来帮助您安装来宾添加项。
https://www.howtoing.com/install-virtualbox-guest-additions-in-fedora/
安装 VirtualBox 来宾添加的第一步是安装内核头文件。这包括安装 dkms 包(动态内核模块支持)以及其他构建工具,如图所示。
$ sudo dnf install dkms kernel-devel gcc bzip2 make curl
成功安装内核头文件后,您需要确认 Linux 内核的版本并确保其与刚刚安装的内核头文件的版本匹配。
要检查 Linux 内核的版本,请运行命令。
$ uname -r 或 $ hostnamectl | grep -i 内核
要检查内核开发工具(kernel-devel)的版本,请执行。
$ sudo rpm -qa 内核开发
验证 Linux 内核标头 验证 Linux 内核标头
如果两者的版本(内核版本和 kernel-devel)不匹配(如上面的屏幕截图所示),请使用命令更新内核。
$ sudo dnf 更新内核-*
完成内核更新后,重新启动系统,然后再次验证内核版本。
$ uname -r
这对你有用。非常感谢,@John