Project

General

Profile

Actions

Bug #38504

closed

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

Added by Ian Ballou 10 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Hosts
Target version:
Difficulty:
Triaged:
Yes
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 10 months 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 10 months ago

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

Updated by Samir Jha 10 months ago

  • Triaged changed from No to Yes
Actions #4

Updated by The Foreman Bot 10 months ago

  • Fixed in Releases Katello 4.18.0 added
Actions #5

Updated by Ian Ballou 10 months ago

  • Status changed from Ready For Testing to Closed
Actions #6

Updated by The Foreman Bot 10 months ago

  • Fixed in Releases Katello 4.16.2 added
Actions #7

Updated by Pavan Soma Shekar 9 months ago

  • Category set to Hosts
Actions #8

Updated by The Foreman Bot 9 months ago

  • Fixed in Releases Katello 4.17.1 added
Actions #9

Updated by Ian Ballou 8 months ago

  • Subject changed from Satellite 6.17 upgrade fails with ERROR: duplicate key value violates unique constraint "index_katello_installed_packages_on_nvrea" to Katello 4.16 upgrade fails with ERROR: duplicate key value violates unique constraint "index_katello_installed_packages_on_nvrea"
Actions

Also available in: Atom PDF