今天我发现我的 VirtualBox VM 无法启动。显示以下消息
The virtual machine 'CGI' has terminated unexpectedly during startup with exit code 1 (0x1).
Result Code:
NS_ERROR_FAILURE (0x80004005)
Component:
MachineWrap
Interface:
IMachine
Unknown macro: {b2547866-a0a1-4391-8b86-6952d82efaa0}
和
Kernel driver not installed (rc=-1908)
The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing
'/sbin/vboxconfig'
as root.
where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT.
看来这是由内核更新引起的。我实际上不知道 Ubuntu 正在进行自动内核更新。日志/var/log/dpkg.log
显示内核更新在问题出现之前正在进行。
sudo dpkg --list | grep linux-image
显示具有许多 4.8、4.10 和 4.13 版本的图像线。
[user:~] $ uname -a
Linux io 4.13.0-26-generic #29~16.04.2-Ubuntu SMP Tue Jan 9 22:00:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
不幸的是,针对该问题建议的解决方案不起作用。
[root:~] # /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
depmod: ERROR: could not open directory /lib/modules/4.10.0-27-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.10.0-28-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.10.0-30-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.10.0-32-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.10.0-33-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.10.0-35-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.10.0-37-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.10.0-38-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.10.0-40-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.8.0-41-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.8.0-45-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.8.0-46-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.8.0-49-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.8.0-52-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.8.0-54-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.8.0-56-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: ERROR: could not open directory /lib/modules/4.8.0-58-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: failed: Look at /var/log/vbox-install.log to find out what went wrong.
There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root.
[root:~] #
安装日志/var/log/vbox-install.log
太大,无法在此处发布,但它以以下消息开始
make[1]: warning: -jN forced in submake: disabling jobserver mode.
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ;
我认为现在实际上有三个问题 * 如何修复内核配置? * 如何修复 VirtualBox?我应该删除并重新安装吗? * 如何防止此类问题?我应该禁用内核自动更新吗?
答案1
VirtualBox 升级到 5.2.6 r120293 后我遇到了同样的问题
Linux 内核版本 4.14.13-041413-generic
以下命令序列对我有帮助:
$ sudo apt install --reinstall virtualbox-dkms && sudo apt install libelf-dev
$ sudo /sbin/vboxconfig
答案2
$ sudo apt install --reinstall virtualbox-dkms && sudo apt install libelf-dev
这只是解决了我在 Kubuntu 18.4.2 上遇到的同样的问题
答案3
virtualbox-dkms
按照上述方法重新安装后,您可能还需要sudo modprobe vboxdrv
重新加载内核模块。
答案4
dkms
如果您正在运行 Ubuntu 或 Debian 发行版(或两者的衍生版本),则安装驱动程序后,驱动程序管理应该会自动处理。
如果之前没有,您可以通过执行asdkms
来修复当前运行的内核版本和 Virtualbox 版本的问题。实际上,您可以打开新的终端窗口(默认情况下使用 ++),然后只需键入并按回车键即可。vboxconfig
root
Alt
Ctrl
T
sudo /sbin/vboxconfig
如果你没有dkms
安装,下次 Virtualbox 或 Linux 内核更新时,你也会遇到类似的问题。为了避免这种情况,你sudo apt install dkms
也可以运行。