#2971 Issue open: RHEL: GRUB2 can't find command 'echo' 'linux' 'initrd' 'linuxefi' 'initrdefi' 'search' 'chainloader' 'reboot' 'exit'

Labels: support / question

Jerry2840 opened issue at 2023-04-21 03:38:

  • ReaR version ("/usr/sbin/rear -V"):
    Relax-and-Recover 2.6 / 2020-06-17

  • If your ReaR version is not the current version, explain why you can't upgrade:
    Using Fedora 38 current package: rear-2.6-9.fc38.x86_64

  • OS version ("cat /etc/os-release" or "lsb_release -a" or "cat /etc/rear/os.conf"):

OS_VENDOR=RedHatEnterpriseServer
OS_VERSION=VERSION_ID=38
  • ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):
    local.conf is all comments.
    site.conf:
OUTPUT=USB
BACKUP=NETFS
BACKUP_URL=usb:///dev/disk/by-label/REAR-000
BACKUP_PROG_EXCLUDE=( "${BACKUP_PROG_EXCLUDE[@]}" '/tmp/*' '/jerry/*' )
USB_UEFI_PART_SIZE="512"
TIMESYNC=CHRONY
  • Hardware vendor/product (PC or PowerNV BareMetal or ARM) or VM (KVM guest or PowerVM LPAR):
    ASUS C202SA Chrome book
    dmidecode shows:
    System Information
    Manufacturer: GOOGLE
    Product Name: Terra

  • System architecture (x86 compatible or PPC64/PPC64LE or what exact ARM device):
    Intel(R) Celeron(R) CPU N3060 @ 1.60GHz
    x86_64

  • Firmware (BIOS or UEFI or Open Firmware) and bootloader (GRUB or ELILO or Petitboot):
    UEFI GRUB

  • Storage (local disk or SSD) and/or SAN (FC or iSCSI or FCoE) and/or multipath (DM or NVMe):
    16G eMMC

  • Storage layout ("lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,SIZE,MOUNTPOINT"):
    The storage layout is the default that Fedora Workstation 38 creates.

NAME              KNAME             PKNAME       TRAN TYPE FSTYPE LABEL                  SIZE MOUNTPOINT
/dev/sda          /dev/sda                       usb  disk udf    RELAXRECOVER          28.6G
|-/dev/sda1       /dev/sda1         /dev/sda          part vfat   REAR-EFI               512M
`-/dev/sda2       /dev/sda2         /dev/sda          part ext3   REAR-000              28.1G /tmp/rear.TUzMKqWPJoXOn8X/outputfs
/dev/mmcblk0      /dev/mmcblk0                        disk                              14.7G
|-/dev/mmcblk0p1  /dev/mmcblk0p1    /dev/mmcblk0      part vfat                          600M /boot/efi
|-/dev/mmcblk0p2  /dev/mmcblk0p2    /dev/mmcblk0      part ext4                            1G /boot
`-/dev/mmcblk0p3  /dev/mmcblk0p3    /dev/mmcblk0      part btrfs  fedora_localhost-live 13.1G /home
/dev/mmcblk0boot0 /dev/mmcblk0boot0                   disk                                 4M
/dev/mmcblk0boot1 /dev/mmcblk0boot1                   disk                                 4M
/dev/zram0        /dev/zram0                          disk                               3.8G [SWAP]
  • Description of the issue (ideally so that others can reproduce it):
    I just see the error in the log file /var/log/rear/rear-c202s.log about the integer expression expected.
    I do have the problem that the USB flash drive boots and I get the menu, but I get all of these messages for each menu item.
    I am listing the visible menu item that you see on the screen and then error lines are what I see when I hit enter to select the menu item.
GRUB version 2.06

Relax-and-Recover (no Secure Boot)
error: ../../grub-core/script/function.c:119:can't find command `echo'.
error: ../../grub-core/script/function.c:119:can't find command `linux'.
error: ../../grub-core/script/function.c:119:can't find command `echo'.
error: ../../grub-core/script/function.c:119:can't find command `initrd'.

Press any key to continue...

Relax-and-Recover (no Secure Boot)
error: ../../grub-core/script/function.c:119:can't find command `echo'.
error: ../../grub-core/script/function.c:119:can't find command `linuxefi'.
error: ../../grub-core/script/function.c:119:can't find command `echo'.
error: ../../grub-core/script/function.c:119:can't find command `initrdefi'.

Press any key to continue...

Boot original system
error: ../../grub-core/script/function.c:119:can't find command `search'.
error: ../../grub-core/script/function.c:119:can't find command `chainloader'.

Press any key to continue...

Reboot
error: ../../grub-core/script/function.c:119:can't find command `reboot'.

Press any key to continue...

Exit to EFI Shell
error: ../../grub-core/script/function.c:119:can't find command `exit'.

Press any key to continue...
  • Workaround, if any:

  • Attachments, as applicable ("rear -D mkrescue/mkbackup/recover" debug log files):

You can drag-drop log files into this editor to create an attachment
or paste verbatim text like command output or file content
by including it between a leading and a closing line of
three backticks like this:

https://github.com/rear/rear/blob/master/usr/share/rear/layout/save/default/950_verify_disklayout_file.sh#L82

I added the Log line so I could see what it was comparing and saw the p1
    highest_used_part_num=0
    for partition in "${partitions[@]}" ; do
        # We test only partitions of the form /dev/sdX1 /dev/sdX2 /dev/sdX3 (i.e. of the form $disk_dev$part_num).
        part_num=${partition#$disk_dev}
        Log "part_num = $part_num highest_used_part_num = $highest_used_part_num"
        test $part_num -gt $highest_used_part_num && highest_used_part_num=$part_num
    done

2023-04-20 20:45:28.338509014 part_num = p1 highest_used_part_num = 0
/usr/share/rear/layout/save/default/950_verify_disklayout_file.sh: line 83: test: p1: integer expression expected
2023-04-20 20:45:28.345388057 part_num = p2 highest_used_part_num = 0
/usr/share/rear/layout/save/default/950_verify_disklayout_file.sh: line 83: test: p2: integer expression expected
2023-04-20 20:45:28.351797496 part_num = p3 highest_used_part_num = 0

rear-c202s.log

jsmeix commented at 2023-04-21 06:51:

The messages in
https://github.com/rear/rear/files/11291981/rear-c202s.log

/usr/share/rear/layout/save/default/950_verify_disklayout_file.sh: line 83: test: p1: integer expression expected
/usr/share/rear/layout/save/default/950_verify_disklayout_file.sh: line 83: test: p2: integer expression expected
/usr/share/rear/layout/save/default/950_verify_disklayout_file.sh: line 83: test: p3: integer expression expected

are unrelated to the GRUB2 error messages.

Regarding the 'integer expression expected' messages:

In general what layout/save/default/950_verify_disklayout_file.sh does
is not required functionality to make ReaR work because it is only there
as a safeguard that the entries in disklayout.conf are syntactically OK
which they should normally be.

The part in layout/save/default/950_verify_disklayout_file.sh
that results those 'integer expression expected' messages
only checks for non consecutive partitions and only when
partitions of the form /dev/sdX1 /dev/sdX2 /dev/sdX3
(i.e. of the form $disk_dev$part_num) are used,
see the comments in that code.
When partition devoce nodes like /dev/mmcblk0p1 /dev/mmcblk0p2
/dev/mmcblk0p3 /dev/mmcblk0boot0 /dev/mmcblk0boot1 are used
(i.e. of the form ${disk_dev}p$part_num)
that test is skipped.

So the 'integer expression expected' messages
are no errors but expected failures of the 'test'
to also find out if the form $disk_dev$part_num is used.

@Jerry2840
in general when you run ReaR (or any other rogram) in debug mode
you may get various kind of messages that indicate this or that failures
but you would need to understand what is actually meant to happen
in each case to decide if a failure is expected and handled
or if a failure is unexpected and indicates a real error.

For example on my currently used computer:

# dmesg | egrep -i 'fail|error'

[    0.000000] tsc: Fast TSC calibration failed
[    0.000000] DMAR: Parse DMAR table failure.
[    3.400876] RAS: Correctable Errors collector initialized.
[   46.184357] ACPI BIOS Error (bug): Could not resolve symbol [\_TZ.PSL.CFGD], AE_NOT_FOUND (20210730/psargs-330)
[   46.185935] ACPI Error: Aborting method \_TZ.PSL due to previous error (AE_NOT_FOUND) (20210730/psparse-531)
...

My computer works perfectly well for me as far as I can tell
and I don't have sufficient low-level knowledge to decide
if those messages mean or indicate some real problem
so I just ignore them and go on bona fide.

jsmeix commented at 2023-04-21 06:57:

Regarding the GRUB2 error messages
I am afraid I cannot really help here
because I am not a sufficient GRUB2 expert
to imagine what their reason could be.

Only a blind guess
in particular because you use a Red Hat system
(but I am not a Red Hat user):

As far as I know on Red Hat based systems
the whole GRUB2 software is split into several RPM packages
and by default not all GRUB2 software is installed - in particular
some GRUB2 modules are not installed by default - so you may
need to additionally install certain GRUB2 RPM packages
to get GRUB2 working for ReaR.

See
https://github.com/rear/rear/issues/2783#issuecomment-1085678921

jsmeix commented at 2023-04-21 07:01:

@pcahyna
could you have a look here (as time permits)
regarding the GRUB2 error messages?

jsmeix commented at 2023-04-21 07:32:

Via
https://github.com/rear/rear/commit/c8f5e3f41c970a89304cd2b1bc5d04a2d2a7fdb4
in layout/save/default/950_verify_disklayout_file.sh
it now suppresses unhelpful stderr messages like
"test: p1: integer expression expected"
that appear for partitions of the form like
/dev/mmcblk0p1 (i.e. of the form ${disk_dev}p$part_num).

Later if needed and as time permits
layout/save/default/950_verify_disklayout_file.sh
may be enhanced to check for non consecutive partitions
also for partitions of the form like
/dev/mmcblk0p1 (i.e. of the form ${disk_dev}p$part_num).
Probably this is not needed in practice because
the parted versions that are nowadays used
should be sufficiently new so that they
support FEATURE_PARTED_RESIZEPART or FEATURE_PARTED_RESIZE
(i.e. the 'resizepart' or 'resize' command),
cf. lib/layout-functions.sh

schlomo commented at 2023-04-23 09:19:

First of all, @Jerry2840, big congratulations of probably being the first ReaR user on a Chromebook 😄 (I also use an old Chromebook as a "kitchen dashboard"...)

Your GRUB2 error looks like the Grub modules are missing or not found, please take a look at your rescue media and check the location of the echo.mod file on it. In your logfile I found this line

grub2-mkstandalone: info: copying `/usr/lib/grub/x86_64-efi/echo.mod' -> `/tmp/grub.XXpN8c/boot/grub/x86_64-efi/echo.mod'.

which suggests that the module was copied, but maybe it got copied to the wrong place.


[Export of Github issue for rear/rear.]