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

Labels: support / question, fixed / solved / done, minor bug

scienceandhonor opened issue at 2017-02-26 19:15:

  • rear version (/usr/sbin/rear -V):
    Relax-and-Recover 2.00 / Git

  • OS version (cat /etc/rear/os.conf or lsb_release -a):
    Debian GNU/Linux 8.7 (jessie)

  • rear configuration files (cat /etc/rear/site.conf or cat /etc/rear/local.conf):
    OUTPUT=USB
    BACKUP=NETFS
    BACKUP_URL=usb:///dev/disk/by-label/REAR-000

  • Are you using legacy BIOS or UEFI boot?
    UEFI

  • Brief description of the issue:

    • successfully created USB backup on computer A (laptop running mint serena)
    • inserted same USB into computer B (raspberry pi running osmc (debian))
    • tried to create backup of computer B using the above conf
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.'\''
--------------------
  • Work-around, if any:
    I doubt I can be of any help here, sorry. Let me know if you need more log extracts or if I can help by testing

gozora commented at 2017-02-26 19:28:

Hello @scienceandhonor,

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

jsmeix commented at 2017-03-02 09:13:

@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 at 2017-03-02 18:37:

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 at 2017-03-03 10:45:

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 at 2017-03-03 10:58:

@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 at 2017-03-03 14:43:

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 at 2017-03-07 21:32:

@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 at 2017-03-07 21:48:

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 at 2017-03-08 10:24:

@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 at 2017-03-09 19:30:

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

jsmeix commented at 2017-03-10 08:50:

@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 at 2017-03-10 08:59:

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

7k0l4n5k1 commented at 2019-11-21 16:48:

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


[Export of Github issue for rear/rear.]