diff --git a/bib/cmd/bootc-image-builder/main.go b/bib/cmd/bootc-image-builder/main.go index 5e9ed2d4c..f229437c1 100644 --- a/bib/cmd/bootc-image-builder/main.go +++ b/bib/cmd/bootc-image-builder/main.go @@ -226,7 +226,7 @@ func cmdBuild(cmd *cobra.Command, args []string) error { if err := setup.Validate(); err != nil { return err } - if err := setup.EnsureEnvironment(); err != nil { + if err := setup.EnsureEnvironment(osbuildStore); err != nil { return err } diff --git a/bib/internal/setup/setup.go b/bib/internal/setup/setup.go index 944a64d0c..330f9a373 100644 --- a/bib/internal/setup/setup.go +++ b/bib/internal/setup/setup.go @@ -12,7 +12,7 @@ import ( // EnsureEnvironment mutates external filesystem state as necessary // to run in a container environment. This function is idempotent. -func EnsureEnvironment() error { +func EnsureEnvironment(storePath string) error { osbuildPath := "/usr/bin/osbuild" if util.IsMountpoint(osbuildPath) { return nil @@ -53,6 +53,14 @@ func EnsureEnvironment() error { if err := util.RunCmdSync("mount", "--bind", destPath, osbuildPath); err != nil { return err } + + // And we also forcibly label the store to ensure we're not grabbing container labels + rootType := "system_u:object_r:root_t:s0" + // This papers over the lack of ensuring correct labels for the /ostree root + // in the existing pipeline + if err := util.RunCmdSync("chcon", rootType, storePath); err != nil { + return err + } return nil }