在 Ubuntu 20 上安装 virtualbox-dkms 时出错

在 Ubuntu 20 上安装 virtualbox-dkms 时出错

Ubuntu 20.04。我使用软件包安装了 VirtualBox;它工作正常,我创建并运行了 RM。但在软件更新后停止工作。我无法运行虚拟机,消息显示:

Kernel driver not installed (rc=-1908)

The VirtualBox Linux kernel driver is either not loaded or not set up correctly. 
Please reinstall virtualbox-dkms package and load the kernel module by executing

'modprobe vboxdrv'

as root.

我设法禁用安全启动,所以这与此无关。

现在我尝试按要求重新安装 virtualbox-dkms 包:

sudo apt remove virtualbox-dkms
sudo apt install virtualbox-dkms

但后来我收到以下错误:

Préparation du dépaquetage de .../virtualbox-dkms_6.1.10-dfsg-1~ubuntu1.20.04.1_amd64.deb ...
Dépaquetage de virtualbox-dkms (6.1.10-dfsg-1~ubuntu1.20.04.1) ...
Paramétrage de virtualbox-dkms (6.1.10-dfsg-1~ubuntu1.20.04.1) ...
Loading new virtualbox-6.1.10 DKMS files...
Building for 5.8.0-34-generic
Building initial module for 5.8.0-34-generic
Error! Bad return status for module build on kernel: 5.8.0-34-generic (x86_64)
Consult /var/lib/dkms/virtualbox/6.1.10/build/make.log for more information.
dpkg: erreur de traitement du paquet virtualbox-dkms (--configure) :
 installed virtualbox-dkms package post-installation script subprocess returned error exit status 10
Des erreurs ont été rencontrées pendant l'exécution :
 virtualbox-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)

如果我查看 /var/lib/dkms/virtualbox/6.1.10/build/make.log 我会看到:

/var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/linux/SUPDrv-linux.c:760:38: error: ‘cpu_tlbstate’ undeclared (first use in this function); did you mean ‘cpuhp_state’?
  760 |     RTCCUINTREG uOld = this_cpu_read(cpu_tlbstate.cr4);
      |                                      ^~~~~~~~~~~~
./include/linux/percpu-defs.h:318:9: note: in definition of macro ‘__pcpu_size_call_return’
  318 |  typeof(variable) pscr_ret__;     \
      |         ^~~~~~~~
/var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/linux/SUPDrv-linux.c:760:24: note: in expansion of macro ‘this_cpu_read’
  760 |     RTCCUINTREG uOld = this_cpu_read(cpu_tlbstate.cr4);
      |                        ^~~~~~~~~~~~~
/var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/linux/SUPDrv-linux.c:760:38: note: each undeclared identifier is reported only once for each function it appears in
  760 |     RTCCUINTREG uOld = this_cpu_read(cpu_tlbstate.cr4);
      |                                      ^~~~~~~~~~~~
./include/linux/percpu-defs.h:318:9: note: in definition of macro ‘__pcpu_size_call_return’
  318 |  typeof(variable) pscr_ret__;     \
      |         ^~~~~~~~
/var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/linux/SUPDrv-linux.c:760:24: note: in expansion of macro ‘this_cpu_read’
  760 |     RTCCUINTREG uOld = this_cpu_read(cpu_tlbstate.cr4);
      |                        ^~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:290 : /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/linux/SUPDrv-linux.o] Erreur 1
make[2]: *** Attente des tâches non terminées....
make[1]: *** [scripts/Makefile.build:519 : /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv] Erreur 2

我错过了什么?

答案1

这是 5.8 内核和 Virtualbox 版本 6.1.10 的一个错误 https://bugs.launchpad.net/ubuntu/+source/virtualbox/+bug/1891916

但是,您可以从 Virtualbox 本身安装 Virtualbox 版本 6.1.16,它可以与内核 5.8 一起使用并且会保持更新。 https://www.virtualbox.org/wiki/Linux_Downloads

来自指示

添加 Repo:

echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list

安装密钥:

wget https://www.virtualbox.org/download/oracle_vbox_2016.asc
sudo apt-key add oracle_vbox_2016.asc

更新你的仓库:

sudo apt update

安装 Virtualbox 6.1

sudo apt install virtualbox-6.1

希望这可以帮助!

相关内容