Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux基礎知識

升級後 VirtualBox 打不開?手動編譯 vboxdrv 模組

錯誤長這樣

WARNING: The character device /dev/vboxdrv does not exist.
Please install the virtualbox-ose-modules package for your kernel.
You will not be able to start VMs until this problem is fixed.

試著手動啟動:

/etc/init.d/vboxdrv start
open: Permission denied
* Starting VirtualBox kernel module vboxdrv
FATAL: Module vboxdrv not found.
* Modprobe vboxdrv failed. Please use 'dmesg' to find out why.

GUI 則跳出:

VirtualBox kernel driver not installed. The vboxdrv kernel module was
either not loaded or /dev/vboxdrv was not created for some reason.
Result Code: 0x80004005 (VERR_VM_DRIVER_NOT_INSTALLED)

核心原因很單純:核心升級後,原本編譯好的 vboxdrv 模組對不上新的核心版本。

網路上常見但無效的做法

/etc/init.d/vboxdrv setup
/etc/init.d/vboxdrv start

這兩招在這個情境下通常不會成功,因為缺少的是模組本身而非設定。

有效的解法:自己編譯模組

sudo apt-get install virtualbox-ose-source
cd /usr/src
sudo tar xjvf virtualbox*.bz2
cd modules/virtualbox-ose
sudo ./build_in_tmp install

接著啟動驅動:

sudo /etc/init.d/vboxdrv start
* Starting VirtualBox kernel module vboxdrv [ OK ]

看到 OK 就代表模組已載入,VirtualBox 也能正常啟動了。

要避免核心升級後再次遇到同樣問題,可安裝 DKMS 相關套件讓模組在核心更新時自動重編;同時別忘了 /dev/vboxdrv 的權限問題需以 root 執行啟動腳本。

Copyright © Linux教程網 All Rights Reserved