设为首页 收藏本站
查看: 647|回复: 0

[经验分享] 关于重新编译内核后VirtualBox不能使用的问题

[复制链接]

尚未签到

发表于 2015-4-16 08:47:57 | 显示全部楼层 |阅读模式
        编译完内核后进入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= 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= 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:貌似比以前更快了哈,不知道是不是错觉!

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-57628-1-1.html 上篇帖子: virtualbox装配fedora时,安装增强功能包时会报错解决 下篇帖子: Oracle VM VirtualBox 随系统自动启动虚拟机的方法
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表