I guess I updated recently to the latest linux-headers-kernel and my laptop decided to surprise me one morning. It just didn’t boot up. It got stuck at the point where it said it couldn’t find the dkms.conf file.
I found this StackOverflow question really useful.
Basically what I did is to launch it using an old Kernel by holding the Shift button and entering the Grub menu. There you selected the “Advanced” option and pick up an older kernel header.
It launched successfully, then it was simple. Just run this command to see what the issue is:
for i in /var/lib/dkms/*/[^k]*/source; do [ -e "$i" ] || echo "$i";done
In my case, it was the rts_pstor package that I tried to install recently for my SD card reader on my laptop. I removed it and then ran:
sudo apt-get autoremove
sudo apt-get install
And after the process finished successfully, restart and everything is back to normal.