At work I use a Thinkpad T440s with Ubuntu Linux. Unfortunately the T440s uses a newer Wi-Fi card so I often find myself upgrading the kernel to get hardware to work. One thing I have always struggled with is getting virtualbox up and running. Specifically, installing the DKMS driver on a custom kernel. It always seemed to throw an error about not being able to find the kernel headers.
Trying to register the VirtualBox kernel modules using DKMSError! Your kernel headers for kernel 4.0.9-040009-generic cannot be found.
As you may be able to tell, I am using the 4.0.9 kernel which I downloaded from the official Ubuntu FTP. After downloading linux-image and linux-headers-all you need to make sure to download linux-headers-generic. Where I messed up was my installation of linux-headers-generic was not successful and I didn't notice. To check if the installation was successful you can check if the headers are installed under /lib/modules/<version>/build. If you do not have the generic headers this directory will not exist. If you see this directory but the DKMS installation still fails you can try specifying the kernel source directory as such:
sudo /sbin/rcvboxdrv setup --kernelsourcedir=/lib/modules/4.0.9-040009-generic/build
That's all there is to it! Try not to get too frustrated :)