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 virtualboxReading package lists... DoneBuilding dependency tree Reading state information... DoneThe following additional packages will be installed:dkms libgsoap-2.8.91 libqt5opengl5 libsdl1.2debian libvncserver1 virtualbox-dkms virtualbox-qtSuggested packages:

I could not submit my question without skipping some output

Building initial module for 5.8.0-36-genericERROR: 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 10dpkg: 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~ubuntu1.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 unconfigureddpkg: 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 unconfiguredNo apport report written because the error message indicates it's a follow-up error from a previous failure.No apport report written because the error message indicates it's a follow-up error from a previous failure.Processingtriggers 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-dkmsvirtualboxvirtualbox-qtE: 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.logfor virtualbox-6.1.10 for kernel 5.8.0-36-generic (x86_64) Tue 12 Jan12: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.oCC [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.oCC [M]/var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/r0drv/powernotification-r0drv.oCC [M]/var/lib/dkms/virtualbox/6.1.10/build/vboxdrv/r0drv/linux/assert-r0drv-linux.oIn 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: Infunction ‘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 youmean ‘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 | RTCCUINTREGuOld = 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 eachfunction 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 | RTCCUINTREGuOld = 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'

7

Best Answer


Had the same issue But finally got it fixed!!!

By removing Virtualbox completely and reinstalling it.

Tried downgarding the kernel but that did'nt work for me

sudo apt-get purge "^virtualbox-.*"sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get clean

Then download the latest virtualbox version from this link for ubuntu 20.04

https://www.virtualbox.org/wiki/Linux_Downloads

I tried many other solutions, none worked for me.

Try to install virtualbox from its download page to make sure that it's the latest version of virtualbox (6.1.16).
If it's still failing, maybe this answer can help

Removing kernel versions like 5.8 and downgrading to 5.4.0-60-generic has solved the problem. After booting with kernel 5.4.0-60-generic I was able to install Virtualbox using synaptic and my new virtual machine works.

Yes, removing or downgrade your kernel and solved problem. You could use mainline and grub-cusomizer.

grub-cusomizer:https://tipsonubuntu.com/2018/03/11/install-grub-customizer-ubuntu-18-04-lts/

mainline: https://ubuntuhandbook.org/index.php/2020/08/mainline-install-latest-kernel-ubuntu-linux-mint/

Had a similar issue.Steps that I followed:

  • Completely uninstalled and purged the previously failed to install virtualbox files

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

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

  • Ran the installer for "All Distributions" by running wget

wget https://download.virtualbox.org/virtualbox/7.0.6/VirtualBox-7.0.6-155176-Linux_amd64.run

  • Making the file executable

chmod +x ./VirtualBox-7.0.6-155176-Linux_amd64.run

  • Running installing script

sudo ./VirtualBox-7.0.6-155176-Linux_amd64.run

Note: You may need to change the version number for what

the easiest solution is to install libgsoap manually and then try installing VirtualBox, I did the same it worked for me

https://ubuntu.pkgs.org/20.04/ubuntu-universe-amd64/libgsoap-2.8.91_2.8.91-2_amd64.deb.html

above is the link to install

It's not recommended to install any software from Terminal because you always will get the old version of that software .Hence,its always better to install and download software from their particular's official website ..

In ur case,its better to exit the Terminal and try to install virtualbox from their respective official website:

https://www.virtualbox.org/wiki/Linux_Downloads

If this also don't work then try to remove all the virtualbox dependencies from Synaptic Package Manager and againinstall virtualbox ..