由于 grub 设置不正确,导致下载或安装应用程序时出错

由于 grub 设置不正确,导致下载或安装应用程序时出错

在 Ubuntu 18.04 中通过终端下载或安装应用程序时,发现以下错误:

Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.15.0-101-generic
Found initrd image: /boot/initrd.img-4.15.0-101-generic
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-101-generic
Found initrd image: /boot/initrd.img-4.15.0-101-generic
Found linux image: /boot/vmlinuz-4.15.0-22-generic
Found initrd image: /boot/initrd.img-4.15.0-22-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
/etc/grub.d/50_custom.save: 1: /etc/grub.d/50_custom.save: menuentry: not found
insmod: ERROR: could not load module part_gpt: No such file or directory
/etc/grub.d/50_custom.save: 4: /etc/grub.d/50_custom.save: search: not found
/etc/grub.d/50_custom.save: 5: /etc/grub.d/50_custom.save: linux: not found
/etc/grub.d/50_custom.save: 6: /etc/grub.d/50_custom.save: initrd: not found
/etc/grub.d/50_custom.save: 7: /etc/grub.d/50_custom.save: }#!/bin/sh: not found
error: syntax error.
error: Incorrect command.
error: syntax error.
Syntax error at line 282
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.

我该如何纠正这个问题?

答案1

显然文件中有错误/etc/grub.d/50_custom.save,或者文件根本不应该存在。通常.save文件是临时备份,在编辑后保存原始文件时会被删除。

如果您同时拥有 和50_custom,则50_custom.save删除该文件应该是安全的50_custom.save- 或者将其移动到您的主目录作为备份,直到您确认删除它不会引起任何问题。

相关内容