Satellite upgrade fails with ERROR: duplicate key value violates unique constraint "index_katello_installed_packages_on_nvrea"
Environment
- Red Hat Satellite 6.16
- Red Hat Satellite 6.17
Issue
-
While upgrading the
Red Hat Satellite6.16 to 6.17, it fails with 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)=(package_name) already exists.
## Resolution
- This is a known issue and is currently being tracked under `Jira` [SAT-34064](https://issues.redhat.com/browse/SAT-34064).
- For more information, open a [support case](https://access.redhat.com/support/cases) with `Red Hat Technical Support Team`.
For more KB articles/solutions related to Red Hat Satellite 6.x Installation/Upgrade/Update Issues, please refer to the [Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Installation/Upgrade/Update Issues.](https://access.redhat.com/articles/6418281)
## Diagnostic Steps
- The following logs are observed in the **`satellite.log`** file:
[DEBUG ] [configure] ExecThis content is not included.foreman-rake-db:migrate: Executing '/usr/sbin/foreman-rake db:migrate'
[DEBUG ] [configure] Executing with uid=foreman: '/usr/sbin/foreman-rake db:migrate'
[INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: rake aborted!
[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:
[INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns:
[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"
[INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: DETAIL: Key (nvrea)=(package_name) already exists.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.