Ubuntu 18.04.1 kernel upgrade stuck at setting up linux-headers-4.15.0-36-generic
Solution 1:
I had the exact same problem with my laptop, which has a discrete Nvidia graphics card. I did some research and found that this is problem if fairly common if your machine has an Nvidia graphics card.
I was able to get past this problem by running killing all apt
and dpkg
processes:
sudo killall apt && sudo killall dpkg
Then this to finish configuring the packages:
sudo dpkg --configure -a
After that, the setup finished like it normally does.
Solution 2:
Disabling Secure Boot in bios helped in my case.