Virtualbox broken after a dist-upgrade -- cannot install virtuabox-dkms nor run modprobe vboxdrv

Tags:

Answer: 1

17 hours ago

I am running Ubuntu 20.04 and recently did a dist-upgrade.

uname -r: 5.8.0-34-generic

I purged Virtualbox and associate files by:

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

After trying to reinstall any software I get the following now:

>>$ sudo apt install --reinstall linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 0 B/1,236 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 328260 files and directories currently installed.)
Preparing to unpack .../linux-headers-5.8.0-34-generic_5.8.0-34.37~20.04.2_amd64.deb ...
Unpacking linux-headers-5.8.0-34-generic (5.8.0-34.37~20.04.2) over (5.8.0-34.37~20.04.2) ...
Setting up linux-headers-5.8.0-34-generic (5.8.0-34.37~20.04.2) ...
/etc/kernel/header_postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.8.0-34-generic

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j8 KERNELRELEASE=5.8.0-34-generic -C /lib/modules/5.8.0-34-generic/build M=/var/lib/dkms/virtualbox/6.1.10/build...(bad exit status: 2)
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-34-generic (x86_64)
Consult /var/lib/dkms/virtualbox/6.1.10/build/make.log for more information.
   ...done.
Setting up virtualbox-dkms (6.1.10-dfsg-1~ubuntu1.20.04.1) ...
Removing old virtualbox-6.1.10 DKMS files...

------------------------------
Deleting module version: 6.1.10
completely from the DKMS tree.
------------------------------
Done.
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: 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-34-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~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 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 its a followup error from a previous failure.
                                                                                                          No apport report written because the error message indicates its a followup err
or from a previous failure.
                           Errors were encountered while processing:
 virtualbox-dkms
 virtualbox
 virtualbox-qt
E: Sub-process /usr/bin/dpkg returned an error code (1)

Running

sudo apt-get install -f

Does not fix the dependency problem. I still get the same output:

>>$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up virtualbox-dkms (6.1.10-dfsg-1~ubuntu1.20.04.1) ...
Removing old virtualbox-6.1.10 DKMS files...

------------------------------
Deleting module version: 6.1.10
completely from the DKMS tree.
------------------------------
Done.
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: 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-34-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~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 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 its a followup error from a previous failure.
                                                                                                          No apport report written because the error message indicates its a followup error from a previous failure.
                           Errors were encountered while processing:
 virtualbox-dkms
 virtualbox
 virtualbox-qt
E: Sub-process /usr/bin/dpkg returned an error code (1)

Reconfiguring as below yields the same message:

sudo dpkg --configure -a

The crash report located at /var/crash/virtualbox-dkms.0.crash indicates the following:

ProblemType: Package
DKMSBuildLog:
 DKMS make.log for virtualbox-6.1.10 for kernel 5.8.0-34-generic (x86_64)
 Thursday, January 07, 2021 AM09:37:43 HKT
 make: Entering directory '/usr/src/linux-headers-5.8.0-34-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:288: /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-34-generic'
DKMSKernelVersion: 5.8.0-34-generic
Date: Thu Jan  7 09:37:46 2021
DuplicateSignature: dkms:virtualbox-dkms:6.1.10-dfsg-1~ubuntu1.20.04.1:/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’?
Package: virtualbox-dkms 6.1.10-dfsg-1~ubuntu1.20.04.1
PackageVersion: 6.1.10-dfsg-1~ubuntu1.20.04.1
SourcePackage: virtualbox
Title: virtualbox-dkms 6.1.10-dfsg-1~ubuntu1.20.04.1: virtualbox kernel module failed to build

Any help is appreciated.


After input from @Terrace and others, I tried installing from source. But I still get an error in installing virtualbox-dkms. After that, I uninstalled virtual-dkms directly:

sudo apt-get remove virtualbox-dkms

And then re-attempted the install

