Skip to content

Commit

Permalink
Modify upgrade not terminate after lockfile detected
Browse files Browse the repository at this point in the history
Previously, when the upgrade failed in the initram the file
/sysroot/root/tmp_leapp_py3/.leapp_upgrade_failed has been generated and
upon detecting this file leapp triggered an emergency shell. This caused
the original failure to be hidden from the customer.

With this commit, we no longer crash immediately upon detecting the file
but rather continue and "wait" for the underlying issue and error to
emerge.

RHEL-24148
  • Loading branch information
dkubek authored and pirat89 committed Apr 17, 2024
1 parent 8207078 commit 1f8b8f3
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ do_upgrade() {
local dirname
dirname="$("$NEWROOT/bin/dirname" "$NEWROOT$LEAPP_FAILED_FLAG_FILE")"
[ -d "$dirname" ] || mkdir "$dirname"

echo >&2 "Creating file $NEWROOT$LEAPP_FAILED_FLAG_FILE"
echo >&2 "Warning: Leapp upgrade failed and there is an issue blocking the upgrade."
echo >&2 "Please file a support case with /var/log/leapp/leapp-upgrade.log attached"

"$NEWROOT/bin/touch" "$NEWROOT$LEAPP_FAILED_FLAG_FILE"
fi

Expand Down Expand Up @@ -358,10 +363,10 @@ mount -o "remount,rw" "$NEWROOT"
# check if leapp previously failed in the initramfs, if it did return to the emergency shell
[ -f "$NEWROOT$LEAPP_FAILED_FLAG_FILE" ] && {
echo >&2 "Found file $NEWROOT$LEAPP_FAILED_FLAG_FILE"
echo >&2 "Error: Leapp previously failed and cannot continue, returning back to emergency shell"
echo >&2 "Please file a support case with $NEWROOT/var/log/leapp/leapp-upgrade.log attached"
echo >&2 "To rerun the upgrade upon exiting the dracut shell remove the $NEWROOT$LEAPP_FAILED_FLAG_FILE file"
exit 1
echo >&2 "Warning: Leapp failed on a previous execution and something might be blocking the upgrade."
echo >&2 "Continuing with the upgrade anyway. Note that any subsequent error might be potentially misleading due to a previous failure."
echo >&2 "A log file will be generated at $NEWROOT/var/log/leapp/leapp-upgrade.log."
echo >&2 "In case of persisting failure, if possible, try to boot to the original system and file a support case with /var/log/leapp/leapp-upgrade.log attached."
}

[ ! -x "$NEWROOT$LEAPPBIN" ] && {
Expand Down

0 comments on commit 1f8b8f3

Please sign in to comment.