(我已经尝试过类似问题的答案)
Fedora Linux 37 (工作站版) x86_64,内核:6.0.7-301.fc37.x86_64
我安装了 VirtualBoxsudo dnf install VirtualBox
在我使用启动 Virtual Box 之后VirtualBox
,出现错误:
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (6.0.7-301.fc37.x86_64) or it failed to
load. Please try load the kernel module by executing as root
dnf install akmod-VirtualBox kernel-devel-6.0.7-301.fc37.x86_64
akmods --kernels 6.0.7-301.fc37.x86_64 && systemctl restart vboxdrv.service
You will not be able to start VMs until this problem is fixed.
systemctl restart vboxdrv.service
在我得到以下命令后,推荐的命令工作正常,除了最后一个:
Job for vboxdrv.service failed because the control process exited with error code.
See "systemctl status vboxdrv.service" and "journalctl -xeu vboxdrv.service" for details.
systemctl status vboxdrv.service
:
× vboxdrv.service - Linux kernel module init script
Loaded: loaded (/usr/lib/systemd/system/vboxdrv.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Mon 2023-02-27 21:25:49 EET; 9s ago
Process: 73393 ExecStart=/sbin/modprobe vboxdrv (code=exited, status=1/FAILURE)
Main PID: 73393 (code=exited, status=1/FAILURE)
CPU: 23ms
Feb 27 21:25:49 fedora systemd[1]: Starting vboxdrv.service - Linux kernel module init script...
Feb 27 21:25:49 fedora modprobe[73393]: modprobe: ERROR: could not insert 'vboxdrv': Exec format error
Feb 27 21:25:49 fedora systemd[1]: vboxdrv.service: Main process exited, code=exited, status=1/FAILURE
Feb 27 21:25:49 fedora systemd[1]: vboxdrv.service: Failed with result 'exit-code'.
Feb 27 21:25:49 fedora systemd[1]: Failed to start vboxdrv.service - Linux kernel module init script.
journalctl -xeu vboxdrv.service
:
Feb 27 21:25:49 fedora systemd[1]: Starting vboxdrv.service - Linux kernel module init script...
░░ Subject: A start job for unit vboxdrv.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit vboxdrv.service has begun execution.
░░
░░ The job identifier is 5095.
Feb 27 21:25:49 fedora modprobe[73393]: modprobe: ERROR: could not insert 'vboxdrv': Exec format error
Feb 27 21:25:49 fedora systemd[1]: vboxdrv.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStart= process belonging to unit vboxdrv.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Feb 27 21:25:49 fedora systemd[1]: vboxdrv.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit vboxdrv.service has entered the 'failed' state with result 'exit-code'.
Feb 27 21:25:49 fedora systemd[1]: Failed to start vboxdrv.service - Linux kernel module init script.
░░ Subject: A start job for unit vboxdrv.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit vboxdrv.service has finished with a failure.
░░
░░ The job identifier is 5095 and the job result is failed.
尝试运行任何虚拟盒后,我收到错误Kernel driver not installed (rc=-1908)
(安装了适合我的内核版本的akmod-VirtualBox和kernel-devel)
我将非常感激您的任何帮助或建议。此外,我在较高内核版本上启动时遇到问题,因此这可能是造成此问题的原因。
答案1
不幸的是,运行 VirtualBox 所需的内核模块有一个历史几乎每次更新都会出现问题,特别是在 Fedora 上,新内核版本经常在匹配的 kmod 包可用之前发布。
在 Fedora 37 上,即使已经从存储库安装了正确的内核模块,也可能出现此错误。
$ virtualbox &
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (6.2.15-200.fc37.x86_64) or it failed to
load. Please try load the kernel module by executing as root
dnf install akmod-VirtualBox kernel-devel-6.2.15-200.fc37.x86_64
akmods --kernels 6.2.15-200.fc37.x86_64 && systemctl restart vboxdrv.service
You will not be able to start VMs until this problem is fixed.
$ cat /etc/fedora-release
Fedora release 37 (Thirty Seven)
$ uname -r
6.2.15-200.fc37.x86_64
# dnf install kmod-VirtualBox-6.2.15-200.fc37.x86_64.x86_64
Package kmod-VirtualBox-6.2.15-200.fc37.x86_64-7.0.8-1.fc37.x86_64 is already installed.
因此,您可以成功运行该akmods
命令,因为它只是检查内核模块是否存在,并且它存在是因为它已从存储库安装(它是预编译的内核模块)。
$ sudo akmods --kernels 6.2.15-200.fc37.x86_64
Checking kmods exist for 6.2.15-200.fc37.x86_64 [ OK ]
请注意,akmods 仅检查它是否存在,仅此而已。
虽然我没有看到那个错误:执行格式错误
但这似乎并没有什么区别。
您应该尝试删除预编译的内核模块,然后自行构建(不是手动构建,而是在您的机器上构建,专门针对您的环境)。近年来,这种方法对于大多数 VirtualBox 错误变体效果最好。
确保已安装 akmods 以及所需的内核构建依赖项。最低要求如下:
# dnf install akmods kernel-devel
删除您已安装的任何预编译的 VirtualBox 内核模块,但请注意不要在此过程中删除所有 VirtualBox(仔细阅读 dnf 的输出)。
# dnf erase kmod-VirtualBox-$(uname -r)
由于您特别提到您被困在当前内核版本中,因此仅删除该版本就足够了,否则您甚至可以运行dnf erase kmod-VirtualBox-*
。现在运行 akmods 来为您的机器构建该内核模块。
# akmods --kernels $(uname -r)
该工具还有一个“强制”选项:akmods --force
最后一个命令现在应该打印两行而不是一行,第二行表示它正在构建(重新创建)VirtualBox 缺少的内核模块:
# akmods --kernels 6.2.15-200.fc37.x86_64
Checking kmods exist for 6.2.15-200.fc37.x86_64 [ OK ]
Building and installing VirtualBox-kmod [ OK ]
如果有效,您仍然需要重新加载模块(或重新启动):
# systemctl restart vboxdrv.service
然后重新启动 VirtualBox。现在它应该可以工作了。
答案2
我遇到了同样的问题,并使用了以下方法来解决问题
我的内核版本是:6.0.7-301.fc37.x86_64
dnf -y install @development-tools
dnf -y install kernel-headers kernel-devel-6.0.7-301.fc37.x86_64 dkms elfutils-libelf-devel qt5-qtx11extras
然后运行以下命令来构建/加载 vboxdrv 内核模块
sudo /sbin/vboxconfig
祝你好运