Skip to content

Commit bb7cb8e

Browse files
Johan-Liebert1cgwalters
authored andcommitted
composefs: Handle backwads compatibility with older versions
While finishing up GC, we had come up with the idea of prepending our boot binaries (UKI PEs, BLS directories) with a certain prefix and we ended up hard requiring these prefixes. If someone has an older version of bootc which they used to install their system with, then upgrade to a new version, many if not all of the important operations would cease to work. This basically handles the backwards compatibility of new binaries on older systems by prepending our custom prefix to all existing boot binaries Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com> Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 0e4b2eb commit bb7cb8e

File tree

7 files changed

+439
-16
lines changed

7 files changed

+439
-16
lines changed

crates/initramfs/src/lib.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,20 @@ pub fn mount_composefs_image(
299299
name: &str,
300300
allow_missing_fsverity: bool,
301301
) -> Result<OwnedFd> {
302-
let mut repo = Repository::<Sha512HashValue>::open_path(sysroot, "composefs")?;
302+
// TODO: Once we're confident no deployments lack meta.json (i.e. all
303+
// users have gone through at least one upgrade cycle), switch back to
304+
// open_path which is a stricter check.
305+
//
306+
// Use init_path instead of open_path to handle upgrades from older
307+
// composefs-rs versions that didn't create meta.json. init_path is
308+
// idempotent: it creates meta.json if missing, and succeeds if it
309+
// already exists with the same algorithm.
310+
let (mut repo, _created) = Repository::<Sha512HashValue>::init_path(
311+
sysroot,
312+
"composefs",
313+
composefs::fsverity::Algorithm::SHA512,
314+
!allow_missing_fsverity,
315+
)?;
303316
if allow_missing_fsverity {
304317
repo.set_insecure();
305318
}

0 commit comments

Comments
 (0)