RHEL7: "leapp upgrade" fails in reboot phase with message "/usr/bin/bash: /usr/bin/python3: No such file or directory" then enters emergency mode

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 7
    • Leapp

Issue

  • After rebooting once leapp upgrade executed successfully, the boot falls into emergency and shows the following message on the console:

    localhost upgrade: /usr/bin/bash: /usr/bin/python3: No such file or directory
    
  • The issue happens when an alternative for python3 is configured and pointing to an incorrect path.

Resolution

  1. Check if an alternative for python3 exists:

    # alternatives --display python3
    
  2. If it exists, remove the alternative:

    # alternatives --remove python3 <path>
    

Root Cause

An incorrect alternative points to the wrong path for the python3 binary. During the reboot phase, Leapp uses python3 instead of python2.7, which causes the issue if the binary can't be found.

Diagnostic Steps

  • Check if the error is present in the rdsosreport.txt:

    # grep python3 /run/initramfs/rdsosreport.txt
    [...]
    [  406.572247] localhost upgrade[23373]: /usr/bin/bash: /usr/bin/python3: No such file or directory
    
SBR
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.