rear / rear

Relax-and-Recover - Linux bare metal disaster recovery and system migration solution (cfr. mksysb, ignite)
http://relax-and-recover.org/
GNU General Public License v3.0
951 stars 256 forks source link

ReaR on Raspberry Pi: BUG in 200_partition_layout.sh: Function get_version could not detect parted version. #1210

Closed scienceandhonor closed 7 years ago

scienceandhonor commented 7 years ago
2017-02-26 19:51:55.454761326 Including layout/save/GNU/Linux/200_partition_layout.sh
2017-02-26 19:51:55.463796827 Entering debugscripts mode via 'set -x'.
+ source git/rear/usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh
++ FEATURE_PARTED_MACHINEREADABLE=
++ FEATURE_PARTED_OLDNAMING=
+++ get_version parted -v
+++ TERM=dumb
+++ parted -v
+++ sed -rn 's/^[^0-9\.]*([0-9]+\.[-0-9a-z\.]+).*$/\1/p'
+++ head -1
++ parted_version=
++ [[ -n '' ]]
++ BugIfError 'Function get_version could not detect parted version.'
++ ((  1 != 0  ))
++ BugError 'Function get_version could not detect parted version.'
++ local this_script=git/rear/usr/share/rear/lib/_input-output-functions.sh
++ local caller_source=git/rear/usr/share/rear/lib/_input-output-functions.sh
++ test git/rear/usr/share/rear/lib/_input-output-functions.sh = git/rear/usr/share/rear/lib/_input-output-functions.sh
++ caller_source=git/rear/usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh
++ test git/rear/usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh
++ Error '
====================
BUG in git/rear/usr/share/rear/layout/save/GNU/Linux/200_partition_layout.sh:
'\''Function get_version could not detect parted version.'\''
--------------------
gozora commented 7 years ago

Hello @scienceandhonor,

There might be a problem with ReaR running RPI. (see issue https://github.com/rear/rear/issues/1197).

jsmeix commented 7 years ago

@scienceandhonor I have zero experience with Raspberry Pi computers but I guess it fails in the same way when you use a separated pristine USB mass storage device on computer B (the Raspberry Pi computer).

scienceandhonor commented 7 years ago

Thanks for letting me know! I doubt that I will be able to help here. I'd probably fry my RPi in the process without getting anything backed up ;).

jsmeix commented 7 years ago

If you are patient and if you are a somewhat experienced Linux user ReaR can be made working in principle on any Linux system because ReaR is only bash scripts that can be adapted and enhanced as needed for any Linux environment. But the precondition is that you know how to work directly with low-level commands like parted, mkfs.*, and so on.

In this particular case the first step is to find out why "get_version could not detect parted version" which means by inspecting the ReaR code (searching the ReaR code for get_version) that in usr/share/rear/lib/layout-functions.sh

# Function to get version from tool.
get_version() {
  TERM=dumb $@ 2>&1 | sed -rn 's/^[^0-9\.]*([0-9]+\.[-0-9a-z\.]+).*$/\1/p' | head -1
}

fails in your case where it is called as

get_version parted -v

so that you should try out what on your computer B the following two commands result (run them as root):

parted -v

TERM=dumb parted -v 2>&1 | sed -rn 's/^[^0-9\.]*([0-9]+\.[-0-9a-z\.]+).*$/\1/p' | head -1

e.g. on my SLES11 system I get:

# parted -v
parted (GNU parted) 2.3
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by .

# TERM=dumb parted -v 2>&1 | sed -rn 's/^[^0-9\.]*([0-9]+\.[-0-9a-z\.]+).*$/\1/p' | head -1
2.3
jsmeix commented 7 years ago

@gozora I wonder if the current strict parted version testing code in layout/save/GNU/Linux/200_partition_layout.sh and layout/prepare/GNU/Linux/100_include_partition_code.sh must nowadays still error out with a BugError or if we could nowadays use a reasonable fallback?

On my SLES10 I have "GNU Parted 1.6.25.1" on my SLES11 I have "parted (GNU parted) 2.3" on my Leap 42.1 I have "parted (GNU parted) 3.1"

As far as I see on my systems only SLES10 needs a working parted version test, all newer systems would work with a fallback_version value so that

version_newer $fallback_version 2.0

results 'true' (i.e. returns 0), cf. lib/layout-functions.sh

gozora commented 7 years ago

Hello @jsmeix, As far as I remember I'm not author of this code, so I really can't give you qualified answer.

V.

scienceandhonor commented 7 years ago

@jsmeix Thanks for the great explanation! I should be able to give this a go. Sadly time is a bit short right now so I have to postpone this for a few days...

scienceandhonor commented 7 years ago

Well, this is a bit embarrassing. Apparently parted was not installed on my RPi... something that never crossed my mind. Sorry about the confusion! I'll try to prepare another ReaR backup USB stick on computer A to be able to try it on my RPi again. If things go smoothly I'll report within the next hour, otherwise this really has to wait for a few days. But I assume this is not really a bug but a case of RTFM...

jsmeix commented 7 years ago

@scienceandhonor regarding "parted was not installed": I hoped the actual root cause is that simple, see also https://github.com/rear/rear/issues/755

But I think in such cases (mandatory stuff is missing) ReaR should error out early with a meaningful error message than to blindly proceed until it errors out at an arbitrary later place with an unexpected error message, cf. https://github.com/rear/rear/issues/755#issuecomment-171603580

scienceandhonor commented 7 years ago

Just to let you know: creating a ReaR backup on my RPi worked fine after installing parted. Thanks for the help!

jsmeix commented 7 years ago

@scienceandhonor many thanks for your feedback! It helps a lot to get a better understanding how ReaR behaves on platforms/architectures that we do not personally have.

FYI: In general only creating a ReaR backup does not tell anything about whether or not later "rear recover" will actually work on replacement hardware, see https://en.opensuse.org/SDB:Disaster_Recovery therein in particular the section about "Inappropriate expectations".

I close this issue because this particular issue is solved.

@scienceandhonor if there are issues with "rear recover" on Raspberry Pi (and I assume there will be issues) please open for each separated issue a new separated GitHub issue and see in particular "Debugging issues with Relax-and-Recover" in https://en.opensuse.org/SDB:Disaster_Recovery

jsmeix commented 7 years ago

Because of the above https://github.com/rear/rear/issues/1210#issuecomment-285003858 I created https://github.com/rear/rear/issues/1233

7k0l4n5k1 commented 5 years ago

Currently I get the following error message: Currently only OUTPUT = PXE is supported on ARM Will rear be running on the raspberry in the foreseeable future, so that a real disaster recovery on usb is possible? thank you