为什么在Ubuntu 20.04上安装virtualbox失败

rsaldnfx  于 2022-12-03  发布在  其他
关注(0)|答案(5)|浏览(318)

I am trying to install virtualbox. I had it installed previously and it worked. Today I tried to add another virtual machine and it started complaining about problems with dkms so I tried to purge and install everything with the following failure.

$  sudo apt install virtualbox
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  dkms libgsoap-2.8.91 libqt5opengl5 libsdl1.2debian libvncserver1 virtualbox-dkms virtualbox-qt
Suggested packages:

I could not submit my question without skipping some output

Building initial module for 5.8.0-36-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/virtualbox-dkms.0.crash'
Error! Bad return status for module build on kernel: 5.8.0-36-generic (x86_64)
Consult /var/lib/dkms/virtualbox/6.1.10/build/make.log for more information.
dpkg: error processing package virtualbox-dkms (--configure):
 installed virtualbox-dkms package post-installation script subprocess returned error exit status 10
dpkg: dependency problems prevent configuration of virtualbox:
 virtualbox depends on virtualbox-dkms (>= 6.1.10-dfsg-1~ubuntu1.20.04.1) | virtualbox-source (>= 6.1.10-dfsg-1~u
buntu1.20.04.1) | virtualbox-modules; however:
  Package virtualbox-dkms is not configured yet.
  Package virtualbox-source is not installed.
  Package virtualbox-modules is not installed.
  Package virtualbox-dkms which provides virtualbox-modules is not configured yet.

dpkg: error processing package virtualbox (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of virtualbox-qt:
 virtualbox-qt depends on virtualbox (= 6.1.10-dfsg-1~ubuntu1.20.04.1); however:
  Package virtualbox is not configured yet.

dpkg: error processing package virtualbox-qt (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates it's a follow-up error from a previous failure.
                                                                                                            No ap
port report written because the error message indicates it's a follow-up error from a previous failure.
                                                                                                       Processing
 triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
Processing triggers for systemd (245.4-4ubuntu3.3) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for shared-mime-info (1.15-1) ...
Errors were encountered while processing:
 virtualbox-dkms
 virtualbox
 virtualbox-qt
E: Sub-process /usr/bin/dpkg returned an error code (1)

dkms error

$ cat /var/lib/dkms/virtualbox/6.1.10/build/make.log DKMS make.log for virtualbox-6.1.10 for kernel 5.8.0-36-generic (x86_64) Tue 12 Jan 12:40:32 GMT 2021 make: Entering directory '/usr/src/linux-headers-5.8.0-36-generic' CC [M] /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/linux/SUPDrv-linux.o
CC [M] /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/SUPDrv.o CC [M] /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/SUPDrvGip.o CC [M] /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/SUPDrvSem.o CC [M] /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/SUPDrvTracer.o CC [M] /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/SUPLibAll.o CC [M] /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/r0drv/alloc-r0drv.o CC [M] /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/r0drv/initterm-r0drv.o
CC [M] /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/r0drv/memobj-r0drv.o
CC [M] /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/r0drv/mpnotification-r0drv.o CC [M] /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/r0drv/powernotification-r0drv.o CC [M] /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/r0drv/linux/assert-r0drv-linux.o In file included from ./include/asm-generic/percpu.h:7, from ./arch/x86/include/asm/percpu.h:556, from ./arch/x86/include/asm/preempt.h:6, from ./include/linux/preempt.h:78, from ./include/linux/spinlock.h:51, from /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/linux/../SUPDrvInternal.h:79, from /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/linux/SUPDrv-linux.c:32: /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/linux/SUPDrv-linux.c: In function ‘supdrvOSChangeCR4’: /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] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [scripts/Makefile.build:519: /var/lib/dkms/virtualbox/6.1.10/build/vboxdrv] Error 2 make: *** [Makefile:1780: /var/lib/dkms/virtualbox/6.1.10/build] Error 2 make: Leaving directory '/usr/src/linux-headers-5.8.0-36-generic'

chhkpiq4

chhkpiq41#

有同样的问题,但终于得到了解决!!!
完全删除Virtualbox并重新安装。
我试过将内核降级,但这对我无效

sudo apt-get purge "^virtualbox-.*"

sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get clean

然后从这个链接下载ubuntu20.04的最新virtualbox版本
https://www.virtualbox.org/wiki/Linux_Downloads
我尝试了许多其他的解决方案,没有一个对我有效。

w41d8nur

w41d8nur2#

尝试从其download page安装virtualbox,以确保它是virtualbox的最新版本(6.1.16)。
如果仍然失败,也许this answer可以提供帮助

o0lyfsai

o0lyfsai3#

删除内核版本如5. 8并降级到5. 4. 0 -60-generic已经解决了这个问题。在使用内核5. 4. 0 -60-generic引导后,我能够使用Synaptic安装Virtualbox,我的新虚拟机可以工作。

ffscu2ro

ffscu2ro5#

不建议从终端安装任何软件,因为你总是会得到该软件的旧版本。因此,它总是更好地安装和下载软件从他们的特定的官方网站。
在你的情况下,最好退出终端,并尝试从各自的官方网站安装virtualbox:
https://www.virtualbox.org/wiki/Linux_Downloads
如果这样也不起作用,请尝试从Synaptic软件包管理器中删除所有virtualbox依赖项,然后再次安装virtualbox。

相关问题