编译完内核后进入linux3.0内核后,习惯性的打开virtualbox,然后突然发现virtualbox提示错误,然后又出现一个对话框,上面写着:
Nevertheless, there is no shortage of changes, such as the auto grouping of processes within a session, which has caused a lot of commotion in the Linux online world as it is expected to considerably increase the reaction speed of the desktop environment under certain ambient conditions 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 '/etc/init.d/vboxdrv setup' as root. Users of Ubuntu, Fedora or Mandriva should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.
然后就开始了我的一下午的google,发现网上大都是说使用
/etc/init.d/vboxdrv setup进行重新编译,我试了之后发现仍提示
Failed, trying without DKMS ... failed!
Recompiling VirtualBox kernel modules:
Look at /var/log/vbox-install.log to find out what went wrong ... failed!
好吧,再google,又有了新的答案了,说是让使用
sudo apt-get install dkms
来安装dkms再编译,汗我还不太懂啥叫dkms,但人家说装就装呗,装着装着我就感觉不对劲,怎么净是些linux2.6.32的kernel-headers啊,我的内核可是才编译的linux-3.0的,果然,我装上dkms后再使用
/etc/init.d/vboxdrv setup
依然得到的是那个错误。
再次google时意外的发现另一种方法:
sudo apt-get install linux-headers-$(uname -r)
去安装头文件,然后进入/usr/src/vboxhost-4.1.8/中去编译,但是不知道是我的源有问题还是内核太新了,sudo apt-get 安装失败了根本找不到linux-headers-3.0.0。
没办法只有自己硺磨了,不管怎么说先进入/usr/src/vboxhost-4.1.8再说吧
cd /usr/src/vboxhost-4.1.8
然后编译一下试试
make
得到如下信息:
*** Building 'vboxdrv' module ***
make[1]: Entering directory `/usr/share/virtualbox/src/vboxhost/vboxdrv'
Makefile:172: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again。 停止。
make[1]: Leaving directory `/usr/share/virtualbox/src/vboxhost/vboxdrv'
make: *** [all] 错误 2
苦思冥想之后斗胆试了一下
sudo make KERN_DIR=/usr/src/linux-3.0
结果惊奇的发现似乎可以了,然后理所当然
sudo make install
理所当然的得到了如下信息
make[1]: Entering directory `/usr/share/virtualbox/src/vboxhost/vboxdrv'
Makefile:172: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again。 停止。
make[1]: Leaving directory `/usr/share/virtualbox/src/vboxhost/vboxdrv'
make: *** [install] 错误 2
于是再加个Shell变量试试
sudo make install KERN_DIR=/usr/src/linux-3.0
成功了。
然后再执行
sudo /etc/init.d/vboxdrv setup(KERN_DIR=/usr/src/linux-3.0)
得到如下信息
Error! Your kernel headers for kernel 3.0.0 cannot be found at
/lib/modules/3.0.0/build or /lib/modules/3.0.0/source.
Failed, trying without DKMS ... failed!
Recompiling VirtualBox kernel modules:
Look at /var/log/vbox-install.log to find out what went wrong ... failed!
于是进入/lib/modules/3.0.0/然后发现source这个软链接被链接到我编译的目下去了,而我又把那个目录给移到别处了,难怪会出错了,把原目录移回来再执行,OK,一切正常了。
再次打开virtualbox,发现又有新的错误
Failed to load unit 'HGCM' (VERR_INVALID_PARAMETER)
google后发现好像跟saved state有关,于是右键virtualbox中的windowsxp系统,选择discard saved state.
再次重新virtualbox,OK终于进入了xp!大功告成!
ps:貌似比以前更快了哈,不知道是不是错觉!