/usr/share/grub/default/grub和/etc/default/grub的用途是什么?我应该编辑哪一个使grub的行为有所不同?(如果您知道,两个不同的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=""
# 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"发布于 2021-02-23 15:36:22
区别在于,/usr/share目录中的所有文件都是示例配置文件。它们是可以复制到/etc目录中的文件,这是系统使用的所有配置文件所在的位置。/etc/default/grub是您编辑以使用GRUB进行更改的文件。完成对文件的更改后,运行grub-update以进行grub更新并使用新设置。
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""这些是我唯一真正编辑过的。默认情况下,DEFAULT会告诉操作系统引导;永远不要编辑这个。这里的TIMEOUT_STYLE告诉它隐藏GRUB菜单;让菜单放在那里。TIMEOUT告诉grub在启动默认条目之前等那么多秒。CMDLINE_LINUX_DEFAULT条目告诉它在没有文本滚动(quiet)和启动屏幕(splash)的情况下引导;删除那些要有""的内容,然后在引导时看到引导消息的滚动。很方便地看到它在哪里失败,如果你看到奇怪的故障,如果它不影响系统的功能的话,你就没有理由完全摆脱它。最后,CMDLINE_LINUX,我从未真正编辑过;在这里添加选项(S)需要在引导时传递到内核中,以启用内核中的函数或纠正启动时的怪癖。
发布于 2021-02-23 16:06:10
文件/usr/share/grub/default/grub是包grub2-common的一部分,而文件/etc/default/grub不是任何包的一部分。
我假设/etc/default/grub是在配置包或安装后脚本时从/usr/share/grub/default/grub复制的,由于缺乏文档,很难分辨。
您需要编辑以更改grub配置的文件是/etc/default/grub;请记住以后运行sudo update-grub。
在/usr/share/grub/default/grub中使用原始文件是有意义的。如果您在编辑/etc/default/grub时搞砸了或者意外地完全删除了它,您可以通过从/usr/share/grub/default/grub复制来轻松地重新创建一个新的/etc/default/grub。
https://askubuntu.com/questions/1318687
复制相似问题