@@ -758,6 +758,16 @@ async fn initialize_ostree_root(state: &State, root_setup: &RootSetup) -> Result
758758 // Another implementation: https://github.com/coreos/coreos-assembler/blob/3cd3307904593b3a131b81567b13a4d0b6fe7c90/src/create_disk.sh#L295
759759 crate :: lsm:: ensure_dir_labeled ( rootfs_dir, "" , Some ( "/" . into ( ) ) , 0o755 . into ( ) , sepolicy) ?;
760760
761+ // If we're installing alongside existing ostree and there's a separate boot partition,
762+ // we need to mount it to the sysroot's /boot so ostree can write bootloader entries there
763+ if has_ostree && root_setup. boot . is_some ( ) {
764+ if let Some ( boot) = & root_setup. boot {
765+ let source_boot = & boot. source ;
766+ let target_boot = root_setup. physical_root_path . join ( BOOT ) ;
767+ tracing:: debug!( "Mount {source_boot} to {target_boot} on ostree" ) ;
768+ bootc_mount:: mount ( source_boot, & target_boot) ?;
769+ }
770+ }
761771 // And also label /boot AKA xbootldr, if it exists
762772 if rootfs_dir. try_exists ( "boot" ) ? {
763773 crate :: lsm:: ensure_dir_labeled ( rootfs_dir, "boot" , None , 0o755 . into ( ) , sepolicy) ?;
@@ -970,6 +980,23 @@ async fn install_container(
970980 }
971981 }
972982
983+ // For seperate /boot filesystem, the better workaround is
984+ // to inject kernel arguments during installation.
985+ // See discussion in https://github.com/bootc-dev/bootc/issues/1388
986+ if let Some ( boot) = root_setup. boot . as_ref ( ) {
987+ if !boot. source . is_empty ( ) {
988+ let mount_extra = format ! (
989+ "systemd.mount-extra={}:{}:{}:{}" ,
990+ boot. source,
991+ boot. target,
992+ boot. fstype,
993+ boot. options. as_deref( ) . unwrap_or( "defaults" )
994+ ) ;
995+ kargs. extend ( & Cmdline :: from ( mount_extra. as_str ( ) ) ) ;
996+ tracing:: debug!( "Add {mount_extra} to kargs if has seperate /boot" ) ;
997+ }
998+ }
999+
9731000 // Finally map into &[&str] for ostree_container
9741001 let kargs_strs: Vec < & str > = kargs. iter_str ( ) . collect ( ) ;
9751002
@@ -2098,7 +2125,7 @@ pub(crate) async fn install_to_filesystem(
20982125 }
20992126 rootfs_fd
21002127 } else {
2101- target_rootfs_fd. clone ( )
2128+ target_rootfs_fd. try_clone ( ) ?
21022129 } ;
21032130
21042131 match fsopts. replace {
0 commit comments