@@ -59,6 +59,13 @@ pub(crate) fn install_via_bootupd(
5959 // When not running inside the target container (through `--src-imgref`) we chroot
6060 // into the deployment before running bootupd. This makes sure we use binaries
6161 // from the target image rather than the buildroot
62+ // But then `/target` (or wherever the user mounted the target FS) is not available,
63+ // but since bootupd use that just to find the underlying device,
64+ // we can use the deployement path just fine.
65+ // Another way of doing this would be to enforce having the target
66+ // rootfs mounted under `/run` so we'd get access to it as part of
67+ // the standard bind-mounts below.
68+ let chroot_root: Option < & str > ;
6269 let bind_mount_dirs = [ "/dev" , "/run" , "/proc" , "/sys" ] ;
6370 let chroot_args = if let Some ( target_root) = abs_deployment_path. as_deref ( ) {
6471 tracing:: debug!( "Setting up bind-mounts before chrooting to the target deployment" ) ;
@@ -70,10 +77,12 @@ pub(crate) fn install_via_bootupd(
7077 tracing:: debug!( "bind mounting {}" , dest. display( ) ) ;
7178 rustix:: mount:: mount_bind_recursive ( src, dest) ?;
7279 }
80+ chroot_root = Some ( "/" ) ;
7381 // Append the `bootupctl` command, it will be passed as
7482 // an argument to chroot
7583 vec ! [ target_root. as_str( ) , "bootupctl" ]
7684 } else {
85+ chroot_root = None ;
7786 vec ! [ ]
7887 } ;
7988
@@ -89,7 +98,8 @@ pub(crate) fn install_via_bootupd(
8998 . args ( [ "backend" , "install" , "--write-uuid" ] )
9099 . args ( verbose)
91100 . args ( bootupd_opts. iter ( ) . copied ( ) . flatten ( ) )
92- . args ( [ "--device" , devpath. as_str ( ) , rootfs. as_str ( ) ] )
101+ . args ( [ "--device" , devpath. as_str ( ) ] )
102+ . args ( chroot_root. or ( Some ( rootfs. as_str ( ) ) ) )
93103 . log_debug ( )
94104 . run_inherited_with_cmd_context ( ) ;
95105
0 commit comments