Ubuntu – Apt and dpkg are unusable since installing kernel 4.13.0-36 hangs. How to skip or cancel installation of kernel version

aptdpkgkernel

I believe the problem is pretty common (seriously Ubuntu?) but anyway, the current state of my laptop is that if I run apt commands it will ask me to do a sudo dpkg --configure -a which then barely runs and stops at:

Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.13.0-36-generic /boot/vmlinuz-4.13.0-36-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.13.0-36-generic /boot/vmlinuz-4.13.0-36-generic

Computer is usable, but for the moment this means that I won't be able to install updates until this issue is fixed.

Anyway, the reason dpkg is broken is because after something like 3 hours of letting the apt upgrade command run, I gave up and killed the process.

Is there any way to just not continue the installation of this kernel version, at least until the dkms script is fixed?

I considered using this solution right here but doing so could be risky and this is my work laptop, so I don't really want to take any risks that could delay my deliveries. If anyone has had this problem or knows more about this subject and can tell me that the solution in that thread should be good enough, that would also solve my question.

Thanks!

Best Answer

  • I had the same problem. In my case, I could connect it to a similar update issue in grub-common, and finally found that /lib/lsb/init-functions is hanging when running hooks on plymouth, which is a graphical boot image. Not OK!

    You could try this with minimal system impact:

    sudo mv /lib/lsb/init-functions.d/99-plymouth ~
    sudo apt install -f
    

    If successful, follow up with:

    cd ~
    sudo rm 99-plymouth
    sudo apt remove --purge plymouth    
    

    Should that fail, you could try the slightly more heavy-handed approach directly, if there's any other lockups caused by plymouth:

    sudo dpkg --force-depends --purge plymouth lightdm plymouth-label plymouth-theme-ubuntu-logo plymouth-theme-ubuntu-text libplymouth4
    sudo apt install -f
    

    Either way, it stops plymouth from locking up your kernel & boot-loader upgrade.

    Consider any normal maintenance:

    sudo apt update && sudo apt upgrade && sudo apt autoremove
    

    Note that this will also remove lightdm if you have it, since there's dependencies on plymouth, so make sure you have an alternative. For example, I have gdm3 installed as default.