#3206 PR merged: Portable recovery

schlomo opened issue at 2024-04-09 21:52:

Add OUTPUT=PORTABLE and --portable command line option to faciliate using ReaR in truly portable mode.

The portable archive contains only ReaR, nothing else.

Tested with an OL9 restore via SystemRescueCD

I'll do some more testing both of portable usage and regular usage to ensure that this change doesn't hurt us.

Implements #3190 and should be merged after #3205, where I extracted the unrelated fixes. To review you can simply look at the last commit here.

gdha commented at 2024-04-10 06:39:

I miss some documentation here. Is it possible to add it?

schlomo commented at 2024-04-10 10:35:

@gdha I added a short manual

@jsmeix the help workflow had bad indentation which I of course fixed, besides that I reduced the whitespace changes.

My goal at the moment is to get feedback on this and do some more tests. There will be a second phase of development with further optimisations (for example, I want to see if I can skip the build stage entirely to speed things up).

schlomo commented at 2024-04-10 11:23:

Aaargh, now I get also https://github.com/rear/rear/pull/3168#issuecomment-1983377528 because the TMPDIR is set for portable mode. Which means that I need to extend #3168 to not touch the temp dir for portable mode.

About dracut not showing errors in the ReaR log, I could redirect the output to properly capture it.

jsmeix commented at 2024-04-10 12:14:

I did not have a look here (no time yet)
so the following is only an offhanded thought:

Regarding
https://github.com/rear/rear/pull/3206#issuecomment-2047273428
dracut and portable mode:

Currently we have in sbin/rear

test -e "/etc/rear-release" && RECOVERY_MODE='y' || RECOVERY_MODE=''
readonly RECOVERY_MODE

and we do not change TMPDIR in RECOVERY_MODE

    if ! test "$RECOVERY_MODE" ; then
        # We set TMPDIR to ReaR's TMP_DIR only when we are not in RECOVERY_MODE

so I think you need to enhance how RECOVERY_MODE is set
so that RECOVERY_MODE is also set for "rear recover"
in "portable mode"?

schlomo commented at 2024-04-10 13:28:

@jsmeix about the dracut not showing errors problem I figured out what is going on:

In normal (non-debug) ReaR mode stderr goes to $STDOUT_STDERR_FILE and the Error function can then quote from that. However, our code surrounding dracut doesn't use the Error function but instead only does a LogPrint suggesting to look into the $RUNTIME_LOGFILE, and that is the reason that the logfile doesn't contain useful infos.

How should we solve this? Maybe extract the "pull last lines from stderr" into a function that can then be used? Or add a LogPrintError function that will also show last errors if exist?

I'm not solving this here but I think it is important to keep in mind and fix so that users can get an info about the problem for errors without running ReaR again in debug mode.

jsmeix commented at 2024-04-10 13:39:

I made the separated
https://github.com/rear/rear/issues/3207
regarding
https://github.com/rear/rear/pull/3206#issuecomment-2047547566

schlomo commented at 2024-04-11 18:03:

I found a bug in this code, it doesn't work when used from a dist install :-(

I'll keep debugging then.

schlomo commented at 2024-04-12 14:53:

I found a bug in this code, it doesn't work when used from a dist install :-(

I'll keep debugging then.

It's the Makefile patching the main script, so I'll improve the Makefile for this, too.


[Export of Github issue for rear/rear.]