Bug 1479002 - REAR "ERROR: Cannot find required programs: efibootmgr", after updating to 7.4.
REAR "ERROR: Cannot find required programs: efibootmgr", after updating to 7.4.
Status: MODIFIED
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rear (Show other bugs)
7.4
Unspecified Unspecified
urgent Severity high
: rc
: ---
Assigned To: Pavel Cahyna
qe-baseos-daemons
: Patch, Regression, ZStream
: 1492190 (view as bug list)
Depends On:
Blocks: 1420851 1492561
  Show dependency treegraph
 
Reported: 2017-08-07 12:56 EDT by Ryan Blakley
Modified: 2017-09-18 04:05 EDT (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1492561 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3178651 None None None 2017-09-11 15:47 EDT

  None (edit)
Description Ryan Blakley 2017-08-07 12:56:16 EDT
Description of problem: REAR "ERROR: Cannot find required programs: efibootmgr", after updating to 7.4. With 7.4 grub2-common is a new dependency that gets pulled in, which creates the /boot/efi/EFI/redhat directory on non-uefi installed machines.


Version-Release number of selected component (if applicable):
grub2-common-2.02-0.64.el7.noarch
rear-2.00-2.el7.x86_64


Steps to Reproduce:
** First way
1. Install 7.4 and run # rear -v mkbackup

** Second way if on 7.3 or below.
1. Yum update grub2* and rear, then run # rear -v mkbackup


Actual results:
# rear -d -v mkbackup
Relax-and-Recover 2.00 / Git
Using log file: /var/log/rear/rear-ryan-rhel7.log
ERROR: Cannot find required programs: efibootmgr
Aborting due to an error, check /var/log/rear/rear-ryan-rhel7.log for details
You should also rm -Rf /tmp/rear.3EZIbCfZn9geS4c
Terminated


Expected results:
Continue with the backup and not terminate.


Additional info: 
It looks like a similar issue has been reported upstream at https://github.com/rear/rear/issues/1239. But the fix for that issue doesn't work on 7.4, because it's only checking if the directory exist. It should be checking if /boot/efi is actually mounted. I did some testing, and the below change works correctly on non-uefi, and uefi based installs without any errors.

diff -up /usr/share/rear/prep/default/310_include_uefi_tools.sh.bak /usr/share/rear/prep/default/310_include_uefi_tools.sh
--- /usr/share/rear/prep/default/310_include_uefi_tools.sh.bak	2017-08-07 11:29:12.863665290 -0400
+++ /usr/share/rear/prep/default/310_include_uefi_tools.sh	2017-08-07 11:33:15.924439002 -0400
@@ -6,7 +6,7 @@ if grep -qw 'noefi' /proc/cmdline; then
 fi
 
 # next step, is checking /boot/efi directory (we need it)
-if [[ ! -d /boot/efi ]]; then
+if ! grep -q '/boot/efi' /proc/mounts; then
     return    # must be mounted
 fi
Comment 2 Blair Aitken 2017-08-15 09:50:27 EDT
Hello everyone,

I have 2 different customers that have confirmed that the suggested workaround by Ryan (under Additional info section) works in their environment.
Comment 3 Ryan Blakley 2017-08-15 19:33:46 EDT
The customer on 01903555 also confirmed the workaround I proposed fixed their issue, is there anyway we can get a fix pushed quicker. This bug breaks rear backups completely on non-uefi systems?
Comment 10 Pavel Cahyna 2017-09-11 05:54:56 EDT
Quick workaround without patching package files: install the dosfstools and efibootmgr packages.
yum install dosfstools efibootmgr
Comment 30 Jeff Bastian 2017-09-15 15:23:52 EDT
*** Bug 1492190 has been marked as a duplicate of this bug. ***
Comment 31 Jeff Bastian 2017-09-15 15:24:08 EDT
(In reply to Ryan Blakley from comment #0)
>  # next step, is checking /boot/efi directory (we need it)
> -if [[ ! -d /boot/efi ]]; then
> +if ! grep -q '/boot/efi' /proc/mounts; then
>      return    # must be mounted
>  fi


I would suggest checking for the /sys/firmware/efi directory instead.  This is created by the kernel only on systems with actual UEFI firmware.

Even a non-UEFI system could mount a filesystem at /boot/efi so this is not a very reliable test.  (I don't know _why_ someone would mount something here on a non-UEFI system, but I've seen weirder things. :-))
Comment 32 Ryan Blakley 2017-09-15 15:47:02 EDT
(In reply to Jeff Bastian from comment #31)
> (In reply to Ryan Blakley from comment #0)
> >  # next step, is checking /boot/efi directory (we need it)
> > -if [[ ! -d /boot/efi ]]; then
> > +if ! grep -q '/boot/efi' /proc/mounts; then
> >      return    # must be mounted
> >  fi
> 
> 
> I would suggest checking for the /sys/firmware/efi directory instead.  This
> is created by the kernel only on systems with actual UEFI firmware.
> 
> Even a non-UEFI system could mount a filesystem at /boot/efi so this is not
> a very reliable test.  (I don't know _why_ someone would mount something
> here on a non-UEFI system, but I've seen weirder things. :-))

The latest fix no longer depends on the mount. My point for checking if it was mounted was due to the fact that rear depends on the efi files to be under /boot/efi. So if we only check if the directory exist, then the efi files may not be there if /boot/efi wasn't mounted. But again the upstream fixes rearrange the prep files to properly, and more cleanly fix this issue.

Note You need to log in before you can comment on or make changes to this bug.