Max Carrara [Thu, 20 Apr 2023 12:53:07 +0000 (14:53 +0200)]
fix #4477: init: symlink busybox binaries on init
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>
Thomas Lamprecht [Wed, 12 Apr 2023 10:29:38 +0000 (12:29 +0200)]
init shim: print package version
use the one from the debian package, as that's what we actually track
but fall back to the cargo one from the init shim (which we normally
don't bump) for developer convenience (env! fails the build if the
variable isn't set).
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
instead of using crates.io - the build still requires network access and
depends on configured APT sources in the build environment, so there's room for
further improvement.
Thomas Lamprecht [Tue, 15 Nov 2022 16:08:31 +0000 (17:08 +0100)]
init shim: drop ttyS1 driver check
the path changed to not include serial8250 directly anymore in jammy
kernel and we just don't really care, not much winning by dying here
if the base ttyS1 dev exists..
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Stefan Reiter [Wed, 16 Jun 2021 10:55:49 +0000 (12:55 +0200)]
build custom ZFS tools without udev requirement
We already include the required sources with the zfsonlinux submodule,
so apply a patch to disable linking against libudev (as I couldn't find
a working configure flag for it?) and build the user space part as well.
Includes dependencies as well as 'strace' for the debug initramfs, which
proved quite useful for debugging.
The init-shim automatically creates the necessary /dev/zfs device node,
and additionally /dev/null to make rust's std::process::Command happy.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Stefan Reiter [Thu, 6 May 2021 15:26:24 +0000 (17:26 +0200)]
add debug initramfs as seperate package
"proxmox-backup-restore-image-debug", containing only the debug
initramfs, so depends on the base "proxmox-backup-restore-image" for the
kernel.
Adapt the init-shim to start an agetty on ttyS1, which the host
can use to connect to a root shell for debugging, and use
create_dir_all, since some debug packages seem to create /sys and /proc
as empty dirs already.
The build_initramfs.sh script is modified to include dependency
resolution via apt-rdepends, so debug packages like agetty (util-linux),
busybox and gdb can easily be added. This now builds both the regular
and the debug binary at once, to avoid downloading shared packages
twice.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Stefan Reiter [Thu, 6 May 2021 15:26:23 +0000 (17:26 +0200)]
kernel: power off on panic
Instead of just rebooting, which may lead to an infinite loop, try to
resolve the situation by just powering off the VM - it can be restarted
any time anyway.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Stefan Reiter [Mon, 26 Apr 2021 13:04:17 +0000 (15:04 +0200)]
add workaround kernel patch for vsock panics
Allocation failures for vsock packet buffers occur routinely when
downloading more than one stream at the same time, with less then 512
MiB of RAM it sometimes even occurs for single downloads.
This appears to fix it in all of my reproducer scenarios, tested with up
to 6 downloads at once in a 128 MiB RAM machine.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Stefan Reiter [Tue, 16 Feb 2021 17:06:51 +0000 (18:06 +0100)]
initial commit
proxmox-restore-vm-data provides means to build a debian package
containing a minimalistic Linux kernel and a corresponding initramfs
image for use in a file-restore VM.
Launched with QEMU/KVM, it boots in 1.6 seconds to userspace (on AMD
2700X) and has a minimal attack surface (no network stack other than
virtio-vsock, no auxiliary device support (USB, etc...), userspace
written in Rust) as opposed to mounting backup archives directly on the
host.
Since our Rust binaries are currently not fully statically linked, we
need to include some libraries into the initramfs as well. This is done
in 'build_initramfs.sh'.
A minimal /init is included as a Rust binary (init-shim-rs), doing only
the bare-minimum userspace setup before handing over control to the
file-restore daemon (see 'proxmox-backup' repository).
The debian package comes with a 'activate-noawait
pbs-file-restore-initramfs' trigger activation to rebuild the cached
initramfs when the base image shipped here updates. This is taken care
of by proxmox-file-restore.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>