[pbs-devel] [PATCH proxmox-backup-restore-image] fix #4477: init: symlink busybox binaries on init
Max Carrara
m.carrara at proxmox.com
Thu Apr 20 14:53:07 CEST 2023
This change makes Busybox symbolically link its inbuilt utils to their
respective locations, allowing them to be invoked through their
absolute path. This means that Busybox inbuilts like e.g. `mount`
and `env` become available at `/bin/mount` and `/usr/bin/env` etc.
In particular, when entering any of the snapshot directories in
`.zfs/snapshot` (e.g. via `cd` or `ls`), ZFS normally mounts the
respective snapshot(s) on demand, using `/usr/bin/env mount [...]`
internally. Before this change, this would fail, rendering ZFS
snapshots unavailable when restoring individual files.
Signed-off-by: Max Carrara <m.carrara at proxmox.com>
---
src/init-shim-rs/src/main.rs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/init-shim-rs/src/main.rs b/src/init-shim-rs/src/main.rs
index a6e093c..083c08f 100644
--- a/src/init-shim-rs/src/main.rs
+++ b/src/init-shim-rs/src/main.rs
@@ -31,6 +31,14 @@ fn main() {
do_mknod("/dev/null", NULL_MAJ, NULL_MIN)
});
+ // tell busybox to symlink its binaries
+ wrap_err("busybox --install -s", || {
+ Command::new("/bin/busybox")
+ .args(["--install", "-s"])
+ .spawn()?;
+ Ok(())
+ });
+
if let Err(err) = run_agetty() {
// not fatal
println!("[init-shim] debug: agetty start failed: {}", err);
--
2.30.2
More information about the pbs-devel
mailing list