14

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?

3
  • Did you run that command sudo dpkg --configure -a? – George Udosen Aug 25 '18 at 12:49
  • 4
    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. – Masqueey Aug 30 '18 at 10:24
  • There is no permanent solution but Ubuntu has mechanisms in place to handle these when they occur, but of course routine updates also help. – George Udosen Aug 30 '18 at 11:23
10

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
1
  • 3
    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. – Doktor J Feb 28 '19 at 13:20
7

My solution;

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

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.

1
  • 1
    Adding this to my personal diagnostic notes. Excellent tip. Thanks. – TonyG Nov 6 '19 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.