composefs/grub: Type 1 entry order is arbitrary when os-release has no VERSION_ID/VERSION
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- rust
調査の方向性
crates/lib/src/bootc_composefs/boot.rs の version_opt.unwrap_or_else(|| id.to_hex()) フォールバック(setup_composefs_bls_boot 内)から始め、次に type1_entry_conf_file_name と get_sorted_type1_boot_entries (b.filename.cmp(&a.filename)) を読み、バージョンフィールドがファイル名にどう入るかを確認します。並べ替え用にダイジェストを定数に置き換えつつタイトル内のダイジェストは保持し、次に BLSConfig を 2 つ 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時間
- マージ済み PR(30日)
- 42
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bootc-dev/bootc のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
install: improve error message when systemd-boot is selected without composefs backend再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
メンテナーはふだん 2 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 57/100
メンテナーはふだん 2 日以内に返信
bootc-dev/bootc の issue をすべて見る
似ている 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 日以内に返信