Bug 1901002

Summary: Invalid syntax in 50-do-upgrade.sh
Product: Red Hat Enterprise Linux 7 Reporter: Renaud Métrich <rmetrich>
Component: leapp-repositoryAssignee: Leapp team <leapp-notifications>
Status: CLOSED ERRATA QA Contact: Alois Mahdal <amahdal>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.9CC: fkrska, mkluson, pstodulk
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: leapp-repository-0.13.0-1.el7_9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-16 08:59:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1818077, 1818088    

Description Renaud Métrich 2020-11-24 08:50:22 UTC
Description of problem:

When the initramfs-upgrade image boots, the following syntax error is hit in 50-do-upgrade.sh:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
[   29.124153] upgrade[542]: //lib/dracut/hooks/upgrade/50-do-upgrade.sh: line 17: [: missing `]'
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

The corresponding code is below, clearly the "&&" operator is missing for /dev/mapper line 17:

/usr/lib/dracut/hooks/upgrade/50-do-upgrade.sh:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
 14 export NEWROOT=${NEWROOT:-"/sysroot"}
 15 
 16 NSPAWN_OPTS="--capability=all --bind=/sys --bind=/dev --bind=/dev/pts --bind=/run/systemd --bind=/proc"
 17 [ -d /dev/mapper ] NSPAWN_OPTS="$NSPAWN_OPTS --bind=/dev/mapper"
 18 export NSPAWN_OPTS="$NSPAWN_OPTS --bind=/run/udev --keep-unit --register=no --timezone=off --resolv-conf=off"
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


Version-Release number of selected component (if applicable):

leapp-repository-0.12.0-2.el7_9.noarch

How reproducible:

Always

Comment 2 Petr Stodulka 2020-11-24 14:57:03 UTC
Hi Renaud. Thanks for the report. It will be for sure fixed in the next release. Here is upstream PR with the fix:
- https://github.com/oamg/leapp-repository/pull/619

Comment 7 Alois Mahdal 2021-02-15 17:27:01 UTC
Unfortunately we haven't been able to pin-point what exactly the line affected by the syntax error did.

We know:
 *  The intent of the line is to bind mount /dev/mapper inside upgrade initramfs.

 *  Therefore, it's related to LVM and other /dev/mapper relared tech.

 *  On most configurations, the syntax error just causes the line to be effectively skipped.
    
 *  It's been reported that with some configurations (we don't know the details, though), the syntax
    error will cause the Dracut module to quit completely.

One suggested test case was to use LVM partitioning with separate /var and /var/log messages and check for presence of upgrade log after the FirstBoot.  This, however, worked fine regardless of the fix.


Previously, the regression test suite maintained by OAMG-QE had no LVM coverage.  What we did now was that we added several test cases with LVM with separate /usr, /var, /var/log and combinations of thereof, for RHEL-7/x86_64.  All these test cases have passed with

  - leapp-0.12.0-1.el7_9
  - leapp-repository-0.13.0-2.el7_9

Under the current circumstances we find it enough for SanityOnly verification.

---> VERIFIED/SanityOnly

Comment 9 errata-xmlrpc 2021-02-16 08:59:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (leapp and leapp-repository bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:0569