all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Max Carrara <m.carrara@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup-restore-image] fix #4477: init: symlink busybox binaries on init
Date: Thu, 20 Apr 2023 14:53:07 +0200	[thread overview]
Message-ID: <20230420125307.1790967-1-m.carrara@proxmox.com> (raw)

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@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





             reply	other threads:[~2023-04-20 12:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 12:53 Max Carrara [this message]
2023-05-17  9:34 ` [pbs-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230420125307.1790967-1-m.carrara@proxmox.com \
    --to=m.carrara@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal