I am using Linux Ubuntu mate-desktop 4.4.0-24-generic #43-Ubuntu SMP Wed Jun 8 19:27:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux.
Just recently I am experiencing problems with updating and specifically with an older kernel - 4.4.0-22 (linux-image-extra-4.4.0-22-generic). It is marked for removal but not being removed. I am not a Linux guru by any means! I need help here to completely remove this older kernel. Here is what I have copied from the terminal.
root@xxxxxxxxxx-desktop:/home/xxxxxxxxxx# apt-get autoremove -f Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: linux-image-extra-4.4.0-22-generic 0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded. 6 not fully installed or removed. After this operation, 162 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 272391 files and directories currently installed.) Removing linux-image-extra-4.4.0-22-generic (4.4.0-22.40) ... depmod: FATAL: could not load /boot/System.map-4.4.0-22-generic: No such file or directory run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-22-.generic /boot/vmlinuz-4.4.0-22-generic run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-22-generic ./boot/vmlinuz-4.4.0-22-generic Error! Your kernel headers for kernel 4.4.0-22-generic cannot be found. Please install the linux-headers-4.4.0-22-generic package, or use the --kernelsourcedir option to tell DKMS where it's located run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic update-initramfs: Generating /boot/initrd.img-4.4.0-22-generic WARNING: missing /lib/modules/4.4.0-22-generic Ensure all necessary drivers are built into the linux image! depmod: ERROR: could not open directory /lib/modules/4.4.0-22-generic: No such file or directory depmod: FATAL: could not search modules: No such file or directory depmod: WARNING: could not open /var/tmp/mkinitramfs_U8szG6/lib/modules/4.4.0-22-generic/modules.order: No such file or directorydepmod: WARNING: . could not open /var/tmp/mkinitramfs_U8szG6/lib/modules/4.4.0-22-generic/modules.builtin: No such file or directory /usr/sbin/update-initramfs: 206: /usr/sbin/update-initramfs: cannot create /var/lib/initramfs-tools/4.4.0-22-generic: Directory nonexistent run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 2 dpkg: error processing package linux-image-extra-4.4.0-22-generic (--remove): subprocess installed post-removal script returned error exit status 1 Errors were encountered while processing: linux-image-extra-4.4.0-22-generic E: Sub-process /usr/bin/dpkg returned an error code (1) root@xxxxxxxxxx-desktop:/home/xxxxxxxxxx#
Hope this is enough info to get started.