VirtualBox kernel driver not installed 解决办法

更新ubuntu krenel成功reboot后, 发现VirtualBox不能正常使用,报出以下错误:
VirtualBox kernel driver not installed.
The vboxdrv kernel module was either not loaded or /dev/vboxdrv was not created for some reason.
‘/etc/init.d/vboxdrv setup’
as root.
VBox status code: -1908 (VERR_VM_DRIVER_NOT_INSTALLED).

按照提示在终端里输入
sudo /etc/init.d/vboxdrv setup
仍然不行。给的信息是

Stopping VirtualBox kernel modules ...done.
Recompiling VirtualBox kernel modules ...failed!
  (Look at /var/log/vbox-install.log to find out what went wrong)

打开/var/log/vbox-install.log文件:

Makefile:73: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again.。 停止。

更新的时候升级了Linux kernel,所以vboxdrv需要重新编译。因为是从源里面直接更新的,没有Linux kernel的源文件,显然编译需要这些源文件,最后解决方法如下:

sudo apt-get install linux-headers-$(uname -r)
sudo /etc/init.d/vboxdrv setup

你可能感兴趣的:(ubuntu,android,嵌入式驱动开发)