我最近安装了 virtualbox(修复了 dpkg 错误之后)并且每次启动时都会收到一条错误消息;
~ 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. ~
和
~The virtual machine 'Kali-Linux-2020.1-vbox-amd64' has terminated unexpectedly during startup with exit code 1 (0x1).
Result Code:
NS_ERROR_FAILURE (0x80004005)
Component:
MachineWrap
Interface:
IMachine {85632c68-b5bb-4316-a900-5eb28d3413df}
~
i have tried everything here https://superuser.com/questions/1438279/how-to-sign-a-kernel-module-ubuntu-18-04 but it has no affect. when i run this command
~apt install virtualbox-dkms~ i get ~Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
virtualbox-dkms : Depends: dkms (>= 2.1.0.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.~
我尝试过手动安装 dkms,但它只是把我带入了一个兔子洞。我当然是以 root 身份登录的。我对此很陌生,所以如果我第一次没有完全理解,我很抱歉。非常感谢您的帮助!
答案1
我遇到了类似的问题,我猜这对您来说可能是同一个根本原因,因为我们都使用 18.04 Bionic;但是我使用的是主线内核 5.4.21,我不相信您提到过您正在使用什么内核。
我的根本原因是 18.04 Bionic 将 gcc 默认为 gcc-7,而最新的 VBox 6.1 在内核 5.4.x 和 5.5.x 下运行时需要 gcc-8 或更高版本。因此,/sbin/vboxconfig
运行时(无论是在脚本中还是手动),它都使用默认的 gcc-7,这导致在构建某些二进制文件时无法包含标头。
我已经有了 gcc-8,实际上我以为我已经在使用它了。然而当我运行时,gcc --version
它显示 7.4.0。
我强制使用 gcc-8 作为默认设置,sudo update-alternatives --config gcc
然后选择了 gcc-8。然后我运行sudo /sbin/vboxconfig
。没有错误然后运行 VBox,瞧!一切又恢复正常了!
因此步骤 [我不知道你有什么,所以在这里列出,假设你还没有掌握大部分内容,但保持高水平,这样你就可以开心地弄清楚语法 :) ]
- 关闭 vbox
- 安装更新替代方案
- 安装 gcc-8
- 使用 update-alternatives 设置 gcc 并强制 gcc-8 作为默认值
- 跑步
/sbin/vboxconfig
- 运行 VBox 6.1