composefs/grub: Type 1 entry order is arbitrary when os-release has no VERSION_ID/VERSION
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- rust
调研方向
从 crates/lib/src/bootc_composefs/boot.rs 中 version_opt.unwrap_or_else(|| id.to_hex()) fallback(位于 setup_composefs_bls_boot 内)开始,然后阅读 type1_entry_conf_file_name 和 get_sorted_type1_boot_entries(b.filename.cmp(&a.filename)),看看版本字段如何进入文件名。为排序将摘要替换为常量,同时保留标题中的摘要,然后用两个 BLSConfig 传入 get_sorted_type1_boot_entries_helper(.., Bootloader::Grub) 来复现,并运行 composefs 启动测试。完成意味着无论摘要如何,-1 优先级条目都排在最前面。
由索引模型根据 Issue 内容生成。
描述
Summary
When composefs uses GRUB with Type 1 entries, bootc orders the entries by file name, descending (get_sorted_type1_boot_entries, Bootloader::Grub → b.filename.cmp(&a.filename), see #2221). The file name is bootc_{os_id}-{version}-{priority}.conf (type1_entry_conf_file_name). version comes from VERSION_ID, then VERSION, in /usr/lib/os-release.
Some os-release files have neither key, for example Debian sid/testing and Arch Linux. For those, setup_composefs_bls_boot falls back to the deployment's verity digest:
// crates/lib/src/bootc_composefs/boot.rs (main @ 2a59b59, also v1.16.10)
version_opt.unwrap_or_else(|| id.to_hex()),
As a result, the version field is a random hex string that changes with every deployment, and it sorts before the priority field. After an upgrade:
loader/entries/bootc_debian-3f…(new digest)…-1.conf # primary (new)
loader/entries/bootc_debian-c0…(old digest)…-0.conf # secondary (booted)
The descending file-name order puts the old deployment first here, because c > 3. So bootc (and GRUB's blscfg, which uses the same name-version-release order) treats the old deployment as the default, and the upgrade is never booted. With other digests the new one wins. bootc rollback swaps only the priority field, so it is just as arbitrary.
With systemd-boot this does not happen, because the sort-key (bootc-{os_id}-{0,1}) comes first.
Reproducer
bootc install to-disk --composefs-backend --bootloader gruban image whose/usr/lib/os-releasehas noVERSION_IDand noVERSION. A Debian sid based bootc image works, and so does the stock Arch os-release.bootc upgradeto a new image, then reboot so thatbootc-finalize-stagedruns.ls /sysroot/boot/loader/entries: the two entries differ only in the digest and the priority. The-1(new) entry is first only when its digest sorts higher.
The logic needs no VM. Feed two BLSConfigs named as above to get_sorted_type1_boot_entries_helper(.., Bootloader::Grub), and the order follows the digests.
Possible fix
When os-release has no version, use a constant (for example 0) in place of the digest. Then the priority (release) field decides between the deployments of one OS, as it does when VERSION_ID stays the same across builds. The title/version shown to the user can keep the digest.
Context
We hit this while booting TunaOS flounder:gnome-sid (Debian sid, bootc 1.16.10, composefs) through a GRUB chain (tuna-os/wootc#768).
- 主要语言
- Rust
- 星标
- 2.3k
- 派生
- 230
- 平均合并
- 2 天 11 小时
- 30 天内合并 PR
- 42
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bootc-dev/bootc 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
install: improve error message when systemd-boot is selected without composefs backend可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 2 天内回复
-
难度 5/5 一周以上 新手友好度 30/100
维护者通常 2 天内回复
-
难度 3/5 1-2 天 新手友好度 57/100
维护者通常 2 天内回复
相似的 Issue
-
[Bug]: layer.move to the place a layer already has fails and stops a script; with several layers it leaves an empty undo step可能已有人在做 @jgregoriorincon 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
opengeos/RustGIS#2621 · 1 条评论 ·
维护者通常 1 天内回复
-
good first issue web
难度 1/5 1 小时以内 新手友好度 92/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
-
Wait for the IDS correction dialog to settle in the stale-audit test可能已有人在做 @louistrue 今天认领。 未关闭ready
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复