我正在运行 Ubuntu 22.04,一切都很好。今天我这样做了sudo apt update && sudo apt upgrade
,最后我收到了以下警告:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
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-37-generic
Found initrd image: /boot/initrd.img-5.15.0-37-generic
Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
据我所知,os-prober
在同一台机器上安装多个操作系统时会使用,那么为什么会出现此警告?我只安装了 Ubuntu 22.04。是因为找到了两个内核吗?
Memtest86+ 已经在评论中解决了,但是呢os-prober
?
以下是 的内容/etc/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_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"
答案1
该警告是由 生成的/etc/grub.d/30_os-prober
,看一下第 43 至 59 行:
if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
grub_warn "$(gettext_printf "os-prober will not be executed to detect other bootable partitions.\nSystems on them will not be added to the GRUB boot configuration.\nCheck GRUB_DISABLE_OS_PROBER documentation entry.")"
exit 0
elif [ "x${GRUB_DISABLE_OS_PROBER}" = "xauto" ]; then
# UBUNTU: We do not want to disable os-prober on upgrades if we found items before.
if test -e /boot/grub/grub.cfg && ! grep -q osprober /boot/grub/grub.cfg; then
grub_warn "$(gettext_printf "os-prober will not be executed to detect other bootable partitions.\nSystems on them will not be added to the GRUB boot configuration.\nCheck GRUB_DISABLE_OS_PROBER documentation entry.")"
exit 0
fi
fi
if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober > /dev/null ; then
# missing os-prober and/or linux-boot-prober
exit 0
fi
grub_warn "$(gettext_printf "os-prober will be executed to detect other bootable partitions.\nIts output will be used to detect bootable binaries on them and create new boot entries.")"
您有多种选择:
忽略警告,这只是一个警告,而不是错误。
GRUB_DISABLE_OS_PROBER=false
在 中设置变量/etc/default/grub
。警告将更改为os-prober will be executed to detect...
,正如我们在脚本片段中看到的那样。从 中删除可执行位
/etc/grub.d/30_os-prober
。这将阻止脚本的执行,因此您不会收到任何此类警告。您可以使用以下方法执行此操作:sudo chmod -x /etc/grub.d/30_os-prober
编辑脚本
/etc/grub.d/30_os-prober
。如果你用 注释掉这些行grub_warn
,脚本将运行而不会发出这些警告。