I have a server running Ubuntu 18.04 LTS. This morning I ran an
apt upgrade and during it, the server lost power. Once it was restored, I logged in and noticed there were 2 packages "not fully installed or removed". I tried running
apt-get autoremove, explicit
apt-get remove commands, and numerous solutions found online that I can't remember at the moment.
Nothing seems to help, and I am unable to upgrade/install packages due to apt erring at the corrupt packages. They are kernel packages:
Here is the output of
Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: linux-image-4.15.0-50-generic 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. 3 not fully installed or removed. After this operation, 8,323 kB disk space will be freed. Do you want to continue? [Y/n] (Reading database ... 144087 files and directories currently installed.) Removing linux-image-4.15.0-50-generic (4.15.0-50.54) ... /etc/kernel/postrm.d/initramfs-tools: update-initramfs: Deleting /boot/initrd.img-4.15.0-50-generic /etc/kernel/postrm.d/x-grub-legacy-ec2: Searching for GRUB installation directory ... found: /boot/grub /etc/default/grub: line 12: net.ifnames=0: command not found run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 127 dpkg: error processing package linux-image-4.15.0-50-generic (--remove): installed linux-image-4.15.0-50-generic package post-removal script subprocess returned error exit status 1 Errors were encountered while processing: linux-image-4.15.0-50-generic E: Sub-process /usr/bin/dpkg returned an error code (1)