Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2118694 - 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"
Summary: Upgrade fails during db:migrate with PG::ForeignKeyViolation: ERROR: ERROR: ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.12.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: 6.12.0
Assignee: satellite6-bugs
QA Contact: Cole Higgins
URL:
Whiteboard:
: 2118738 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-16 13:25 UTC by Lukas Pramuk
Modified: 2022-11-16 13:35 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-16 13:35:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 35031 0 Normal Closed 20211220185935_clean_duplicate_content_units db:migrate fails with child records 2022-08-16 15:21:53 UTC
Red Hat Issue Tracker SAT-12238 0 None None None 2022-08-16 18:36:38 UTC
Red Hat Product Errata RHSA-2022:8506 0 None None None 2022-11-16 13:35:25 UTC

Description Lukas Pramuk 2022-08-16 13:25:13 UTC
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'

Comment 1 Samir Jha 2022-08-16 15:23:18 UTC
*** Bug 2118738 has been marked as a duplicate of this bug. ***

Comment 6 errata-xmlrpc 2022-11-16 13:35:16 UTC
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


Note You need to log in before you can comment on or make changes to this bug.