Score:-1

Whenever I run apt I get a string of errors about a failed attempt to remove an old kernel. What should I do?

uz flag
afaan@afaan-VivoBook-ASUS-Laptop-X505ZA-X505ZA:~$ sudo apt purge libplymouth2
[sudo] password for afaan: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  libplymouth2* linux-image-3.13.0-32-generic
  linux-image-extra-3.13.0-32-generic
0 upgraded, 0 newly installed, 3 to remove and 1672 not upgraded.
9 not fully installed or removed.
After this operation, 194 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 221803 files and directories currently installed.)
Removing linux-image-extra-3.13.0-32-generic (3.13.0-32.57) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-32-generic /boot/vmlinuz-3.13.0-32-generic
update-initramfs: Deleting /boot/initrd.img-3.13.0-32-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-32-generic /boot/vmlinuz-3.13.0-32-generic
/usr/sbin/grub-mkconfig: 1: /etc/default/grub: a#: 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-extra-3.13.0-32-generic.postrm line 328.
dpkg: error processing package linux-image-extra-3.13.0-32-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.13.0-32-generic (3.13.0-32.57) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-32-generic /boot/vmlinuz-3.13.0-32-generic
update-initramfs: Deleting /boot/initrd.img-3.13.0-32-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-32-generic /boot/vmlinuz-3.13.0-32-generic
/usr/sbin/grub-mkconfig: 1: /etc/default/grub: a#: 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-3.13.0-32-generic.postrm line 328.
dpkg: error processing package linux-image-3.13.0-32-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-3.13.0-32-generic
 linux-image-3.13.0-32-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
user535733 avatar
cn flag
`/usr/sbin/grub-mkconfig: 1: /etc/default/grub: a#: not found`
Pilot6 avatar
cn flag
What is the Ubuntu version?
Nmath avatar
ng flag
`1672 not upgraded` - your system is seriously deficient with maintenance. 1672 packages not upgraded means that your software is extremely out of date and that you have not performed updates in a very long time. Please run `sudo apt update` and then `sudo apt upgrade` before you attempt to install any new software. If you continue to have issues, please post the results of those commands as an edit.
Score:3
gh flag

Make a backup from your personal datas. you have a somekind of typo in /etc/default/grub and not since today I think.

sudo mv /etc/default/grub /etc/default/grub.broken

Now we restore the file to default.

sudo cp -a /usr/share/grub/default/grub /etc/default/grub

this kernel versions are very old. I would make a clean install of an supported release like ubuntu 20.04

nobody avatar
gh flag
@someone I'm not an expert. the problem lies in a corruppted /etc/default/grub. so the incomming kernel never get correct installt. because after installing a new kernel update-grub will be called and this failes.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.