![overlayroot 和 grub2 - grub 菜单始终显示](https://linux22.com/image/1157754/overlayroot%20%E5%92%8C%20grub2%20-%20grub%20%E8%8F%9C%E5%8D%95%E5%A7%8B%E7%BB%88%E6%98%BE%E7%A4%BA.png)
我正在使用overlayroot=tmpfs:swap=1,recurse=0
在 /etc/overlayroot.conf 中配置的 overlayroot。
overlayroot 工作正常。我已设法更新 grub,只需禁用 overlayroot 然后根据需要重新启用它(我正在设置一个图像,因此在此过程中我做了相当多的更改)
问题是,无论我如何设置 grub 配置,重启时 grub 菜单都会出现 30 秒。哦,我应该提一下,每次我运行 update-grub 时都不处于只读模式。
这是我的 grub 配置。我也试过了,但没有成功GRUB_DISABLE_OS_PROBER=true
# 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=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"
# Disable OS Prober for selecting dual boot scenarios.
GRUB_DISABLE_OS_PROBER=true
我认为发生的事情是,overlayroot 更改了挂载点。因此,当禁用 overlayroot 时,它会在不显示 grub 菜单的情况下启动,而启用它时,它会看到更多挂载点并决定加载菜单。
我也尝试过这篇文章中接受的答案:https://serverfault.com/questions/549166/how-to-update-grub-on-a-system-running-overlayroot但是我仍然收到错误“/usr/sbin/grub-probe:错误:无法获取“/dev/mmcblk0p2”的规范路径。”
答案1
好的,解决了,禁用 overlayroot 并添加以下内容:
/etc/默认/grub
GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT
然后更新grub
update-grub
重新启用 overlayroot 并重启