Eu tive um problema semelhante, tente isto:
sudo su
rm /var/lib/dpkg/info/*
A partir daqui: link
Estou recebendo esta mensagem frustrante. Eu não mexi com nada relacionado ao sistema.
Reading database ... 264956 files and directories currently installed.)
Removing linux-image-extra-4.4.0-21-generic (4.4.0-21.37) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-21-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
Error! Your kernel headers for kernel 4.4.0-21-generic cannot be found.
Please install the linux-headers-4.4.0-21-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 4.4.0-21-generic cannot be found.
Please install the linux-headers-4.4.0-21-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-21-generic /boot/vmlinuz-4.4.0-21-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-21-generic
WARNING: missing /lib/modules/4.4.0-21-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/4.4.0-21-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_ZtC3GW/lib/modules/4.4.0-21-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_ZtC3GW/lib/modules/4.4.0-21-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
/usr/sbin/grub-mkconfig: 36: /etc/default/grub: i915.preliminary_hw_support=1: not found
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-extra-4.4.0-21-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Removing linux-image-4.4.0-21-generic (4.4.0-21.37) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-21-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-21-generic /boot/vmlinuz-4.4.0-21-generic
/usr/sbin/grub-mkconfig: 36: /etc/default/grub: i915.preliminary_hw_support=1: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.4.0-21-generic.postrm line 328.
dpkg: error processing package linux-image-4.4.0-21-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-4.4.0-21-generic
linux-image-4.4.0-21-generic