RHEL7: "leapp upgrade" fails in reboot phase with message "OSError: [Errno 17] File exists: '/root/tmp_leapp_py3'" then enters emergency

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 messages on the console:

    upgrade[XXX]: Traceback (most recent call last):
    upgrade[XXX]:   File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    upgrade[XXX]:     self.run()
    upgrade[XXX]:   File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run
    upgrade[XXX]:     self._target(*self._args, **self._kwargs)
    upgrade[XXX]:   File "/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.py", line 65, in _do_run
    upgrade[XXX]:     skip_dialogs=skip_dialogs).run(*args, **kwargs)
    upgrade[XXX]:   File "/usr/lib/python2.7/site-packages/leapp/actors/__init__.py", line 335, in run
    upgrade[XXX]:     self.process(*args)
    upgrade[XXX]:   File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/actors/preparepythonworkround/actor.py", line 25, in process
    upgrade[XXX]:     os.mkdir(leapp_home)
    upgrade[XXX]: OSError: [Errno 17] File exists: '/root/tmp_leapp_py3'
    
  • The issue happens when attempting a new upgrade after the first upgrade failed without re-running leapp upgrade

Resolution

Follow the procedure in the Diagnostic Steps section.
If this is a match, proceed further, otherwise contact your Red Hat Support representative and mention this Solution.

  1. Delete the contents of /root/tmp_leapp_py3

    # rm -fr /root/tmp_leapp_py3/*
    
  2. Prior to re-initiating the upgrade, clean up the system

  3. Re-execute leapp upgrade

    # leapp upgrade
    
  4. Reboot to apply the final phase

    # reboot
    

Root Cause

During reboot phase, leapp installs a directory /root/tmp_leapp_py3 which already exists when attempting a leapp upgrade reboot for second time.
The issue is tracked by This content is not included.[RHEL-24148] /sysroot/root/tmp_leapp_py3/.leapp_upgrade_failed file blocks upgrades and drops systems into emergency mode - Red Hat Issue Tracker.

Diagnostic Steps

  1. Boot with the RHEL7 kernel

  2. Verify that directory /root/tmp_leapp_py3 already exists

    # ls -l /root/tmp_leapp_py3
    total 4
    lrwxrwxrwx. 1 root root  38 Jul 18 11:21 leapp -> /usr/lib/python2.7/site-packages/leapp
    -rwxrwx---. 1 root root 115 Jul 18 11:21 leapp3
    
Components
Category

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.