Description of problem: Upgrade fails during db:migrate with PG::ForeignKeyViolation: ERROR: ERROR: update or delete on table "katello_module_profiles" violates foreign key constraint "katello_mod_profile_rpm_mod_profile_id_fk" on table "katello_module_profile_rpms" Version-Release number of selected component (if applicable): 6.12.0 Snap 6.1 How reproducible: deterministic Steps to Reproduce: 1. Have a 6.11.1.1 (QE Upgrade Template) 2. Upgrade to 6.12.0 # satellite-maintain upgrade run --target-version 6.12 -y -w repositories-validate,repositories-setup ... Update package(s) : [OK] -------------------------------------------------------------------------------- Procedures::Installer::Upgrade: [FAIL] Failed executing LANG=en_US.utf-8 satellite-installer --disable-system-checks, exit status 6: 2022-08-16 09:10:55 [NOTICE] [root] Loading installer configuration. This will take some time. 2022-08-16 09:11:02 [NOTICE] [root] Running installer with log based terminal output at level NOTICE. 2022-08-16 09:11:02 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions. 2022-08-16 09:11:08 [WARN ] [pre] Skipping system checks. 2022-08-16 09:11:08 [WARN ] [pre] Skipping system checks. 2022-08-16 09:11:21 [NOTICE] [configure] Starting system configuration. 2022-08-16 09:11:40 [NOTICE] [configure] 250 configuration steps out of 2061 steps complete. 2022-08-16 09:12:09 [NOTICE] [configure] 500 configuration steps out of 2068 steps complete. 2022-08-16 09:12:16 [NOTICE] [configure] 750 configuration steps out of 2073 steps complete. 2022-08-16 09:12:20 [NOTICE] [configure] 1000 configuration steps out of 2077 steps complete. 2022-08-16 09:13:26 [ERROR ] [configure] '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0] 2022-08-16 09:13:26 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: change from 'notrun' to ['0'] failed: '/usr /sbin/foreman-rake db:migrate' returned 1 instead of one of [0] 2022-08-16 09:13:53 [NOTICE] [configure] 1500 configuration steps out of 2120 steps complete. 2022-08-16 09:13:58 [NOTICE] [configure] 1750 configuration steps out of 3012 steps complete. 2022-08-16 09:13:59 [NOTICE] [configure] 2000 configuration steps out of 3012 steps complete. 2022-08-16 09:14:01 [NOTICE] [configure] 2250 configuration steps out of 3012 steps complete. 2022-08-16 09:14:02 [NOTICE] [configure] 2500 configuration steps out of 3012 steps complete. 2022-08-16 09:14:22 [NOTICE] [configure] 2750 configuration steps out of 3012 steps complete. 2022-08-16 09:15:07 [NOTICE] [configure] 3000 configuration steps out of 3012 steps complete. 2022-08-16 09:15:19 [NOTICE] [configure] System configuration has finished. There were errors detected during install. Please address the errors and re-run the installer to ensure the system is properly configured. Failing to do so is likely to result in broken functionality. The full log is at /var/log/foreman-installer/satellite.log Package versions are being locked. -------------------------------------------------------------------------------- Scenario [Migration scripts to Satellite 6.12] failed. Actual results: db:migrate fails Expected results: upgrade succeeds Additional info: # foreman-rake db:migrate == 20211220185935 CleanDuplicateContentUnits: migrating ======================= -- change_column(:katello_docker_tags, :pulp_id, :string, {:null=>false}) -> 0.0034s -- change_column(:katello_docker_manifest_lists, :pulp_id, :string, {:null=>false}) -> 0.0009s -- change_column(:katello_docker_manifests, :pulp_id, :string, {:null=>false}) -> 0.0010s -- add_foreign_key(:katello_docker_manifest_list_manifests, :katello_docker_manifest_lists, {:column=>:docker_manifest_list_id}) -> 0.0033s -- add_foreign_key(:katello_repository_docker_manifests, :katello_docker_manifests, {:column=>:docker_manifest_id}) -> 0.0014s -- add_foreign_key(:katello_repository_docker_manifest_lists, :katello_docker_manifest_lists, {:column=>:docker_manifest_list_id}) -> 0.0011s rake aborted! StandardError: An error has occurred, this and all later migrations canceled: PG::ForeignKeyViolation: ERROR: update or delete on table "katello_module_profiles" violates foreign key constraint "katello_mod_profile_rpm_mod_profile_id_fk" on table "katello_m odule_profile_rpms" DETAIL: Key (id)=(40) is still referenced from table "katello_module_profile_rpms". /usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `exec_params' /usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `block (2 levels) in exec_no_cache' /usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads' /usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares' /usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads' /usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/postgresql_adapter.rb:674:in `block in exec_no_cache'
*** Bug 2118738 has been marked as a duplicate of this bug. ***
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 (Important: Satellite 6.12 Release), 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/RHSA-2022:8506