@@ -769,6 +769,17 @@ async fn initialize_ostree_root(state: &State, root_setup: &RootSetup) -> Result
769769 // Another implementation: https://github.com/coreos/coreos-assembler/blob/3cd3307904593b3a131b81567b13a4d0b6fe7c90/src/create_disk.sh#L295
770770 crate :: lsm:: ensure_dir_labeled ( rootfs_dir, "" , Some ( "/" . into ( ) ) , 0o755 . into ( ) , sepolicy) ?;
771771
772+ // If we're installing alongside existing ostree and there's a separate boot partition,
773+ // we need to mount it to the sysroot's /boot so ostree can write bootloader entries there
774+ if has_ostree && root_setup. boot . is_some ( ) {
775+ if let Some ( boot) = & root_setup. boot {
776+ let source_boot = & boot. source ;
777+ let target_boot = root_setup. physical_root_path . join ( BOOT ) ;
778+ tracing:: debug!( "Mount {source_boot} to {target_boot} on ostree" ) ;
779+ bootc_mount:: mount ( source_boot, & target_boot) ?;
780+ }
781+ }
782+
772783 // And also label /boot AKA xbootldr, if it exists
773784 if rootfs_dir. try_exists ( "boot" ) ? {
774785 crate :: lsm:: ensure_dir_labeled ( rootfs_dir, "boot" , None , 0o755 . into ( ) , sepolicy) ?;
@@ -1916,7 +1927,9 @@ fn remove_all_except_loader_dirs(bootdir: &Dir, is_ostree: bool) -> Result<()> {
19161927 anyhow:: bail!( "Invalid non-UTF8 filename: {file_name:?} in /boot" ) ;
19171928 } ;
19181929
1919- // Only preserve loader on ostree
1930+ // TODO: Preserve basically everything (including the bootloader entries
1931+ // on non-ostree) by default until the very end of the install. And ideally
1932+ // make the "commit" phase an optional step after.
19201933 if is_ostree && file_name. starts_with ( "loader" ) {
19211934 continue ;
19221935 }
@@ -1927,6 +1940,7 @@ fn remove_all_except_loader_dirs(bootdir: &Dir, is_ostree: bool) -> Result<()> {
19271940 if let Some ( subdir) = bootdir. open_dir_noxdev ( & file_name) ? {
19281941 remove_all_in_dir_no_xdev ( & subdir, false )
19291942 . with_context ( || format ! ( "Removing directory contents: {}" , file_name) ) ?;
1943+ bootdir. remove_dir ( & file_name) ?;
19301944 }
19311945 } else {
19321946 bootdir
0 commit comments