@@ -67,9 +67,15 @@ pub(crate) fn supports_bootupd(root: &Dir) -> Result<bool> {
6767 Ok ( r)
6868}
6969
70+ /// Install the bootloader via bootupd.
71+ ///
72+ /// We pass `--filesystem` pointing at a block-backed mount so that bootupd
73+ /// can resolve the backing device(s) itself via `lsblk`. In the bwrap path
74+ /// we bind-mount the physical root at `/sysroot` to give `lsblk` a real
75+ /// block-backed path; in the non-bwrap path the rootfs mount works directly.
7076#[ context( "Installing bootloader" ) ]
7177pub ( crate ) fn install_via_bootupd (
72- device : & bootc_blockdev:: Device ,
78+ _device : & bootc_blockdev:: Device ,
7379 rootfs : & Utf8Path ,
7480 configopts : & crate :: install:: InstallConfigOpts ,
7581 deployment_path : Option < & str > ,
@@ -91,8 +97,6 @@ pub(crate) fn install_via_bootupd(
9197
9298 println ! ( "Installing bootloader via bootupd" ) ;
9399
94- let device_path = device. path ( ) ;
95-
96100 // Build the bootupctl arguments
97101 let mut bootupd_args: Vec < & str > = vec ! [ "backend" , "install" ] ;
98102 if configopts. bootupd_skip_boot_uuid {
@@ -107,14 +111,17 @@ pub(crate) fn install_via_bootupd(
107111 if let Some ( ref opts) = bootupd_opts {
108112 bootupd_args. extend ( opts. iter ( ) . copied ( ) ) ;
109113 }
110- bootupd_args. extend ( [ "--device" , & device_path, rootfs_mount] ) ;
114+
115+ bootupd_args. extend ( [ "--filesystem" , rootfs_mount] ) ;
116+ bootupd_args. push ( rootfs_mount) ;
111117
112118 // Run inside a bwrap container. It takes care of mounting and creating
113119 // the necessary API filesystems in the target deployment and acts as
114120 // a nicer `chroot`.
115121 if let Some ( deploy) = deployment_path {
116122 let target_root = rootfs. join ( deploy) ;
117123 let boot_path = rootfs. join ( "boot" ) ;
124+ let rootfs_path = rootfs. to_path_buf ( ) ;
118125
119126 tracing:: debug!( "Running bootupctl via bwrap in {}" , target_root) ;
120127
@@ -125,7 +132,10 @@ pub(crate) fn install_via_bootupd(
125132 let cmd = BwrapCmd :: new ( & target_root)
126133 // Bind mount /boot from the physical target root so bootupctl can find
127134 // the boot partition and install the bootloader there
128- . bind ( & boot_path, & "/boot" ) ;
135+ . bind ( & boot_path, & "/boot" )
136+ // Bind mount the physical root at /sysroot so bootupd can resolve
137+ // backing block devices via lsblk for --filesystem
138+ . bind ( & rootfs_path, & "/sysroot" ) ;
129139
130140 // The $PATH in the bwrap env is not complete enough for some images
131141 // so we inject a reasonnable default.
0 commit comments