for several years I have had an issue where I cannot update packages or upgrade my system. I thought I had found an answer with (How to easily remove old kernels in Ubuntu 20.04 LTS?), but I am even unable to purge old kernels. When I try to purge old kernels I get the following error:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
linux-generic-hwe-22.04 : Depends: linux-image-generic-hwe-22.04 (= 6.2.0.36.37~22.04.14) but 6.2.0.37.38~22.04.15 is installed
linux-image-5.15.0-88-generic : Conflicts: linux-image-unsigned-5.15.0-88-generic but 5.15.0-88.98 is installed
linux-image-unsigned-5.15.0-88-generic : Conflicts: linux-image-5.15.0-88-generic but 5.15.0-88.98 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
When I try to fix the broken install I get the following:
Do you want to continue? [Y/n] y
(Reading database ... 475666 files and directories currently installed.)
Removing linux-image-5.15.0-88-generic (5.15.0-88.98) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.15.0-88-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.2.0-37-generic
Found initrd image: /boot/initrd.img-6.2.0-37-generic
Found linux image: /boot/vmlinuz-6.2.0-36-generic
Found initrd image: /boot/initrd.img-6.2.0-36-generic
Found linux image: /boot/vmlinuz-5.19.0-46-generic
Found initrd image: /boot/initrd.img-5.19.0-46-generic
Found linux image: /boot/vmlinuz-5.19.0-45-generic
Found initrd image: /boot/initrd.img-5.19.0-45-generic
Found linux image: /boot/vmlinuz-5.19.0-43-generic
Found initrd image: /boot/initrd.img-5.19.0-43-generic
Found linux image: /boot/vmlinuz-5.19.0-42-generic
Found initrd image: /boot/initrd.img-5.19.0-42-generic
Found linux image: /boot/vmlinuz-5.15.0-89-generic
Found initrd image: /boot/initrd.img-5.15.0-89-generic
Found linux image: /boot/vmlinuz-5.15.0-76-generic
Found initrd image: /boot/initrd.img-5.15.0-76-generic
Found linux image: /boot/vmlinuz-5.15.0-75-generic
Found initrd image: /boot/initrd.img-5.15.0-75-generic
Found linux image: /boot/vmlinuz-5.15.0-73-generic
Found initrd image: /boot/initrd.img-5.15.0-73-generic
Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot
entries.
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
/usr/sbin/grub-mkconfig: 301: /etc/grub.d/35_fwupd: Exec format error
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 126
dpkg: error processing package linux-image-5.15.0-88-generic (--remove):
installed linux-image-5.15.0-88-generic package post-removal script subprocess
returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
linux-image-5.15.0-88-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
Where I've only copy-pasted the last half of the output or so.
I'm not sure what is wrong or how to fix it and I've been stuck in a loop of trying to fix it only to get errors for everything that I can find online. If anyone can help it would be much appreciated.
EDIT: Output from df -H seems to indicated I have quite a bit of room
Filesystem Size Used Avail Use% Mounted on
tmpfs 765M 2.3M 762M 1% /run
/dev/sda6 324G 175G 132G 58% /
tmpfs 3.9G 197M 3.7G 6% /dev/shm
tmpfs 5.3M 4.1k 5.3M 1% /run/lock
/dev/sda1 269M 35M 234M 13% /boot/efi
tmpfs 765M 160k 764M 1% /run/user/1000
Edit 2:
Thank you for your help! moving the grub file out of the directory did the trick!