每次运行 apt 时,我都会收到一串错误,提示尝试删除旧内核失败。我该怎么办?

每次运行 apt 时,我都会收到一串错误,提示尝试删除旧内核失败。我该怎么办?
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)

答案1

备份您的个人数据。我认为您的 /etc/default/grub 中存在某种拼写错误,并且从今天起就没有出现过。

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

现在我们将文件恢复为默认值。

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

这个内核版本太旧了。我会全新安装受支持的版本,例如 ubuntu 20.04

相关内容