diff --git a/crates/composefs-setup-root/src/main.rs b/crates/composefs-setup-root/src/main.rs index 774590e3..2d55bda4 100644 --- a/crates/composefs-setup-root/src/main.rs +++ b/crates/composefs-setup-root/src/main.rs @@ -254,8 +254,13 @@ fn gpt_workaround() -> Result<()> { major(rootdev.st_rdev), minor(rootdev.st_rdev) ); - symlink(target, "/run/systemd/volatile-root")?; - Ok(()) + // Handle the case where the symlink was already created before us, + // e.g. by ostree-prepare-root + // (https://github.com/ostreedev/ostree/pull/3608). + match symlink(target, "/run/systemd/volatile-root") { + Ok(()) | Err(Errno::EXIST) => Ok(()), + Err(err) => Err(err).context("Creating /run/systemd/volatile-root"), + } } /// Strips the optional insecure `?` prefix from a karg value.