Upgrader 9.X failed to perform database migration

Problem 

When you perform an upgrade from 9.3, 9.3.1 and 9.4 you may be presented with errors as follows:

CloudBolt upgrader [20200512.0859]: 10-cloudbolt=>upgrading=> Failed to perform database migration!

CloudBolt upgrader [20200512.0859]: CloudBolt upgrader failed on <IPADDRESS> while upgrading component 10-cloudbolt!

In the /var/log/cloudbolt/install/upgrade_NNNNNN.NNNN.log or the /var/log/cloudbolt/ssl_error_log.log you may see something similar to:

MySQLdb._exceptions.OperationalError: (1054, "Unknown column 'portals_portalconfig.sso_provider_id' in 'field list'")

Cause

When you are upgrading from 9.3 and above, you need to update the database schema. You may have to run the migration process manually and run the upgrade again, or “fake” a migration for the process to work.

Affected Versions

  • 9.x Upgrader

Solution

Overview

Below are some steps to follow depending on the specific error message you receive. First off you will need to ensure you have run the database migration. If you still see very specific error messages around for example:

  • Portals

  • Accounts

  • Alerts

Then you will have to run the migration for the failing component.

Ensure you have completed the Database migration steps of the upgrade process

  1. Follow the Run Django Database Migrations step in the Upgrading to 9.X documentation
    https://docs.cloudbolt.io/articles/#!cloudbolt-latest-docs/upgrading-to-9-x/a/h2__1646278176
    You may have to follow the manual migrate if an upgrade fails and then try the upgrade again.

If your export included a database dump and load, you will need to run database migrations. This is because the database on your new CloudBolt 9.X instance will be in the exact same state as the database on your CloudBolt 8.X instance, but the CloudBolt 9.X instance will have code and schema changes that the CloudBolt 8.X instance lacks.

Fortunately, running Django database migrations is straightforward.

  1. Log in to your CloudBolt 9.X machine.

  2. Run the Django migration management command python /opt/cloudbolt/manage.py migrate. /opt/cloudbolt/ is the default directory for CloudBolt, but your root CloudBolt directory could be somewhere else.

  3. Wait for the migrations to complete, then restart httpd systemctl restart httpd.

If you have already done the above and you received an error message specific to a section. Then keep following on.


Running the migration for a failing component

  1. If you have run the migration and have come across a specific component failure. Then you can run the migration for just that component.

  2. SSH into your CloudBolt server if you have not already and run the following command

    /opt/cloudbolt/manage.py --fake <app_name> 0007_new_migration
  3. Replace <app_name> with the error message, for this example it is Portals

    /opt/cloudbolt/manage.py --fake portals 0007_new_migration

  4. Once this migration completes, re run the complete migration.

    /opt/cloudbolt/manage.py migrate

  5. If step 4 still has a failure, repeat step 3 for the noted failing component then step 4 again. Continue to repeat until step 4 runs without any failures.

Additional information

Upgrading to CloudBolt 9.x : https://docs.cloudbolt.io/articles/#!cloudbolt-latest-docs/upgrading-to-9-x/a/h2__1646278176


Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.