删除内核包时出现“/usr/sbin/grub-mkconfig: 11: /etc/default/grub: *: not found”错误

删除内核包时出现“/usr/sbin/grub-mkconfig: 11: /etc/default/grub: *: not found”错误

我需要安装一些东西,但它说我需要删除 3.11.0-12-generic 版本的 Linux 内核映像和 3.11.0-12-generic 版本的 Linux 内核额外内容。请帮忙。

miles@Ubuntu-PC:~$ sudo apt-get install -f
[sudo] password for miles: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-3.11.0-12-generic linux-image-extra-3.11.0-12-generic
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 183 MB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 185492 files and directories currently installed.)
Removing linux-image-extra-3.11.0-12-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
update-initramfs: Deleting /boot/initrd.img-3.11.0-12-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
/usr/sbin/grub-mkconfig: 11: /etc/default/grub: splash: 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.11.0-12-generic.postrm line 328.
dpkg: error processing linux-image-extra-3.11.0-12-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.11.0-12-generic ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
update-initramfs: Deleting /boot/initrd.img-3.11.0-12-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.11.0-12-generic /boot/vmlinuz-3.11.0-12-generic
/usr/sbin/grub-mkconfig: 11: /etc/default/grub: splash: 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.11.0-12-generic.postrm line 328.
dpkg: error processing linux-image-3.11.0-12-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-3.11.0-12-generic
 linux-image-3.11.0-12-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

在 /etc/default/grub 中:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash profile”
GRUB_CMDLINE_LINUX=""

答案1

您无法安装任何程序,因为您的系统上有损坏的软件包。考虑到 的输出apt-get install -f,它们的删除由于 中的错误而失败你的/etc/default/grub,第 11 行:

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash profile”

这些不是你要找的引号。你需要一对 either"'。你可以手动更改它们,也可以使用

sudo sed -i -e 's/”/"/g' /etc/default/grub

随后您可以重试删除这些损坏的包裹(sudo apt-get install -f)。

相关内容