Virtualbox 6.1.10, Ubuntu 20.04 bad return status build on kernel 5.8.0, package virtualbox-dkms error
Asked Answered
C

2

9

Not so much as a question as a documentation.

This is regarding a failing apt-get install or update related to virtualbox 6.1.10, Ubuntu 20.04, and virtualbox-dkms package failing to build.

I had an issue recently with Ubuntu 20.04 and Virtual Box 6.1.10 that's similar to what has been documented here and here.

The issue was that installing virtual box from the ubuntu software center installed v6.1.10 which is incompatible with the current ubuntu kernel version, v 5.8.xx.

These are all known issues, however my problem arose when I erroneously tried reinstalling vbox from the package store. Previously, virtualbox-dkms, had been compiled and reinstalling removes the functioning package and which fails with an error (status 10). So I ended up with an error like this:

Loading new virtualbox-6.1.10 DKMS files...
Building for 5.8.0-36-generic
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
Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
 virtualbox-dkms

This error can be seen either at:

cat /var/log/apt/history.log

---or---

/var/log/apt/term.log

In order to fix this I reinstalled virtualbox v.6.1.16 directly from their website following the instructions found here.

However on subsequent updates I was still receiving the same error regarding virtualbox-dkms, even though the process was no longer used. So, in order to fix this, following this site.

I copied the post install script that was causing failure:

sudo mv /var/lib/dpkg/info/virtualbox-dkms.postinst ./virtualbox-dkms.postinst.bac

then purged the remaining dkms files for the old virtualbox installation and did an update:\

sudo apt-get purge virtualbox-dkms
sudo apt-get update && sudo apt-get upgrade

So far no issues! Hope this helps someone else!

TLDR: Tried to reinstall to fix virtualbox v6.10 from ubuntu software manager. v6.10 has issue with ubuntu 20.04 kernel v5.8. To fix broken package, virtualbox-dkms, remove post-install script and purge old virtualbox v6.1.10 files and install virtualbox directly from their website to get virtualbox ^v6.1.16.

Coleen answered 12/1, 2021 at 14:54 Comment(0)
T
15

I have the same problem too and were able to solve with this steps: First, update and upgrade your ubuntu 20.04 with

sudo apt-get update
sudo apt-get upgrade

then, delete the existing dkms tree package

sudo apt-get remove virtualbox-dkms

Proceed to delete the virtualbox

sudo apt-get remove virtualbox
sudo apt-get autoremove

Download the installer from Virtualbox Download Page

wget https://download.virtualbox.org/virtualbox/6.1.16/virtualbox-6.1_6.1.16-140961~Ubuntu~eoan_amd64.deb

Install the package

sudo dpkg -i virtualbox-6.1_6.1.16-140961_Ubuntu_eoan_amd64.deb

The installation may failed because of some dependency, try running sudo apt-get install -f and then install the package again.

Tinatinamou answered 13/1, 2021 at 9:46 Comment(4)
Amazing, thanks a lot for the great description!! Especially the hint for sudo apt-get install -f was helpful as the installation failed during the first try.Scatter
No need to make a .deb executable.Kienan
This will work until the next kernel upgrade, then you will have to upgrade virtualbox again. It isn't the 6.1.16 virtualbox that fixes the issue for all kernels, it is that version that supports the 5.8 kernel in question. The better advice is to update to the latest available version of virtualbox, rather than a specific version.Camilla
This worked for me when multiple other approaches, upgrades, updates and purges failed. Thanks!Clausen
T
0

In my case liquorix kernel was unsupported:

utku3@utku3:~/software$ sudo apt upgrade

.
.
.
 
depmod...

DKMS: install completed.
Building initial module for 5.12.0-6.2-liquorix-amd64
ERROR (dkms apport): kernel package linux-headers-5.12.0-6.2-liquorix-amd64 is not supported
Error! Bad return status for module build on kernel: 5.12.0-6.2-liquorix-amd64 (x86_64)
Consult /var/lib/dkms/virtualbox/6.1.16/build/make.log for more information.
dpkg: error processing package virtualbox-dkms (--install):
 installed virtualbox-dkms package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
 virtualbox-dkms

So I just removed and re-installed linux-headers-5.12.0-6.2-liquorix-amd64:

utku3@utku3:~/software$ sudo apt remove linux-headers-5.12.0-6.2-liquorix-amd64
.
.
.
The following packages will be REMOVED:
  linux-headers-5.12.0-6.2-liquorix-amd64 linux-headers-liquorix-amd64
.
.
.
utku3@utku3:~/software$ sudo apt install linux-headers-liquorix-amd64 linux-headers-5.12.0-6.2-liquorix-amd64
Tintoretto answered 24/5, 2021 at 14:54 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.