For some reason apt can't uninstall an old kernel and because of this I can't use apt at all since it first tries to do autoremove everytime.

➜ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
2 not fully installed or removed.
After this operation, 155 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 266341 files and directories currently installed.)
Removing linux-image-extra-4.10.0-19-generic (4.10.0-19.21) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-19-generic /boot/vmlinuz-4.10.0-19-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.10.0-19-generic /boot/vmlinuz-4.10.0-19-generic

So far I tried the following after google'ing A LOT

  • installing the package again with APT
  • installing the linux-image- package with APT
  • removing the mention packages with sudo dpkg --remove --force-remove-reinstreq linux-image-extra-4.10.0-19-generic
  • installing the packages with --reinstall tag with APT.

All the steps hangs in the same line.

run-parts: executing /etc/kernel/postinst.d/dkms 4.10.0-19-generic /boot/vmlinuz-4.10.0-19-generic

All I can do after this is just kill the process and remove the locks and try something else or reboot.

And just to be sure I gave it a looooooooong time to finish, but it did not.

There are a lot of space in my drive and my /boot location, so it is definitely not a space issue. Also I saw couple of people encountered smilar issues with Nvidia drivers but I never installed nvidia drivers in the first place. I am using onboard intel gpu in linux.

So at this point I am open to suggestions. Thank you in advance.

1 Answer 1


Ok, after being stuck with this for a week, this is how I solved this.

Reboot, pick advanced options for ubuntu on grub selection then select your current kernels recovery mode.

After recovery mode boots up, just fix packages and clean, this will remove the broken undeleteable linux-image-extra package. And then reboot.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .