AlmaLinux / leapp-data

ELevate related data
https://almalinux.org/elevate/
Apache License 2.0
11 stars 20 forks source link

Conversion fails if there are misleading links in /etc/leapp/repos.d #98

Closed SandakovMM closed 2 weeks ago

SandakovMM commented 3 months ago

Hello. I encountered an issue while converting one of the instances. When I initiated leapp preupgrade, it failed with the following error:

2024-09-04 19:06:28,395 - INFO - ============================================================
2024-09-04 19:06:28,395 - INFO - 2024-09-04 19:06:26.563154 [ERROR] Actor: dnf_transaction_check
2024-09-04 19:06:28,395 - INFO - Message: Failed to execute script to apply transaction workaround yum config fix. Message: Command ['systemd-nspawn', '-register=no', 'quiet', '-D', u'/var/lib/leapp/scratch/mounts/root_/system_overlay', 'setenv=LEAPP_OVL_SIZE=4096', 'setenv=LEAPP_UPGRADE_PATH_TARGET_RELEASE=8.9', 'setenv=LEAPP_NO_RHSM=0', 'setenv=LEAPP_EXPERIMENTAL=0', 'setenv=LEAPP_UPGRADE_PATH_FLAVOUR=default', 'setenv=LEAPP_COMMON_TOOLS=:/etc/leapp/repos.d/system_upgrade;66d7e0d7/common/tools:/etc/leapp/repos.d/system_upgrade;66d7e0d7/el7toel8/tools', 'setenv=LEAPP_COMMON_FILES=:/etc/leapp/repos.d/system_upgrade;66d7e0d7/common/files:/etc/leapp/repos.d/system_upgrade;66d7e0d7/el7toel8/files', 'setenv=LEAPP_IPU_IN_PROGRESS=7to8', 'setenv=LEAPP_UNSUPPORTED=0', 'setenv=LEAPP_EXECUTION_ID=b5a24ee8-ba5b-46b2-bf0e-0dd6e78cdbe9', '-setenv=LEAPP_HOSTNAME=newvps.skyevents.biz', '/bin/bash', '-c', u'/etc/leapp/repos.d/system_upgrade;66d7e0d7/el7toel8/tools/handleyumconfig'] failed with exit code 127.
2024-09-04 19:06:28,395 - INFO - ============================================================
2024-09-04 19:06:28,395 - INFO - END OF ERRORS
2024-09-04 19:06:28,395 - INFO - ============================================================
2024-09-04 19:06:28,395 - INFO - Debug output written to /var/log/leapp/leapp-preupgrade.log
2024-09-04 19:06:28,395 - INFO - ============================================================
2024-09-04 19:06:28,395 - INFO - REPORT OVERVIEW
2024-09-04 19:06:28,396 - INFO - ============================================================
2024-09-04 19:06:28,396 - INFO - Following errors occurred and the upgrade cannot continue:
2024-09-04 19:06:28,396 - INFO - 1. Actor: dnf_transaction_check
2024-09-04 19:06:28,396 - INFO - Message: Failed to execute script to apply transaction workaround yum config fix. Message: Command ['systemd-nspawn', '-register=no', 'quiet', '-D', u'/var/lib/leapp/scratch/mounts/root_/system_overlay', 'setenv=LEAPP_OVL_SIZE=4096', 'setenv=LEAPP_UPGRADE_PATH_TARGET_RELEASE=8.9', 'setenv=LEAPP_NO_RHSM=0', 'setenv=LEAPP_EXPERIMENTAL=0', 'setenv=LEAPP_UPGRADE_PATH_FLAVOUR=default', 'setenv=LEAPP_COMMON_TOOLS=:/etc/leapp/repos.d/system_upgrade;66d7e0d7/common/tools:/etc/leapp/repos.d/system_upgrade;66d7e0d7/el7toel8/tools', 'setenv=LEAPP_COMMON_FILES=:/etc/leapp/repos.d/system_upgrade;66d7e0d7/common/files:/etc/leapp/repos.d/system_upgrade;66d7e0d7/el7toel8/files', 'setenv=LEAPP_IPU_IN_PROGRESS=7to8', 'setenv=LEAPP_UNSUPPORTED=0', 'setenv=LEAPP_EXECUTION_ID=b5a24ee8-ba5b-46b2-bf0e-0dd6e78cdbe9', '-setenv=LEAPP_HOSTNAME=newvps.skyevents.biz', '/bin/bash', '-c', u'/etc/leapp/repos.d/system_upgrade;66d7e0d7/el7toel8/tools/handleyumconfig'] failed with exit code 127.
2024-09-04 19:06:28,396 - INFO - HIGH and MEDIUM severity reports:

After a brief investigation, I noticed that leapp uses /etc/leapp/repos.d/system_upgrade;66d7e0d7/ instead of /etc/leapp/repos.d/system_upgrade. I removed the link and reinstalled leapp packages, and now both leapp preupgrade and leapp upgrade work fine.

I am not sure why /etc/leapp/repos.d/system_upgrade;66d7e0d7 was created initially. Unfortunately, all traces seem to be lost. However, it might be worthwhile to ensure the dnf workaround works for such paths. Also, if you have any ideas to prevent the creation of such links, I would be grateful to hear them.

yuravk commented 2 weeks ago

You were upgrading from CentOS7, right ? What was the destination OS ?

yuravk commented 2 weeks ago

The /etc/leapp/repos.d/system_upgrade symlink is installed by leapp-upgrade-el7toel8 package. What was the packages version before you reinstalled leapp ?

SandakovMM commented 2 weeks ago

You were upgrading from CentOS7, right ? What was the destination OS ?

It was conversion from CentOS 7 to AlmaLinux 8.

What was the packages version before you reinstalled leapp ?

I'm afraid I don't recall the exact version. However, I would assume it was leapp-upgrade-el7toel8-0.16.0-6 as it seems to be the latest package released prior to September 4th (according to [the repository information]](https://repo.almalinux.org/elevate/el7/x86_64/Packages/))

yuravk commented 2 weeks ago

Thank you for your feedback.

I'm not able to reproduce the issue now. I run CentOS7 to AlmaLinux 8 to AlmaLinux 9 manual upgrade. The following vendors' packages were installed: EPEL, kernelcare, nginx, mariadb, postgresql, docker.

ELevate packages used:

leapp-upgrade-*-0.21.0-2.el*.elevate.3.noarch
elevate-release-1.0-2.el*.noarch
leapp-data-almalinux-0.4-11.el*.20240827.noarch
leapp-0.18.0-1.el*.noarch
yuravk commented 2 weeks ago

Seems I've found where these misleading links come from.

# yum install leapp-upgrade leapp-data-almalinux
Last metadata expiration check: 0:00:26 ago on Fri 15 Nov 2024 06:55:16 PM EET.
Package leapp-data-almalinux-0.4-7.el7.20240827.noarch is already installed.
Dependencies resolved.
==============================================================================================================================================================
 Package                                      Architecture                 Version                                        Repository                     Size
==============================================================================================================================================================
Installing:
 leapp-upgrade-el8toel9                       noarch                       1:0.21.0-2.el8.elevate.3                       elevate                       1.0 M
Upgrading:
 leapp-data-almalinux                         noarch                       0.4-11.el8.20240827                            elevate                       457 k

Transaction Summary
==============================================================================================================================================================
Install  1 Package
Upgrade  1 Package

Total download size: 1.5 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): leapp-upgrade-el8toel9-0.21.0-2.el8.elevate.3.noarch.rpm                                                               9.5 MB/s | 1.0 MB     00:00    
(2/2): leapp-data-almalinux-0.4-11.el8.20240827.noarch.rpm                                                                    3.8 MB/s | 457 kB     00:00    
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                          12 MB/s | 1.5 MB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                      1/1 
  Upgrading        : leapp-data-almalinux-0.4-11.el8.20240827.noarch                                                                                      1/3 
  Installing       : leapp-upgrade-el8toel9-1:0.21.0-2.el8.elevate.3.noarch                                                                               2/3 
Error unpacking rpm package leapp-upgrade-el8toel9-1:0.21.0-2.el8.elevate.3.noarch
  Cleanup          : leapp-data-almalinux-0.4-7.el7.20240827.noarch                                                                                       3/3 
error: unpacking of archive failed on file /etc/leapp/repos.d/system_upgrade;67377d17: cpio: File from package already exists as a directory in system
error: leapp-upgrade-el8toel9-1:0.21.0-2.el8.elevate.3.noarch: install failed

It happens when leapp-upgrade is installed, and leapp-data-* is upgraded (so was already installed). Both packages provide /etc/leapp/repos.d/system_upgrade: leapp-upgrade provides it as symbolic link, and leapp-data-* - as directory.

Hope will fix that in upcoming leapp-data-* packages.