Public bug reported:
Problem / 问题描述:
The /etc/grub.d/10_linux script in Ubuntu forces the creation of
top-level menu entries and hard-codes the position of the
"Advanced options for Ubuntu" submenu directly after the main Ubuntu
entry. There is no supported configuration to reorder top-level
entries or to control which entries appear on the first page.
Ubuntu 的 /etc/grub.d/10_linux 脚本强制生成顶层菜单项,并且把
"Advanced options for Ubuntu" 子菜单固定插入在 Ubuntu 主条目之后。
用户无法通过任何受支持的配置来调整顶层菜单的顺序,也无法决定
哪些条目显示在第一页。
A typical dual-boot user wants the first page to look like this:
一个典型的双系统用户希望第一页菜单是这样的:
Ubuntu
Windows
Restart
Shutdown
Advanced options for Ubuntu
...
That is: Ubuntu, Windows, Restart, and Shutdown as top-level entries,
with "Advanced options for Ubuntu" moved to the bottom (or hidden
entirely). Ubuntu currently does not allow this.
也就是说:Ubuntu、Windows、重启、关机作为平级顶层条目,高级选项
移到底部(或干脆隐藏)。Ubuntu 当前不允许这种调整。
Two concrete problems:
两个具体问题:
1. Top-level menu order is determined by script execution order and
cannot be configured.
Scripts in /etc/grub.d/ run in numeric filename order. 10_linux
generates the Ubuntu entry, 30_os-prober generates the Windows
entry. As a result, Ubuntu always appears before Windows. Users
cannot swap them through configuration.
1. 顶层菜单的顺序由脚本执行顺序决定,用户无法配置。
/etc/grub.d/ 下的脚本按文件名数字顺序执行。10_linux 生成 Ubuntu
条目,30_os-prober 生成 Windows 条目。结果是 Ubuntu 永远排在
Windows 前面。用户无法通过配置交换它们的位置。
2. The position and visibility of "Advanced options for Ubuntu" cannot
be controlled.
It is force-generated by 10_linux and fixed directly after the main
Ubuntu entry. Users cannot move it to the bottom, cannot hide it,
and cannot control the ordering of entries inside it.
2. "Advanced options for Ubuntu" 的位置和显示无法控制。
它由 10_linux 强制生成,固定插入在 Ubuntu 主条目之后。用户既
不能把它移到底部,也不能隐藏它,更不能决定它内部条目的顺序。
The only workaround is editing /etc/grub.d/10_linux directly, which is
a system script and may be overwritten or broken by package upgrades.
唯一的变通办法是直接编辑 /etc/grub.d/10_linux,但这是系统脚本,
可能在软件包升级时被覆盖或引发错误。
Why this matters / 为什么这个问题重要:
This is not a cosmetic "nice to have". It affects the core experience
of Ubuntu desktop users.
这不是一个"锦上添花"的美化需求,而是影响 Ubuntu 桌面基本盘的
体验问题。
1. Dual-boot is a mainstream Ubuntu desktop scenario.
A large share of Ubuntu users run it alongside Windows. For them,
the boot menu is the first screen seen on every startup. Its order
and content directly shape whether Ubuntu feels professional and
controllable, or forced and messy.
1. 双系统是 Ubuntu 桌面的主流使用场景。
大量 Ubuntu 用户是"Windows 为主、Ubuntu 为辅"的双系统用户。
对于这些用户,启动菜单是每次开机都会看到的第一屏。这一屏的
顺序和内容,直接决定了 Ubuntu 给人的第一印象是"专业、可控"
还是"混乱、被强迫"。
2. The current design puts what users need least in the most prominent
position.
Most dual-boot users only need two entries 99% of the time:
Windows and Ubuntu. Yet the current menu forces "Advanced options"
into the top-level view, while entries users actually want, such as
Restart and Shutdown, are not under unified ordering control. This
is a misplacement of priorities.
2. 当前设计把用户最不需要的东西放在了最显眼的位置。
普通双系统用户 99% 的时间只需要两个选项:Windows 和 Ubuntu。
但当前菜单强制把"Advanced options"塞进顶层视野,而用户真正
想要的"重启""关机"等条目反而不受统一排序控制。这是优先级
的错位。
3. Users are forced to choose between "live with it" and "risk editing
system scripts".
With no supported configuration, users must either accept a menu
that does not match their expectations, or modify a system script
like /etc/grub.d/10_linux and accept upgrade risk. No mature
desktop distribution should leave users in this position.
3. 用户被迫在"忍受"和"冒险改脚本"之间二选一。
官方不提供配置,用户要么接受一个不符合预期的菜单,要么去改
/etc/grub.d/10_linux 这种系统脚本并承担升级风险。这不是一个
成熟桌面发行版应该留给用户的处境。
4. This directly weakens Ubuntu's appeal to dual-boot users.
Windows gives users no customization at all. This is exactly where
Ubuntu could differentiate itself. GRUB's script mechanism already
supports splitting and reordering via filenames. Ubuntu instead
hard-codes the logic inside 10_linux, giving up that advantage for
no reason. Getting this right would give Windows users a real
incentive to install Ubuntu for a better boot experience.
4. 这直接削弱了 Ubuntu 对双系统用户的吸引力。
Windows 的启动菜单完全不给自定义机会,这本来就是 Ubuntu 可以
形成差异化优势的地方。GRUB 的脚本机制本身完全支持拆分和调序,
Ubuntu 却选择把逻辑写死在 10_linux 里,等于主动放弃了这个优势。
把这件事做好,对"Windows 用户为了更好的启动体验而愿意装一个
Ubuntu"是有实际推动作用的。
Suggested improvement / 改进建议:
1. Split the submenu generation logic out of 10_linux into a separate
script (e.g. 11_linux_submenu) so it can be enabled, disabled, or
reordered using the existing /etc/grub.d/ numbering mechanism.
More fundamentally: follow the Unix principle of "one script, one
menu entry". Instead of 10_linux generating multiple top-level
entries and a submenu all at once, each menu entry should be
generated by its own script:
10_linux -> Ubuntu (current kernel)
11_linux_submenu -> Advanced options for Ubuntu
30_os-prober -> Windows (or its own dedicated script)
40_custom -> user-defined entries
...
This is the lowest-cost, most self-contained change. It is almost
a pure code move: the submenu block is already isolated inside
10_linux, and GRUB's /etc/grub.d/ mechanism already supports
enabling, disabling, and reordering scripts by filename. Very
little testing is required beyond confirming that the generated
grub.cfg is unchanged when the new scripts run in their default
positions.
Benefits:
- Users can reorder top-level entries simply by renaming scripts
(e.g. 09_linux before 30_os-prober), without editing system
files or risking upgrade breakage.
- Users can hide any entry by removing its executable bit
(chmod -x) or renaming the script, instead of editing 10_linux.
- Tools like Grub Customizer no longer need to "hijack" GRUB's
script output to reorder or hide entries. They can simply
rename, enable, or disable individual scripts. This would let
such tools work with GRUB's native mechanism instead of against
it, removing the upgrade risk that currently makes them
fragile.
- It aligns with the existing design of /etc/grub.d/, where
scripts like 30_os-prober and 40_custom already each handle a
distinct concern.
1. 将子菜单生成逻辑从 10_linux 中拆分到单独脚本(例如
11_linux_submenu),使其可以通过现有的 /etc/grub.d/ 编号机制
启用、禁用或调整顺序。
更根本地说:遵循 Unix 的"一个脚本只做一件事"原则,让每个菜单项
由独立的脚本生成,而不是让 10_linux 一次性生成多个顶层条目和
子菜单:
10_linux -> Ubuntu(当前内核)
11_linux_submenu -> Advanced options for Ubuntu
30_os-prober -> Windows(或它自己的专用脚本)
40_custom -> 用户自定义条目
...
这是成本最低、最自包含的改动。它几乎只是一次纯粹的代码搬迁:
子菜单块在 10_linux 内部本来就是一个独立部分,而 GRUB 的
/etc/grub.d/ 机制本身就支持按文件名启用、禁用和调整顺序。除了
确认新脚本在默认位置运行时生成的 grub.cfg 保持不变之外,几乎
不需要额外测试。
好处:
- 用户只需重命名脚本(例如把 09_linux 排在 30_os-prober 前面)
就能调整顶层条目的顺序,无需编辑系统文件,也不承担升级风险。
- 用户可以通过移除可执行权限(chmod -x)或重命名脚本来隐藏
任意条目,而不是去改 10_linux。
- Grub Customizer 这类工具不再需要"劫持"GRUB 的脚本输出来
调整顺序或隐藏条目。它们只需重命名、启用或禁用单个脚本即可。
这让这类工具能够顺应 GRUB 的原生机制,而不是与之对抗,从而
消除目前让它们如此脆弱的升级风险。
- 这与 /etc/grub.d/ 的现有设计一致:30_os-prober 和 40_custom
本来就各自处理一个独立的关注点。
2. Provide a supported configuration mechanism for top-level menu
order, for example through a variable in /etc/default/grub or a
user-editable ordering file.
2. 提供一个受支持的配置机制,让用户可以指定顶层菜单项的顺序,
例如通过 /etc/default/grub 中的变量,或者通过一个用户可编辑的
排序文件。
3. Allow "Advanced options for Ubuntu" to be moved or hidden, for
example via GRUB_ADVANCED_SUBMENU_POSITION=hidden|top|bottom.
3. 允许用户隐藏或移动 "Advanced options for Ubuntu" 子菜单,例如
提供 GRUB_ADVANCED_SUBMENU_POSITION=hidden|top|bottom 之类的
配置项。
4. Ideally, Restart and Shutdown entries should also be included in
unified ordering control.
4. 理想情况下,重启、关机等条目也应纳入统一的排序控制。
This does not require changes to GNU GRUB upstream syntax. The problem
is entirely in Ubuntu's own /etc/grub.d/ script structure. GRUB's
script mechanism already supports splitting and reordering via
filenames. Ubuntu simply chooses to hard-code the logic inside
10_linux, leaving no configuration space for users.
这不需要修改 GNU GRUB 上游的语法。问题完全出在 Ubuntu 自己的
/etc/grub.d/ 脚本结构上。GRUB 的脚本机制本身已经支持通过文件名
拆分和调整顺序,只是 Ubuntu 在这里选择了把逻辑写死在 10_linux
内部,没有给用户留下配置空间。
Impact / 影响范围:
Any Ubuntu user with multiple kernels installed is affected,
especially dual-boot users who care about the clarity and
predictability of the boot menu. The boot menu is the first screen
seen on every startup. Its order and content should be controlled by
the user, not hard-coded by a script.
任何安装了多个内核的 Ubuntu 用户都会受到影响,尤其是关心启动菜单
清晰度和可预测性的双系统用户。启动菜单是每次开机都会看到的第一屏,
它的顺序和内容应该由用户掌控,而不是被脚本强制绑定。
** Affects: grub2 (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2167721
Title:
[Wishlist] Allow users to control GRUB top-level menu order and
content (Ubuntu / Windows / Restart / Shutdown / Advanced options)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/2167721/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs