首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >为什么我会得到“警告: os-prober不会被执行来检测其他可引导的分区”。在运行"apt升级“之后?

为什么我会得到“警告: os-prober不会被执行来检测其他可引导的分区”。在运行"apt升级“之后?
EN

Ask Ubuntu用户
提问于 2022-06-16 00:45:26
回答 1查看 30.8K关注 0票数 13

我在运行Ubuntu22.04,一切都很好。今天我做了sudo apt update && sudo apt upgrade,最后收到了以下警告:

代码语言:javascript
运行
复制
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的内容:

代码语言:javascript
运行
复制
# 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"
EN

回答 1

Ask Ubuntu用户

发布于 2022-06-16 14:10:40

该警告由/etc/grub.d/30_os-prober生成,请查看第43至59行:

代码语言:javascript
运行
复制
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注释掉行,脚本将在不发出警告的情况下运行。
票数 13
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1414245

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档