如何禁用 Lubuntu 的图形 grub 主题

如何禁用 Lubuntu 的图形 grub 主题

我在我的电脑上使用 Lubuntu 22.04 LTS,正在测试 grub 编辑。

看起来 Lubuntu 正在使用某种图形界面来显示 grub。 在此处输入图片描述

我可以禁用它以使用与 Ubuntu 默认设置相同的功能吗?

这是我的 grub 配置文件:猫/etc/默认/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_TIMEOUT_STYLE="hidden"
GRUB_TIMEOUT="0"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_DISABLE_OS_PROBER="false"

# 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="640x480"

# 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

Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Sourcing file `/etc/default/grub.d/lubuntu-grub-theme.cfg'
Generating grub configuration file ...
Found theme: /usr/share/grub/themes/lubuntu-grub-theme/theme.txt
Found linux image: /boot/vmlinuz-5.15.0-39-generic
Found initrd image: /boot/initrd.img-5.15.0-39-generic
Found linux image: /boot/vmlinuz-5.15.0-25-generic
Found initrd image: /boot/initrd.img-5.15.0-25-generic
Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/sda4@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done

我可以看到它指向这两个文件:`/etc/default/grub.d/lubuntu-grub-theme.cfg' /usr/share/grub/themes/lubuntu-grub-theme/theme.txt

解决方案是否应该是删除/usr/share/grub/themes/lubuntu-grub-theme/theme.txt所以它不加载它?这能行吗?

答案1

grub 的外观由 管理/etc/grub.d/05_debian_theme。使用 删除此文件的可执行位sudo chmod -x /etc/grub.d/05_debian_theme

/etc/grub.d/04_set-colors创建包含以下内容的文件:

#!/bin/sh
set -e

# Set the colors of the boot-menu. Available colors are

#    black
#    blue
#    green
#    cyan
#    red
#    magenta
#    brown
#    light-gray
#    dark-gray
#    light-blue
#    light-green
#    light-cyan
#    light-red
#    light-magenta
#    yellow
#    white

echo "${1}set menu_color_normal=white/black"
echo "${1}set menu_color_highlight=black/light-gray"

使用以下命令使文件可执行sudo chmod +x /etc/grub.d/04_set-colors

最后跑了sudo update-grub

这将为您提供一个非常基本的 grub 菜单,具有黑色背景和您选择的文本和高亮颜色。

/etc/grub.d/04_set-colors您可以通过删除新创建的文件、恢复可执行文件位/etc/grub.d/05_debian_theme并再次运行来轻松撤消更改sudo update-grub

答案2

解决方案:

我已经能够通过删除数据包来删除主题:

apt purge lubuntu-grub-theme

我必须这样做update-grub,否则我会在 grub 菜单之前收到一条消息:

/usr/share/grub/themes/lubuntu-grub-theme/theme.txt未找到

我确认了@guiverc 的答案,并按照他/她的建议添加了发布版本。

答案3

最近我一直在处理这个问题。我正在运行 22.04.3 LTS。我发现你需要做的就是注释掉该行,然后/etc/default/grub.d/lubuntu-grub-theme.cfg运行sudo update-grub并重新启动。

以下命令将注释掉中的所有行/etc/default/grub.d/lubuntu-grub-theme.cfg,然后更新 grub。

sudo sed -i 's/^/# /' /etc/default/grub.d/lubuntu-grub-theme.cfg
sudo update-grub
reboot

相关内容