My Ubuntu Server 18.04 system, while it continues to work, has become unable to apply any updates. I'm not aware of any system change that I made that could be the culprit.
What can I do to fix this? I've tried autoremove, purge, etc.
Here is typical output but any apt command produces a similar error:
# apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be REMOVED: linux-image-4.15.0-22-generic The following packages will be upgraded: libcephfs2 librados2 ssh-import-id 3 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 1 not fully installed or removed. Need to get 0 B/3,065 kB of archives. After this operation, 8,281 kB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 149817 files and directories currently installed.) Removing linux-image-4.15.0-22-generic (4.15.0-22.24) ... /etc/kernel/postrm.d/initramfs-tools: update-initramfs: Deleting /boot/initrd.img-4.15.0-22-generic /etc/kernel/postrm.d/x-grub-legacy-ec2: Searching for GRUB installation directory ... found: /boot/grub Searching for default file ... found: /boot/grub/default Testing for an existing GRUB menu.lst file ... Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) /usr/sbin/update-grub-legacy-ec2: line 1101: read: read error: 0: Bad file descriptor run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 1 dpkg: error processing package linux-image-4.15.0-22-generic (--remove): installed linux-image-4.15.0-22-generic package post-removal script subprocess returned error exit status 1 Errors were encountered while processing: linux-image-4.15.0-22-generic E: Sub-process /usr/bin/dpkg returned an error code (1)
Thanks to all for the responses. Followed suggestions below. Can't seem to clean it up via apt / dpkg. Here is output:
# sudo update-grub Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.15.0-22-generic Found initrd image: /boot/initrd.img-4.15.0-22-generic Found linux image: /boot/vmlinuz-4.15.0-20-generic Found initrd image: /boot/initrd.img-4.15.0-20-generic done # sudo dpkg --purge linux-image-4.15.0-22-generic dpkg: dependency problems prevent removal of linux-image-4.15.0-22-generic: linux-image-generic depends on linux-image-4.15.0-22-generic. linux-modules-extra-4.15.0-22-generic depends on linux-image-4.15.0-22-generic | linux-image-unsigned-4.15.0-22-generic; however: Package linux-image-4.15.0-22-generic is to be removed. Package linux-image-unsigned-4.15.0-22-generic is not installed. dpkg: error processing package linux-image-4.15.0-22-generic (--purge):
dependency problems - not removing Errors were encountered while processing: linux-image-4.15.0-22-generic