VirtualBox报错:Building the main Guest Additions module ...fail

当我们尝试使用“vboxlinuxadditions.Run”脚本来安装VirtualBox Guest Additions扩展程序时,我们可能会收到以下错误消息:

Building the main Guest Additions module ...fail!

查看详细的日志文件

/tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again.  Stop.

出现此错误消息的最可能原因是: 缺少包含当前正在运行的内核版本的复杂复杂和内核标头。

要修复此错误,请使用root用户运行以下Linux命令,以安装所有必需的准备工作:

# apt-get install linux-headers-$(uname -r) build-essential

安装完成后,再次运行vboxlinuxadditions.run脚本以安装VirtualBox Guest Additions扩展程序:

# bash VBoxLinuxAdditions.run
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
Building the main Guest Additions module ...done.
Building the shared folder support module ...done.
Building the OpenGL support module ...done.
Doing non-kernel setup of the Guest Additions ...done.
Starting the VirtualBox Guest Additions ...done.
Installing the Window System drivers
Installing X.Org Server 1.16 modules ...done.
Setting up the Window System to use the Guest Additions ...done.
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.
Installing graphics libraries and desktop services components ...done.
日期:2020-07-07 20:57:11 来源:oir作者:oir