Enable or disable a Red Hat repository shows ERROR: relation "katello_yum_metadata_files" does not exist

Solution Verified - Updated -

Environment

  • Red Hat Satellite 6.4

Issue

  • Disabling the Red Hat repository throws below error.
PG::UndefinedTable: ERROR: relation "katello_yum_metadata_files" does not exist LINE 8: WHERE a.attrelid = '"katello_yum_metadata_fil... ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod, c.collname, col_description(a.attrelid, a.attnum) AS comment FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum LEFT JOIN pg_type t ON a.atttypid = t.oid LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation WHERE a.attrelid = '"katello_yum_metadata_files"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum
  • Publishing a new content-view or synchronizing a repository fails with same error.

Resolution

  • Verify whether all the migrations are completed:
# foreman-rake db:migrate:status
  • Re-run the upgrade if some migrations are still pending:
# foreman-maintain upgrade run --target-version 6.4.z

Note: It is advised to take the snapshot or backup of the Red Hat Satellite server.

Root Cause

  • The katello_yum_metadata_files table does not exist in the foreman database. Re-running the satellite-installer runs the database migrations which creates the missing tables and fixes the issue.

Diagnostic Steps

  • Command output example:
# foreman-rake db:migrate:status

database: foreman
 Status   Migration ID    Migration Name
--------------------------------------------------
   up     20090714132448  Create hosts
   up     20090714132449  Add audits table
   up     20090715143858  Create architectures
   up     20090717025820  Create media
   up     20090718060746  Create domains
   up     20090718064254  Create subnets
   down    20181108171732  Change blog url
   down    20181219205642  Create yum metadata file
   down    20190205142619  Add content constraints

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.

Comments