Ubuntu – Ubuntu 18.04.1 kernel upgrade stuck at setting up linux-headers-4.15.0-36-generic

18.04kernelupgrade

I am trying to upgrade kernel on my laptop and as I'm doing that very often I never had an issue until last time when I was able to fix the issue with running:

sudo dpkg --configure --pending

As there is a new kernel version, upgrade got stuck again and it's not moving from there:

...
Setting up linux-headers-4.15.0-36-generic (4.15.0-36.39) ...

I have also checked dmesg but I cannot find any issue there.

Command execution were as follows:

sudo apt update
sudo apt list --upgradable
sudo apt upgrade

I would like to skip the "workaround" part and be able to upgrade kernel/packages normally. Hope you can help me!

Please let me know if you need any logs.

Thank you!

Update:

As mentioned by cspan51, I don't have nvidia graphics, I have only intel.

I was able to fix the issue with restart of the laptop, and when fully ready I have started Software Updater, which seems does not have the same problem, tho I am not sure is this correct because under the hood I would say tools are the same.

Solution

Secure boot was the culprit but disabling it does not solve the problem since I don't want to disable it, so actually solution is to do package upgrade with Software Updater (GUI) instead of terminal apt-get/apt .. because in terminal version, it does never asks for secure boot password

Best Answer

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.

Related Question