为什么我收到“警告:不会执行 os-prober 来检测其他可启动分区。” 运行“apt升级”后?

vmi*_*isq 27 boot grub2 kernel uefi

我运行的是 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
Run Code Online (Sandbox Code Playgroud)

据我所知,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"
Run Code Online (Sandbox Code Playgroud)

moo*_*765 31

警告是由 生成的/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.")"
Run Code Online (Sandbox Code Playgroud)

您有多种选择:

  • 忽略警告,这只是警告,不是错误。

  • GRUB_DISABLE_OS_PROBER=false在 中设置变量/etc/default/grubos-prober will be executed to detect...正如我们在脚本片段中看到的那样,警告将更改为。

  • 从 中删除可执行位/etc/grub.d/30_os-prober。这将阻止脚本的执行,因此您不会收到任何此类警告。您可以通过以下方式做到这一点:

    sudo chmod -x /etc/grub.d/30_os-prober
    
    Run Code Online (Sandbox Code Playgroud)
  • 编辑脚本/etc/grub.d/30_os-prober。如果您用 注释掉这些行grub_warn,脚本将运行而不会发出这些警告。

  • 是的,而且它有效。该脚本包含检查“缺少 os-prober 和/或 linux-boot-prober”,然后退出 (4认同)
  • 另一种选择是“apt purge os-prober” (3认同)