Ubuntu 18.04 stuck at upgrading linux-header

8,298

Solution 1

TLDR: Disable Secure Boot.

I started having this same issue about a month ago. For me it turns out the solution was disabling Secure Boot. I've had Secure Boot disabled since I installed Ubuntu 18.04 and it's upgraded without any problems. However, about a month ago, I updated my BIOS which re-enabled Secure Boot (I didn't know this at the time). It was frustrating having the upgrades freeze and I finally figured it out because my VirtualBox installation was also not working. The fix for VirtualBox was disabling Secure Boot which also fixed my linux-headers-<version>-generic upgrades.

As noted in the question, it would freeze here:

...
Setting up linux-headers-4.15.0-38-generic (4.15.0-38.41) ...

After disabling Secure Boot, I get:

...
Setting up linux-headers-4.15.0-38-generic (4.15.0-38.41) ...
/etc/kernel/header_postinst.d/dkms:
Secure Boot not enabled on this system.
...
done

Solution 2

My solution;

  • ps aux | grep apt
  • Kill the apt process
  • sudo dpkg --configure -a
  • apt update
  • apt upgrade

Solution 3

You may check the answer on /var/log/apt/term.log. This is the location for the apt-get log. You can also check the dpkg log file /var/log/dpkg.log apt or apt-get you are using are based on dpkg internal.

One more thing you can identify the process by ID and run strace -p to check exactly why it stops.

This is rather a general answer to this or similar questions.

Share:
8,298

Related videos on Youtube

Masqueey
Author by

Masqueey

Updated on September 18, 2022

Comments

  • Masqueey
    Masqueey over 1 year

    Whenever I try to get my system up-to-date in Ubuntu 18.04, it stops: stuck whenever it reaches Setting up linux-headers-<version>-generic. I cannot cancel the upgrading from there, but even when you and leave it for hours, it doesn't change anything. If I check the process in htop it shows it now doing anything. If I force the upgrade to end and try to restart it, when I retry the upgrade it says a previous one has been interrupted and I should try it with sudo dpkg --configure -a which fixes the problem.

    I just find it very annoying to have to do this every time there is a header-upgrade available, especially because I feel like it shouldn't happen and there should be a more permanent fix available. What am I missing or doing wrong?

    • George Udosen
      George Udosen over 5 years
      Did you run that command sudo dpkg --configure -a?
    • Masqueey
      Masqueey over 5 years
      Yes, that did solve it. But I only get that option after I break the upgrade in the first place and it feels wrong to use a solution like this instead of a more permanent solution.
    • George Udosen
      George Udosen over 5 years
      There is no permanent solution but Ubuntu has mechanisms in place to handle these when they occur, but of course routine updates also help.
  • Doktor J
    Doktor J about 5 years
    Thank you for this answer. I got hung up at the same place... rebooted, disabled secure boot, successfully updated, rebooted and re-enabled secure boot, and went on my merry way.
  • TonyG
    TonyG over 4 years
    Adding this to my personal diagnostic notes. Excellent tip. Thanks.