Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-35573

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

XMLWordPrintable

    • None
    • None
    • None
    • No Coverage
    • Yes

      Description of problem:

      While upgrading the Satellite from 6.16 to 6.17, 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'

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

      For detailed logs, please check the attached 'satellite-upgrade-db-migrate.log' file.

       

      Steps to reproduce:
       
       1. Enable the satellite-maintain 6.17 repo by referring to the KCS and upgrade the maintenance package.
       2. After running the upgrade command with the whitelist option:

             # satellite-maintain upgrade run  --whitelist="non-rh-packages"

      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.

              iballou@redhat.com Ian Ballou
              rhn-support-ashipati Ashish Patil
              Vladimír Sedmík Vladimír Sedmík
              Quinn James Quinn James
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: