When installing packages that require building with linux-headers such as VirtualBox or ZFSonLinux, I usually get the following error messages:
E: Unable to locate package linux-headers-5.4.0-0.bpo.2-amd64
E: Couldn't find any package by glob 'linux-headers-5.4.0-0.bpo.2-amd64'
E: Couldn't find any package by regex 'linux-headers-5.4.0-0.bpo.2-amd64'
Solution
This problem occurred when the version of the linux-headers-amd64 and linux-image-amd64 packages don't match from the Debian repository. Here, the headers are on version 3 whereas the image is on version 2.
The simplest solution is to wait for Debian repository to update. Otherwise, force the installation of your linux-headers-amd64 and linux-image-amd64 packages to be on the same version.
apt-get -y install linux-headers-amd64=5.4.8-1~bpo10+1 apt-get -y install linux-image-amd64=5.4.8-1~bpo10+1
Reference
- https://packages.debian.org/buster-backports/linux-image-amd64
- https://packages.debian.org/buster-backports/linux-headers-amd64