Project

General

Profile

Actions

Bug #38504

open

Satellite 6.17 upgrade fails with ERROR: duplicate key value violates unique constraint "index_katello_installed_packages_on_nvrea"

Added by Ian Ballou 5 days ago. Updated 4 days ago.

Status:
Ready For Testing
Priority:
Normal
Assignee:
Category:
-
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Katello 4.16 upgrade fails with ERROR: duplicate key value violates unique constraint "index_katello_installed_packages_on_nvrea"
Cloned from 16980277

Description of problem:

While upgrading to Katello 4.16, the upgrade is failing with the following error:

~~
PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_katello_installed_packages_on_nvrea"
~~

Following is the detailed trace of the same from the satellite.log file:

================================== * 2025-05-15 14:15:02 [DEBUG ] [configure] Exec[foreman-rake-db:migrate](provider=posix): Executing '/usr/sbin/foreman-rake db:migrate' * 2025-05-15 14:15:02 [DEBUG ] [configure] Executing with uid=foreman: '/usr/sbin/foreman-rake db:migrate' * 2025-05-15 14:16:12 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: rake aborted! * 2025-05-15 14:16:12 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db: migrate]/Exec[foreman-rake-db:migrate]/returns: StandardError: An error has occurred, this and all later migrations canceled: * 2025-05-15 14:16:12 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: * 2025-05-15 14:16:12 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_katello_installed_packages_on_nvrea" * 2025-05-15 14:16:12 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: DETAIL: Key (nvrea)=(gcc-objc++-4.8.5-39.el7.x86_64) already exists. * 2025-05-15 14:16:12 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `exec' * 2025-05-15 14:16:12 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block (2 levels) in execute'

==================================

It shows the following error:
~~
/Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns
    rake aborted!
    StandardError: An error has occurred; this and all later migrations canceled:
        PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_katello_installed_packages_on_nvrea"
    DETAIL:  Key (nvrea)=(gcc-objc++-4.8.5-39.el7.x86_64) already exists.
~~

Expected results:

 The upgrade should be completed without error.

Note: related to https://postgresql.verite.pro/blog/2018/08/27/glibc-upgrade.html

Actions #1

Updated by The Foreman Bot 5 days ago

  • Status changed from New to Ready For Testing
  • Assignee set to Ian Ballou
  • Pull request https://github.com/Katello/katello/pull/11421 added
Actions #2

Updated by Ian Ballou 5 days ago

  • Target version changed from Katello Next to Katello 4.16.2
Actions #3

Updated by Samir Jha 4 days ago

  • Triaged changed from No to Yes
Actions

Also available in: Atom PDF