ubuntu 虚拟机(转)

简介:

VisualBox之所以在Linux上比传统的VMware快得多,关键一点就是它和Linux内核的结合比较紧密,这也是开源的优点。

不过Linux内核更新很频繁,每次更新内核后启动VirtualBox都会提示:

VirtualBox kernel driver not installed. The vboxdrv kernel module was either not loaded or /dev/vboxdrv was not created for some reason. Re-setup the kernel module by executing ‘/etc/init.d/vboxdrv setup’ as root.

所以需要重新编译VirtualBox的内核,Ubuntu下执行如下命令:

sudo /etc/init.d/vboxdrv setup

如果提示


* Stopping VirtualBox kernel modules                                                                                                                                                                    [ OK ] 
* Uninstalling old VirtualBox DKMS kernel modules                                                                                                                                               [ OK ] 
* Trying to register the VirtualBox kernel modules using DKMS                                                                                               
* Failed, trying without DKMS
* Recompiling VirtualBox kernel modules                                                                                                                     
* Look at /var/log/vbox-install.log to find out what went wrong

找到/var/log/vbox-install.log文件,内容大致为:

Makefile:172: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.  Stop.

所以需要安装当前Linux内核的源文件,编译VirtualBox内核的时候需要它,Ubuntu下执行如下命令安装当前Linux内核的源文件:

sudo apt-get install linux-headers-`uname -r`

注意括起uname -r的不是单引号,而是Esc键下面的那个符号。


然后再编译VirtualBox内核执行如下命令:

sudo /etc/init.d/vboxdrv setup



本文转自lilin9105 51CTO博客,原文链接:http://blog.51cto.com/7071976/1222684,如需转载请自行联系原作者

目录
打赏
0
0
0
0
69
分享
相关文章
安装了ubuntu虚拟机后发现shell无法连接 ubuntu开启ssh连接
【8月更文挑战第23天】安装了ubuntu虚拟机后发现shell无法连接
677 6
香橙派5Pro+虚拟机Ubuntu18.04交叉编译+Opencv4.7
香橙派5Pro+虚拟机Ubuntu18.04交叉编译+Opencv4.7
【机器学习 Azure Machine Learning】使用Aure虚拟机搭建Jupyter notebook环境,为Machine Learning做准备(Ubuntu 18.04,Linux)
【机器学习 Azure Machine Learning】使用Aure虚拟机搭建Jupyter notebook环境,为Machine Learning做准备(Ubuntu 18.04,Linux)
102 4
|
9月前
|
【ubuntu】【问题记录】vbox虚拟机无权限访问共享目录
【ubuntu】【问题记录】vbox虚拟机无权限访问共享目录
125 0
|
9月前
|
【ubuntu系统】在虚拟机内安装Ubuntu
【ubuntu系统】在虚拟机内安装Ubuntu
82 0
|
10月前
|
【Linux】已解决:Ubuntu虚拟机安装Java/JDK
【Linux】已解决:Ubuntu虚拟机安装Java/JDK
450 1
|
10月前
|
修改虚拟机Ubuntu为桥接模式的静态IP
修改虚拟机Ubuntu为桥接模式的静态IP
460 0
【YashanDB知识库】使用vmware虚拟机安装的YashanDB,本机无法访问
在 VMware 虚拟机中安装并测试 YashanDB,数据库及虚拟机运行正常,但本地 IDE 工具无法连接虚拟机中的数据库。问题可能与 VMware 网络适配器配置或网络模式(如 NAT、桥接)有关,导致网络通信异常。需检查虚拟机网络设置、IP 地址配置以及防火墙规则,确保本地与虚拟机间网络连通性。目前无明确修复版本。