在Ubuntu安装Linux内核4.4.4后,VirtualBox错误

时间:2020-03-21 11:48:41  来源:igfitidea点击:

今天,我将Ubuntu 14.04 LTS系统升级到Linux内核4.4.4.
升级过程到目前为止没有任何错误。
但是,Oracle VirtualBox在升级到内核4.4.4之后不起作用。

每当我开始新的虚拟机时,它会显示以下错误,并没有让Guest机启动。

Kernel driver not installed (rc=-1908)
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
'/sbin/rcvboxdrv setup'
as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.
Where: sublibOsInit what:3
VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support
driver is not installed, On linux, open returned ENOENT.

正如我们可以在上面的 Screen截图中看到的那样,错误向导表示我们可以通过运行命令来解决问题:

$sudo /sbin/rcvboxdrv setup

但它也没有帮助。
我在上面的命令后收到以下错误:

Stopping VirtualBox kernel modules ...done.
Uninstalling old VirtualBox DKMS kernel modulesError! Could not locate dkms.conf file.
File:  does not exist.
 ...done.
Trying to register the VirtualBox kernel modules using DKMSError! DKMS tree already contains: vboxhost-5.0.16
You cannot add the same module/version combo more than once.
 ...failed!
  (Failed, trying without DKMS)
Recompiling VirtualBox kernel modules ...failed!
  (Look at /var/log/vbox-install.log to find out what went wrong)

我不想切换回旧内核。
经过一点谷歌搜索后,我得到了Askubuntu论坛的解决方案。

我遵循了确切的步骤,它按照我的预期工作。

这是我所做的解决上述错误。

添加以下存储库:

$sudo add-apt-repository ppa:ubuntu-toolchain-r/test

更新源列表并安装GCC/G ++:

$sudo apt-get update
$sudo apt-get install gcc-5 g++-5

我们已安装GCC。
现在,运行以下命令以显示已安装的版本。

$ls -lh /usr/bin/gcc*

示例输出:

lrwxrwxrwx 1 root root 7 Apr 8 2014 /usr/bin/gcc -> gcc-4.8
-rwxr-xr-x 1 root root 758K Jan 27 13:10 /usr/bin/gcc-4.8
-rwxr-xr-x 1 root root 858K Dec 6 04:31 /usr/bin/gcc-5
lrwxrwxrwx 1 root root 10 Apr 8 2014 /usr/bin/gcc-ar -> gcc-ar-4.8
-rwxr-xr-x 1 root root 27K Jan 27 13:10 /usr/bin/gcc-ar-4.8
-rwxr-xr-x 1 root root 27K Dec 6 04:31 /usr/bin/gcc-ar-5
lrwxrwxrwx 1 root root 10 Apr 8 2014 /usr/bin/gcc-nm -> gcc-nm-4.8
-rwxr-xr-x 1 root root 27K Jan 27 13:10 /usr/bin/gcc-nm-4.8
-rwxr-xr-x 1 root root 27K Dec 6 04:31 /usr/bin/gcc-nm-5
lrwxrwxrwx 1 root root 14 Apr 8 2014 /usr/bin/gcc-ranlib -> gcc-ranlib-4.8
-rwxr-xr-x 1 root root 27K Jan 27 13:10 /usr/bin/gcc-ranlib-4.8
-rwxr-xr-x 1 root root 27K Dec 6 04:31 /usr/bin/gcc-ranlib-5

如上所述,我的机器有GCC-4.8和GCC-5版本。

然后,使用以下命令更新备选方案:

$sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
$sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 20 --slave /usr/bin/g++ g++ /usr/bin/g++-5

我们必须添加我们自己的替代方案。

最后,选择要使用的替代GCC,如下所示。

$sudo update-alternatives --config gcc

示例输出:

Type the selection. Here I choose gcc-5, so I entered number 2.
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
-----------------------------------------------------------
* 0 /usr/bin/gcc-4.8 40 auto mode
 1 /usr/bin/gcc-4.8 40 manual mode
 2 /usr/bin/gcc-5 20 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/gcc-5 to provide /usr/bin/gcc (gcc) in manual mode

现在,尝试使用命令重新编译VirtualBox内核模块:

$sudo /usr/lib/virtualbox/vboxdrv.sh setup

示例输出:

Stopping VirtualBox kernel modules ...done.
Uninstalling old VirtualBox DKMS kernel modulesError! Could not locate dkms.conf file.
File: does not exist.
 ...done.
Trying to register the VirtualBox kernel modules using DKMSError! DKMS tree already contains: vboxhost-5.0.16
You cannot add the same module/version combo more than once.
 ...failed!
 (Failed, trying without DKMS)
Recompiling VirtualBox kernel modules ...done.
Starting VirtualBox kernel modules ...done.