"ERROR (dkms apport): kernel package linux-headers-5.8.0-34-generic is not supported" while installing Virtualbox on Ubuntu 20.04 LTS

I am getting this error while installing Virtualbox on Ubuntu 20.04 LTS.

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 (dkms apport): kernel package linux-headers-5.8.0-34-generic is not supported
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
Errors were encountered while processing:
 virtualbox-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)

Solution 1:

I had a very similar looking problem after doing a system update today. I removed virtualbox

sudo apt-get remove virtualbox
sudo apt-get autoremove

and then installed virtualbox from https://www.virtualbox.org/wiki/Linux_Downloads which now works. See also https://forums.virtualbox.org/viewtopic.php?f=7&t=99564

Solution 2:

You seem to have the -proposed repository enabled. Bad Idea.

$ rmadison linux-image-generic | grep groovy
[...]
 linux-image-generic | 5.8.0.33.38          | groovy-security  | amd64, arm64, armhf, ppc64el, s390x
 linux-image-generic | 5.8.0.33.38          | groovy-updates   | amd64, arm64, armhf, ppc64el, s390x
 linux-image-generic | 5.8.0.34.39          | groovy-proposed  | amd64, arm64, armhf, ppc64el, s390x

Your question states that you are using kernel version 5.8.0.34. You can see that version is ONLY available (as of today) in the groovy-proposed repository.

  • The -proposed pocket of the Ubuntu repositories is for testing packages before release into -updates. In a few days or weeks, the package will migrate to -updates...or might be withdrawn if it fails testing.

  • Advice: As a new user, DON'T use -proposed. It's likely to cause breakage exactly like you encountered.


How to fix the problem:

First, stop using the -proposed source.

Second, wait a few days or weeks for the -proposed packages already on your system to be properly integrated with your system (that's one reason they are in -proposed!). Then dkms will automagically work, and the install will work properly.

Alternately, folks who have proper skills can downgrade their packages. That's not a trivial operation for a beginner, and it risks various forms of breakage, so I'm not going to explain that in detail.