Grub2 自定义错误

Grub2 自定义错误

这里有个过于急切的菜鸟。
我一直在尝试在新安装的 Ubuntu 18.10 上更新 GRUB。
我使用 GRUB Customizer 进行大部分编辑,但它无法更新我的背景图像。

我阅读了一些有关仅编辑/etc/default/grub文件的文档。当我尝试打开 GRUB 定制器或运行时,我目前收到以下错误update-grub

$ sudo update-grub
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
/etc/grub.d/40_custom_proxy: 16: /etc/grub.d/40_custom_proxy: Syntax error: "(" unexpected

我四处寻找,找不到遇到类似问题的人,而且我是这里的新手,除了寻求帮助,我不知道下一步该去哪里。任何正确的方向、提示或技巧,对于诊断此类错误,我将不胜感激。

以下是我的默认 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="saved"
GRUB_TIMEOUT_STYLE="hidden"
GRUB_TIMEOUT="-1"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL="console"

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE="1280x720"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID="true"

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

GRUB_SAVEDEFAULT="true"
export GRUB_COLOR_NORMAL="brown/black"
export GRUB_COLOR_HIGHLIGHT="light-blue/black"
export GRUB_MENU_PICTURE="/home/nicholas/Pictures/Winbuntu_Grub.png"
GRUB_FONT="/boot/grub/unicode.pf2"

如果您需要我添加任何其他信息,请告诉我。(所有这些以及我的背景仍然是紫色的,带有问号边框,这是以后的问题)。

编辑更多信息,更新运行 update-grub 的输出。

40_custom_proxy 的导出:

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
sh -c 'echo "### BEGIN /etc/grub.d/proxifiedScripts/custom ###";
"/etc/grub.d/proxifiedScripts/custom";
echo "### END /etc/grub.d/proxifiedScripts/custom ###";
echo "### BEGIN /etc/grub.d/proxifiedScripts/linux ###";
"/etc/grub.d/proxifiedScripts/linux";
echo "### END /etc/grub.d/proxifiedScripts/linux ###";
echo "### BEGIN /etc/grub.d/proxifiedScripts/uefi-firmware ###";
"/etc/grub.d/proxifiedScripts/uefi-firmware";
echo "### END /etc/grub.d/proxifiedScripts/uefi-firmware ###";' | /etc/grub.d/bin/grubcfg_proxy "-*
-'"{'
-#text
+'Ubuntu'~f65365815d6524671b174d3a3d8b7446~
+'Windows'~4e5144083f338b3f4c81d7083be85d55~
+'SUBMENU' as 'Advanced Options'{+'Memtest'~5a8aaef18d8fdedc01dc802f3e3a375c~, +'SUBMENU' as 'Advanced options for Ubuntu'{+'Advanced options for Ubuntu'/* from '/etc/grub.d/proxifiedScripts/linux', +'Advanced options for Ubuntu'/'Ubuntu, with Linux 4.18.0-16-generic'~785a2bbd696f9fde2acf13125f556608~ from '/etc/grub.d/proxifiedScripts/linux', +'Advanced options for Ubuntu'/'Ubuntu, with Linux 4.18.0-16-generic (recovery mode)'~b715e6520b269cb0b2eeb36de183f057~ from '/etc/grub.d/proxifiedScripts/linux', +'Advanced options for Ubuntu'/'Ubuntu, with Linux 4.18.0-10-generic'~16a33ff9746d2f2788f6363e721c30e9~ from '/etc/grub.d/proxifiedScripts/linux', +'Advanced options for Ubuntu'/'Ubuntu, with Linux 4.18.0-10-generic (recovery mode)'~b2995c4cff62656f6ce79c4ddf33da8e~ from '/etc/grub.d/proxifiedScripts/linux'}, +'System setup'~4e15a6547b9250de59821b594ecf5dee~ from '/etc/grub.d/proxifiedScripts/uefi-firmware'}
" multi

答案1

看来您已经多次使用过 grub/grub 定制器。
如果您还没有使用过 40_custom 文件,并且能够无错误地更新 grub,请按照以下步骤操作。

1. 使用 grub 的自定义背景..

/etc/default/grub在终端中使用以下命令打开文件
sudo -H gedit /etc/default/grub

底线之下

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

粘贴以下内容

GRUB_BACKGROUND="/home/nicholas/Pictures/Winbuntu_Grub.png"

保存文件并关闭。然后运行sudo update-grub并查找以“找到背景图像:”开头的文本,如果出现此文本,则背景将起作用。

例子:

$ sudo update-grub
Generating grub configuration file ...
Found background: /home/pratap/Pictures/Winbuntu_Grub.png
Found background image: /home/pratap/Pictures/Winbuntu_Grub.png
Found linux image: /boot/vmlinuz-4.15.0-34-generic
Found initrd image: /boot/initrd.img-4.15.0-34-generic
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done
$

2. 更改 grub 菜单颜色..

/etc/grub.d/05_debian_theme在终端中使用以下命令打开文件
sudo -H gedit /etc/grub.d/05_debian_theme

转到第 129 行左右并编辑内容如下

if [ -z "${2}" ] && [ -z "${3}" ]; then
        # echo "  true"
        echo "set colro_highlight=light-blue/black"
        echo "set color_normal=green/black"
fi

保存文件并关闭。然后运行sudo update-grub

重新启动才能看到更改。

在此处输入图片描述

参考:https://help.ubuntu.com/community/Grub2/Displays

答案2

无法找到确切答案。我已从实时会话重新安装了 GRUB 并退出。感谢您的关注。

相关内容