sudo dpkg -i virtualbox-6.1_6.1.16-140961~Ubuntu~eoan_amd64.deb
```

Wich succeeded. Thank you!

Answer: 2

26 hours ago

Update

Note:

- This guide will become irrelevant in the near future when proposed migrates to release.

  • 6.1.16-dfsg-6~ubuntu1.20.04.1 is now in the Store 'ubuntu-focal-updates-multiverse' and 5.8 kernel had a few updates with current 5.8.0-40-generic

    Should not be an issue if one keeps up with regular updates.

  • Suggested options 1 and 4 to have future automatic updates for VirtualBox.
  • Option 2, 3a, 3b manual installation does not include automatic future updates for VirtualBox.

Bug

Installation of VirtualBox 6.1.16 on Ubuntu 20.04

Option 1 (Easy)

Pre-released updates (focal-proposed)

    • Open Software & Updates
    • Developer Options
    • select ✅ Pre-released updates (focal-proposed)
    • select Close
    • on Popup The information about available software is out-of-date

      select Reload
    • Open Software Updater
    • deselect all/any other updates except VirtualBox (which will include multiple packages in its subcategory)
    • select Install Now

Previous post

Bug virtualbox-dkms 6.1.10-dfsg-1~ubuntu1.20.04.1 fails to build with kernel 5.8

I followed @Terrance advice and installed 6.1.16 from the source.

My previous VMs are all working.

Edit: Per @BeastOfCaerbannog request/suggestion.


Installation of VirtualBox 6.1.16 on Ubuntu 20.04

Option 2 (Easy)

*if GDebi is not installed > go to Software Store and install it

*if Error: Conflicts with the installed package 'virtualbox-qt' > go to Software Store and Remove Virtualbox 6.1.10


Option 3 a. (Easy)

Option 3 b. (Advanced)

  • In Terminal
cd Downloads 
sudo apt install ./virtualbox-6.1_6.1.16-140961~Ubuntu~eoan_amd64.deb

or

sudo apt install ./v*  

Option 4 (Advanced)

Install Virtualbox by using the Virtualbox repos

 

thanks @Terrance

Added by: Roel Kuhlman

Answer: 3

36 hours ago

Choose the latest working 5.4 kernel instead.

I have 20.04 and this worked for me:

sudo grub-reboot "1>4"

sudo reboot

Or just manually choose the 5.4 kernel at boot.

I guess this bug will be fixed for Ubuntus 5.8 kernel soon.

Answer: 4

9 hours ago

After input from @Terrace and others, I tried installing from source. But I still get an error in installing virtualbox-dkms. After that, I uninstalled virtual-dkms directly:

sudo apt-get remove virtualbox-dkms

And then re-attempted the install

sudo dpkg -i virtualbox-6.1_6.1.16-140961~Ubuntu~eoan_amd64.deb
```

Wich succeeded. Thank you!
Added by: Mr. Junior Lang

Answer: 5

6 hours ago

Virtualbox is directly installable from the ubuntu repositories, so there is no need to fiddle around with Virtualbox downloads, dkms etc. This is all taken care of by the ubuntu packages, including the dkms stuff WITH SECURE BOOT WORKING in case you have it activated and your MOK keys properly installed!!

You install it simply by sudo apt install virtualbox

On Ubuntu 20.04 you usually have kernel 5.4 and virtualbox comes there in version 6.1.10.

With Ubuntu 20.10 you have kernel 5.8 and virtualbox 6.1.14. Both work flawlessly on my machines.

Give it a try! ;-)

Hope that helps

Added by: Mr. Mac Murray

Answer: 6

5 hours ago

Issue

The 5.8.0 kernel seems to be buggy and is no longer part of the upgrade. If it is installed and things fail, it has to be removed.

  1. Boot an older kernel
  2. Remove the 5.8.0 kernel
  3. Fix issues with nvidia drivers (my issue, ymmv)

Boot an older kernel

I prefered to make it possible to select a kernel at boot. There are different paths for this but I chose to change the boot menu from hidden to menu and increase the timeout.

