#1266 Issue closed: savelayout workflow could not find bootloader file

Labels: documentation, cleanup, fixed / solved / done, minor bug

gdha opened issue at 2017-03-27 13:05:

  • rear version (/usr/sbin/rear -V): rear-2.xx GIT
  • OS version (cat /etc/rear/os.conf or lsb_release -a): n/a
  • rear configuration files (cat /etc/rear/site.conf or cat /etc/rear/local.conf): n/a
  • Are you using legacy BIOS or UEFI boot? BIOS
  • Brief description of the issue: running for the very first time rear savelayout (before rear mkrescue or rear mkbackup) will always result in the error:
ERROR: 
====================
BUG in /home/gdha/projects/rear/rear/usr/share/rear/layout/save/default/450_check_bootloader_files.sh:
'Unknown bootloader () - ask for sponsoring to get this fixed'
--------------------
  • Work-around, if any: link:
# pwd --> (./usr/share/rear/layout/save/default)
# ln -s ../../../prep/default/500_guess_bootloader.sh 445_guess_bootloader.sh

jsmeix commented at 2017-03-28 08:18:

This is not caused by my latest changes in 500_guess_bootloader.sh
because on an older ReaR GitHub checkout I can reproduce it
when I remove the ReaR stuff in the var/ directory.

The reason is that the savelayout workflow
only runs 450_check_bootloader_files.sh
which fails without a var/lib/rear/recovery/bootloader file.

I will do GitHub pull request to fix the savelayout workflow.

jsmeix commented at 2017-03-28 08:57:

@gdha
your symbolic link workaround is not a proper solution because
it results that during "rear mkrescue" guess_bootloader is run twice:

# ls -l usr/share/rear/layout/save/default/445_guess_bootloader.sh
lrwxrwxrwx 1 root root 45 Mar 28 10:46 usr/share/rear/layout/save/default/445_guess_bootloader.sh -> ../../../prep/default/500_guess_bootloader.sh

# usr/sbin/rear -s savelayout | grep bootloader
Source layout/save/default/445_guess_bootloader.sh
Source layout/save/default/450_check_bootloader_files.sh

# usr/sbin/rear -s mkrescue | grep bootloader
Source prep/default/500_guess_bootloader.sh
Source layout/save/default/445_guess_bootloader.sh
Source layout/save/default/450_check_bootloader_files.sh

Meanwhile I think that bootloader stuff may not belong
to the disk layout.
Currently I wonder whether the check_bootloader_files script
is at the right place in a 'layout' directory.

Or perhaps the BugError "Unknown bootloader..." in the
check_bootloader_files script does not actually belong there
because the meaning of a check_bootloader_files script
is only to do CHECK_CONFIG_FILES for supported
bootloaders but not to check if an unsupported
bootloader is used.

Perhaps it is better to further enhace 500_guess_bootloader.sh
to also error out if an unsupported BOOTLOADER was
specified and remove that BugError "Unknown bootloader..."
from the check_bootloader_files script.

gdha commented at 2017-03-28 09:07:

@jsmeix I tend to agree with you 👍 the error is not on its place here. OTOH - we have to make sure we catch it somewhere else.

jsmeix commented at 2017-03-28 09:09:

I think the root cause of the current mess is that
CHECK_CONFIG_FILES
is used in ambiguous ways:

In default.conf CHECK_CONFIG_FILES is described
to be generally used to check for anything that
needs the ReaR recovery system to be recreated
but it is implemented in the checklayout-workflow which
means according to checklayout-workflow.sh only to
"check if the disk layout has changed"
which does not match the description in default.conf.

From my current point of view it seems the
whole savelayout and checklayout workflows
need to be revised.

gdha commented at 2017-03-28 09:11:

Ok - that makes sense, but we better tackle this piece first and make a separate issue for the latter, no?

jsmeix commented at 2017-03-28 09:12:

I think as a first step I will move the "Unknown bootloader..." error
out of 450_check_bootloader_files.sh
and into 500_guess_bootloader.sh.
This would not fix this issue here.
It is only meant as a first step to get things sorted out.

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

Yes, first things first and separated issues for the rest.

jsmeix commented at 2017-03-28 09:34:

I think when we move the guess_bootloader script
from prep/default/500_guess_bootloader.sh
to layout/save/default/445_guess_bootloader.sh
everything could be o.k.

Reason:

Currently the 500_guess_bootloader script
is run in those workflows:
mkbackuponly mkbackup mkrescue udev

# for w in $( ls usr/share/rear/lib/*-workflow.sh | cut -d '/' -f 5 | cut -d '-' -f 1 ) ; do usr/sbin/rear -s $w | grep 500_guess_bootloader && echo $w ; done
Source prep/default/500_guess_bootloader.sh
mkbackuponly
Source prep/default/500_guess_bootloader.sh
mkbackup
Source prep/default/500_guess_bootloader.sh
mkrescue
Source prep/default/500_guess_bootloader.sh
udev

When there is layout/save/default/445_guess_bootloader.sh
it is run in those workflows:
checklayout mkbackuponly mkbackup mkrescue savelayout udev

# for w in $( ls usr/share/rear/lib/*-workflow.sh | cut -d '/' -f 5 | cut -d '-' -f 1 ) ; do usr/sbin/rear -s $w | grep 445_guess_bootloader && echo $w ; done
Source layout/save/default/445_guess_bootloader.sh
checklayout
Source layout/save/default/445_guess_bootloader.sh
mkbackuponly
Source layout/save/default/445_guess_bootloader.sh
mkbackup
Source layout/save/default/445_guess_bootloader.sh
mkrescue
Source layout/save/default/445_guess_bootloader.sh
savelayout
Source layout/save/default/445_guess_bootloader.sh
udev

I.e. when we move the guess_bootloader script
from prep/default/500_guess_bootloader.sh
to layout/save/default/445_guess_bootloader.sh
the guess_bootloader script is still run in all workflows
where it was run before (i.e. that move is backward compatible)
plus it is run in checklayout and savelayout
where the latter should fix this issue here
and the former should fix the bootloader behaviour
also for checklayout.

jsmeix commented at 2017-03-28 09:41:

What bootloader scripts are run after the move:

# for w in $( ls usr/share/rear/lib/*-workflow.sh | cut -d '/' -f 5 | cut -d '-' -f 1 ) ; do usr/sbin/rear -s $w | grep bootloader && echo $w ; done
Source layout/save/default/445_guess_bootloader.sh
Source layout/save/default/450_check_bootloader_files.sh
checklayout
Source layout/save/default/445_guess_bootloader.sh
Source layout/save/default/450_check_bootloader_files.sh
mkbackuponly
Source layout/save/default/445_guess_bootloader.sh
Source layout/save/default/450_check_bootloader_files.sh
mkbackup
Source layout/save/default/445_guess_bootloader.sh
Source layout/save/default/450_check_bootloader_files.sh
mkrescue
Source layout/save/default/445_guess_bootloader.sh
Source layout/save/default/450_check_bootloader_files.sh
savelayout
Source layout/save/default/445_guess_bootloader.sh
Source layout/save/default/450_check_bootloader_files.sh
udev

Looks correct.

I will do a GitHub pull request.

jsmeix commented at 2017-03-28 09:50:

By the way only FYI:

I was wondering about the reason why the layout/save stage
is run for the mkbackuponly workflow.
The layout/save stage is explicitly called in lib/mkbackuponly-workflow.sh
but (as usual) without any comment therein that tells why
so that I needed (as usual) the big 'git log -p --follow' hammer
and fortunately (as unusual ;-) it even tells about the reason:

# git log -p --follow usr/share/rear/lib/mkbackuponly-workflow.sh
...
commit c3685bc5ff0d3ee6c595521a43b0b4f2542151a0
Author: Jeroen Hoekx 
Date:   Wed Oct 26 12:43:30 2011 +0000

    Fix mkbackuponly to use the same excludes as the layout code.
...
+       DISKLAYOUT_FILE=$TMP_DIR/backuplayout.conf
+       SourceStage "layout/save"

jsmeix commented at 2017-03-28 11:20:

@gdha
could you have a look if
https://github.com/rear/rear/pull/1268
looks o.k. for you.

jsmeix commented at 2017-03-28 12:49:

With https://github.com/rear/rear/pull/1268 merged,
I consider this issue to be fixed.


[Export of Github issue for rear/rear.]