默认的 14.04 /etc/default/grub 文件内容是什么?

默认的 14.04 /etc/default/grub 文件内容是什么?

我喜欢这家伙还意外地破坏了我的文件,尽管我是在配置脚本中/etc/default/grub使用>而不是来做到这一点的。提供的答案看起来与我记得的 14.04 桌面默认文件中的内容不同...它包含什么?>>grub

授人以鱼……是否存在一些资源/方法可以用来自己寻找答案,而不必重新安装 14.04 才能找到答案?

答案1

对于这个问题的一部分,仍有可能的答案“教你钓鱼...“:

... 可以自己找到答案而不必重新安装 14.04 才能找到答案?

我搜索/etc/default/grubhttp://packages.ubuntu.com/#search_contents

抱歉,您的搜索未找到任何结果

去掉了第一个/etc,所以第二个源包名称搜索是/default/grub。结果命中:

/usr/share/grub/default/grub grub2-common

我的 Ubuntu 机器上还有这个文件吗?

$ sudo ls /usr/share/grub/default/grub
/usr/share/grub/default/grub

或者,例如:

$ sudo [ -f /usr/share/grub/default/grub ] && echo Found || echo Not\ found
Found

事实上,它就在那里。

其内容是什么?

$ sudo cat /usr/share/grub/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=10
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"

你可能已经发现,与下面的输出相比,还有一行明显不同:Rinzwind 的回答

#GRUB_HIDDEN_TIMEOUT=0

答案2

干得好:

# 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=10
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"

答案3

该文件/etc/default/grub不属于任何包,dpkg -S /etc/default/grub并且apt-file search /etc/default/grub都不会返回任何内容。但是,当它不存在时,会/etc/default/grub生成grub-pc。因此,为了恢复它(或至少真正默认的最新版本),重新安装即可grub-pc

g=/etc/default/grub; [ -f $g ]  && mv $g ${g}.bak
apt purge grub-pc
apt install grub-pc

如果您无法启动而无法访问系统。一个选项是chroot进入。使用 USB Live 发行版启动。然后,在 下安装系统/mnt,重新绑定特殊 fs 和 chroot。

mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot
for d in dev proc sys etc/resolv.conf; do mount --rebind /$d /mnt/$d; done
chroot /mnt

并按照之前的说明进行操作。

相关内容