$ sudo vi /etc/default/grub
...
$ grep GRUB_TIMEOUT /etc/default/grub
#GRUB_TIMEOUT_STYLE=hidden
#GRUB_TIMEOUT=0
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=10

Remember to update grub

sudo update-grub

Reboot and select older kernel

A menu is now presented on boot, select "Advanced ..." and select an older kernel (5.4.0-60-generic in my case).

After booting I had to update grub again for the menu setting to keep.

sudo update-grub

Remove the "new" / failing kernel

List installed kernel versions. APT warns that it is not "script friendly", i.e. output can vary, so use scripts with care.

# 
sudo apt list --installed 2>/dev/null | grep -o -E "^linux[^/]+5.8.0-[^/]+"

Remove linux-headers

# First remove linux-headers so that modprobe won't fail on virtualbox
# I had to remove these versions, your list might differ.
sudo apt remove linux-headers-5.8.0-34-generic
sudo apt remove linux-headers-5.8.0-36-generic

Then remove remaining kernel packages

# NB! Handle with care.
# Do this ONLY if you are comfortable, or prepare a list and run one by one.
sudo apt remove $(sudo apt list --installed 2>/dev/null | grep -o -E "^linux[^/]+5.8.0-[^/]+")

Reboot, before starting to fix Nvidia drivers (if applicable to you).

Fix Nvidia drivers

After reverting the kernel my screen setup did not work - external monitors did not load. So I removed the Nvidia packages, booted, then installed them again.

sudo apt remove $(sudo apt list --installed 2>/dev/null | grep -o -E "^nvidia[^/]")
# Remove packages now no longer needed
sudo apt-get autoremove

Reboot - I did this to make absolutely sure of a clean system. You might be able to skip this.

Install Nvidia drivers again.

sudo apt install nvidia-driver-460

Rebooted, and now my external monitors came back to life.

Verify that packages are resolved

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get autoremove

Start Virtualbox and Virtualbox guests.

My VirtualBox guests now started. I did not touch virtualbox at all during this process, only the kernel (and graphics driver).

Revert grub changes

Now would be the time to revert the Grub changes if you would rather skip the wait-for-menu, or bar this opportunity if your PC is in an office space where others have access physically.

Added by: Ms. Creola Jacobs

Answer: 7

33 hours ago

I managed to solve this by the following instruction

The first step is to remove all currently installed VirtualBox

sudo apt-get remove virtualbox
sudo apt-get remove virtualbox-dkms # i have to remove manually

Download new version from page

Close all running VirtualBox instances

Install by running the following command :

sudo dpkg -i virtualbox-6.1_6.1.16-140961~Ubuntu~eoan_amd64.deb

When tried install with apt I got errors.

Added by: Kaylie Krajcik

Answer: 8

6 hours ago

I personally couldn't get it running in 5.8.0 at all, so I decided to downgrade, and it's usually as easy as following @sastorsi answer, just selecting an older kernel at boot from the GRUB, but I went berserk trying to fix this and ended up with no older kernels. If you also happen to have no usable kernels, you can install the latest 5.4.0 with the following command:

sudo apt install linux-image-5.4.0-60-generic linux-headers-5.4.0-60 linux-headers-5.4.0-60-generic

And if you're having trouble with HDMI, WIFI, etc. you must install the kernel modules (I actually ended up reinstalling ubuntu because I didn't know this):

sudo apt install linux-modules-5.4.0-60-generic linux-modules-extra-5.4.0-60-generic

Then remove the buggy kernel:

sudo apt remove linux-image-5.8.0-36-generic && sudo apt autoremove

If it doesn't boot into the desired kernel automatically, you can either choose it at boot from the GRUB, or you can make GRUB pick a specific version with this answer. Basically all you have to do is add "Advanced options for Ubuntu>Ubuntu, with Linux 5.4.0-60-generic" to the GRUB_DEFAULT line, it should look something like this: GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 5.4.0-60-generic"

And finally you should be able to install Virtualbox as usual:

sudo apt install virtualbox virtualbox-dkms
Added by: Russell Considine

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9