[Satellite 6] Error during manifest import "Failed to import archive"
Environment
- Red Hat Satellite 6.0
- Red Hat Satellite 6.1
- Red Hat Satellite 6.2 (prior to update 6.2.4)
Issue
- Error importing new Satellite manifest file
- Attempting to import a manifest in Satellite 6 fails with the below errors in/var/log/foreman/production.log:
2016-10-24 12:50:04 [app] [E] Error during manifest import: {"displayMessage"=>"Failed to import archive", "requestUuid"=>"398feb37-f6bd-4709-998a-630f0e8f4a95"}
2016-10-24 12:50:04 [foreman-tasks/action] [E] Failed to import archive (Katello::Errors::CandlepinError)
Also the following errors may be witnessed in /var/log/candlepin/error.log:
2016-10-24 12:50:04,662 [thread=http-bio-8443-exec-7] [req=398feb37-f6bd-4709-998a-630f0e8f4a95, org=secondorg] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - ERROR: duplicate key value violates unique constraint "cp_content_label_key"
Detail: Key (label)=(rhel-7-server-containers) already exists.
2016-10-24 12:50:04,693 [thread=http-bio-8443-exec-7] [req=398feb37-f6bd-4709-998a-630f0e8f4a95, org=secondorg] ERROR org.candlepin.sync.Importer - Failed to import archive
- Downloaded new manifest file, but it will not upload to the Satellite. Stopped task has error message:
Runtime Error ERROR: duplicate key value violates unique constraint "cp_content_label_key"
Detail: Key (label)=(rhel-7-server-containers) already exists. at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse:2,157
Resolution
This issue is resolved with fix to This content is not included.Bugzilla #1388201 and Satellite 6.2.4 async errata update RHBA-2016:2699, however a workaround exists until you are able to update to Satellite 6.2.4:
Prior to executing the attached script, please back up the postgres database using the below steps.
- Stop all Satellite services:
katello-service stop
- Check the size of your postgres database:
du -h --max-depth=0 /var/lib/pgsql/data
- Move to a directory that is large enough to encompass an archive of at least this size, then execute the below:
tar --selinux -czf pgsql_data.tar.gz /var/lib/pgsql/data/
- After the postgres data backup is complete, copy the content-id-fix.sh script attached to this KCS to the Satellite server, make it executable, and run it as root (or sudo):
chmod +x content-id-fix.sh
./content-id-fix.sh
- The script will restart the satellite services, verify this completes:
katello-service status
- After this reimport manifest.
Note: It is not required to re-register any content host after following the workaround, the content-id-fix.sh drops index on cp_content table which do not harm content host registrations.
For more KB articles/solutions related to Red Hat Satellite 6.x Manifest Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x Manifest Issues
Diagnostic Steps
Upon manifest import failure, check /var/log/foreman/production.log for the following errors messages:
2016-10-24 12:50:04 [app] [E] Error during manifest import: {"displayMessage"=>"Failed to import archive", "requestUuid"=>"398feb37-f6bd-4709-998a-630f0e8f4a95"}
2016-10-24 12:50:04 [foreman-tasks/action] [E] Failed to import archive (Katello::Errors::CandlepinError)
Check /var/log/candlepin/error.log for the following errors:
2016-10-24 12:50:04,662 [thread=http-bio-8443-exec-7] [req=398feb37-f6bd-4709-998a-630f0e8f4a95, org=secondorg] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - ERROR: duplicate key value violates unique constraint "cp_content_label_key"
Detail: Key (label)=(rhel-7-server-containers) already exists.
2016-10-24 12:50:04,693 [thread=http-bio-8443-exec-7] [req=398feb37-f6bd-4709-998a-630f0e8f4a95, org=secondorg] ERROR org.candlepin.sync.Importer - Failed to import archive
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.