[Solved] Migration 7.x to 8.x allways fails with "Unauthorized access to administration"

Hello,

I have a problem to migrate my running SuiteCRM 7.x to 8.x and I hope I can get some help or ideas about this.

Facts:
We are currently running SuiteCRM 7.11, hosted on Debian 10 with PHP 7.4 and MariaDB.
There are already quite a number of contacts and accounts with corresponding history and comments in SuiteCRM.
The instance is accessible via the URL http://mydomain.local. So in apache2 the server name entry for “mydomain.local” refers to the directory “/var/www/html/public”. Otherwise everything is standard.

Procedure:
First, I use the update wizard in SuiteCRM to update it to version 7.13.3. This works without any problems and no unusual behaviour can be observed afterwards.

  1. Rename “/var/www/html/public” to "/var/www/html/legacy
  2. Extract the migration package “SuiteCRM-8.3.0-7.13-migration.zip” in “/var/www/html/”.
  3. Move “/var/www/html/legacy” to “/var/www/html/public/legacy”.
  4. Adjust the “.htaccess”, “config.php” and “config_override.php” in “/var/www/html/public/legacy” according to the instructions.
  5. Start the migration in the directory “/var/www/html/”.
    5.1 Execute “./bin/console -vvv suitecrm:app:setup-legacy-migration”:
    Everything OK, only in the “/var/www/html/public/legacy/.htaccess” has now duplicate “RewriteBase /legacy/public/legacy” has to be corrected to “RewriteBase /legacy”.
    5.2 Execute “./bin/console -vvv suitecrm:app:upgrade -t SuiteCRM-8.3.0”
    All green, no errors.
SuiteCRM Upgrade
============

Running: backup-original-modules
step: backup-original-modules | status: done
Successfully backed up files
Running: check-package
step: check-package | status: done
Package found in path
Running: extract-package
step: extract-package | status: done
Package extracted
Running: check-permissions
step: check-permissions | status: done
Permissions checked
Running: install-upgrade-package
step: install-upgrade-package | status: done
Successfully installed package
Running: clear-symfony-cache
step: clear-symfony-cache | status: done
Successfully cleared cache

>

5.3. Execute “./bin/console -vvv suitecrm:app:upgrade-finalize -m override -t SuiteCRM-8.3.0”
Result:

SuiteCRM Finalize Upgrade
============

Running: legacy-post-upgrade
step: legacy-post-upgrade | status: failed
Unexpected error running Legacy Post Upgrade
Unauthorized access to administration

>

It doesn’t matter which -m options I try, only this one comes up. There is nothing more in the log, or I don’t see anything.

[2023-06-08 11:29:30] upgrade.INFO: Running step: check-legacy-config [] []
[2023-06-08 11:29:30] upgrade.INFO: step: check-legacy-config | status: done [] []
[2023-06-08 11:29:30] upgrade.INFO: step: check-legacy-config | messages: [] []
[2023-06-08 11:29:30] upgrade.INFO: Found legacy config. Proceeding with migration [] []
[2023-06-08 11:29:30] upgrade.INFO: step: check-legacy-config | debug: no debug info [] []
[2023-06-08 11:29:30] upgrade.INFO: Running step: setup-env [] []
[2023-06-08 11:29:30] upgrade.INFO: step: setup-env | status: done [] []
[2023-06-08 11:29:30] upgrade.INFO: step: setup-env | messages: [] []
[2023-06-08 11:29:30] upgrade.INFO: Created .env.local [] []
[2023-06-08 11:29:30] upgrade.INFO: step: setup-env | debug: no debug info [] []
[2023-06-08 11:29:30] upgrade.INFO: Running step: change-theme [] []
[2023-06-08 11:29:30] upgrade.INFO: step: change-theme | status: done [] []
[2023-06-08 11:29:30] upgrade.INFO: step: change-theme | messages: [] []
[2023-06-08 11:29:30] upgrade.INFO: Set suite8 theme as default theme [] []
[2023-06-08 11:29:30] upgrade.INFO: step: change-theme | debug: no debug info [] []
[2023-06-08 11:29:32] upgrade.INFO: Running step: manual-config-check [] []
[2023-06-08 11:29:32] upgrade.INFO: step: manual-config-check | status: done [] []
[2023-06-08 11:29:32] upgrade.INFO: step: manual-config-check | messages: [] []
[2023-06-08 11:29:32] upgrade.INFO: Manual config check done [] []
[2023-06-08 11:29:32] upgrade.INFO: step: manual-config-check | debug: no debug info [] []
[2023-06-08 11:29:32] upgrade.INFO: Running step: change-rewrite-base [] []
[2023-06-08 11:29:32] upgrade.INFO: step: change-rewrite-base | status: done [] []
[2023-06-08 11:29:32] upgrade.INFO: step: change-rewrite-base | messages: [] []
[2023-06-08 11:29:32] upgrade.INFO: Updated htaccess RewriteBase [] []
[2023-06-08 11:29:32] upgrade.INFO: step: change-rewrite-base | debug: no debug info [] []
[2023-06-08 11:29:32] upgrade.INFO: Running step: manual-rewrite-base-check [] []
[2023-06-08 11:29:32] upgrade.INFO: step: manual-rewrite-base-check | status: done [] []
[2023-06-08 11:29:32] upgrade.INFO: step: manual-rewrite-base-check | messages: [] []
[2023-06-08 11:29:32] upgrade.INFO: Manual RewriteBase check done [] []
[2023-06-08 11:29:32] upgrade.INFO: step: manual-rewrite-base-check | debug: no debug info [] []
[2023-06-08 11:29:32] upgrade.INFO: Running step: install-portability [] []
[2023-06-08 11:29:32] upgrade.INFO: step: install-portability | status: done [] []
[2023-06-08 11:29:32] upgrade.INFO: step: install-portability | messages: [] []
[2023-06-08 11:29:32] upgrade.INFO: Successfully installed the portability folder [] []
[2023-06-08 11:29:32] upgrade.INFO: step: install-portability | debug: no debug info [] []
[2023-06-08 11:30:07] upgrade.INFO: Running step: backup-original-modules [] []
[2023-06-08 11:30:08] upgrade.INFO: step: backup-original-modules | status: done [] []
[2023-06-08 11:30:08] upgrade.INFO: step: backup-original-modules | messages: [] []
[2023-06-08 11:30:08] upgrade.INFO: Successfully backed up files [] []
[2023-06-08 11:30:08] upgrade.INFO: step: backup-original-modules | debug: no debug info [] []
[2023-06-08 11:30:08] upgrade.INFO: Running step: check-package [] []
[2023-06-08 11:30:08] upgrade.INFO: step: check-package | status: done [] []
[2023-06-08 11:30:08] upgrade.INFO: step: check-package | messages: [] []
[2023-06-08 11:30:08] upgrade.INFO: Package found in path [] []
[2023-06-08 11:30:08] upgrade.INFO: step: check-package | debug: [] []
[2023-06-08 11:30:08] upgrade.INFO: Check package existence in: /var/www/html/tmp/package/upgrade/SuiteCRM-8.3.0.zip [] []
[2023-06-08 11:30:08] upgrade.INFO: Running step: extract-package [] []
[2023-06-08 11:30:11] upgrade.INFO: step: extract-package | status: done [] []
[2023-06-08 11:30:11] upgrade.INFO: step: extract-package | messages: [] []
[2023-06-08 11:30:11] upgrade.INFO: Package extracted [] []
[2023-06-08 11:30:11] upgrade.INFO: step: extract-package | debug: [] []
[2023-06-08 11:30:11] upgrade.INFO: Trying to extract to: /var/www/html/tmp/package/upgrade/SuiteCRM-8.3.0-extracted [] []
[2023-06-08 11:30:11] upgrade.INFO: Running step: check-permissions [] []
[2023-06-08 11:30:11] upgrade.INFO: step: check-permissions | status: done [] []
[2023-06-08 11:30:11] upgrade.INFO: step: check-permissions | messages: [] []
[2023-06-08 11:30:11] upgrade.INFO: Permissions checked [] []
[2023-06-08 11:30:11] upgrade.INFO: step: check-permissions | debug: no debug info [] []
[2023-06-08 11:30:11] upgrade.INFO: Running step: install-upgrade-package [] []
[2023-06-08 11:30:21] upgrade.INFO: step: install-upgrade-package | status: done [] []
[2023-06-08 11:30:21] upgrade.INFO: step: install-upgrade-package | messages: [] []
[2023-06-08 11:30:21] upgrade.INFO: Successfully installed package [] []
[2023-06-08 11:30:21] upgrade.INFO: step: install-upgrade-package | debug: [] []
[2023-06-08 11:30:21] upgrade.INFO: sync manifest generated: {"composer.json":{"path":"composer.json","action":"copy","type":"file"},"yarn.lock":{"path":"yarn.lock","action":"copy","type":"file"},"tsconfig.json":{"path":"tsconfig.json","action":"copy","type":"file"},"VERSION":{"path":"VERSION","action":"copy","type":"file"},".eslintrc.js":{"path":".eslintrc.js","action":"copy","type":"file"},"package.json":{"path":"pac$
[2023-06-08 11:30:21] upgrade.INFO: Running step: clear-symfony-cache [] []
[2023-06-08 11:30:21] upgrade.INFO: step: clear-symfony-cache | status: done [] []
[2023-06-08 11:30:21] upgrade.INFO: step: clear-symfony-cache | messages: [] []
[2023-06-08 11:30:21] upgrade.INFO: Successfully cleared cache [] []
[2023-06-08 11:30:21] upgrade.INFO: step: clear-symfony-cache | debug: no debug info [] []
[2023-06-08 11:30:26] upgrade.INFO: Running step: legacy-post-upgrade [] []
Thu, 08 Jun 2023 11:30:26 +0200 [UpgradeWizard] - begin check default permissions .
Thu, 08 Jun 2023 11:30:26 +0200 [UpgradeWizard] - end check default permissions .
Thu, 08 Jun 2023 11:30:26 +0200 [UpgradeWizard] - begin check logger settings .
Thu, 08 Jun 2023 11:30:26 +0200 [UpgradeWizard] - begin check logger settings .
Thu, 08 Jun 2023 11:30:26 +0200 [UpgradeWizard] - begin check lead conversion settings .
Thu, 08 Jun 2023 11:30:26 +0200 [UpgradeWizard] - end check lead conversion settings .
Thu, 08 Jun 2023 11:30:26 +0200 [UpgradeWizard] - begin check resource settings .
Thu, 08 Jun 2023 11:30:26 +0200 [UpgradeWizard] - begin check resource settings .
Thu, 08 Jun 2023 11:30:26 +0200 [UpgradeWizard] - Call deleteCache
[2023-06-08 11:30:26] upgrade.INFO: step: legacy-post-upgrade | status: failed [] []
[2023-06-08 11:30:26] upgrade.INFO: step: legacy-post-upgrade | messages: [] []
[2023-06-08 11:30:26] upgrade.INFO: Unexpected error running Legacy Post Upgrade [] []
[2023-06-08 11:30:26] upgrade.INFO: step: legacy-post-upgrade | debug: [] []
[2023-06-08 11:30:26] upgrade.INFO: begin check default permissions . [] []
[2023-06-08 11:30:26] upgrade.INFO: end check default permissions . [] []
[2023-06-08 11:30:26] upgrade.INFO: begin check logger settings . [] []
[2023-06-08 11:30:26] upgrade.INFO: begin check logger settings . [] []
[2023-06-08 11:30:26] upgrade.INFO: begin check lead conversion settings . [] []
[2023-06-08 11:30:26] upgrade.INFO: end check lead conversion settings . [] []
[2023-06-08 11:30:26] upgrade.INFO: begin check resource settings . [] []
[2023-06-08 11:30:26] upgrade.INFO: begin check resource settings . [] []
[2023-06-08 11:30:26] upgrade.INFO: Call deleteCache [] []

Even if I delete all data about SuiteCRM from SuiteCRM, including all settings, it does not work.
Upgrading a blank and new installation from SuiteCRM 7.13 to 8.3.0, on the other hand, works.
I also try all other migration packages e. 7.12 to 8.2.0/8.2.1/8.2.2 and 7.13 to 8.2.4. Always the same result.

Seems like the presence of data creates the problem.
But I have no more ideas. So I am open to any suggestion or idea to solve the problem.

I don’t know what could be happening…

Looking at the code, you can see it has to do with a non-admin user:

https://github.com/search?q=repo%3Asalesagility%2FSuiteCRM-Core+Unauthorized+access+to+administration&type=code

Although that doens’t make much sense when running a command-line upgrade. My guess is that some of the jobs getting executed, at some point try to do some web redirect or something not originally meant for the command line.

And it’s probably a false-positive. If you could find out which one of those checks is calling the sugar_die, you could probably just comment the sugar_die to ensure the installer continues. After a successful upgrade, uncomment it.

Good luck

Hi and thanks a lot for this idea.

I had to search for [‘ERR_NOT_ADMIN’] because this string comes from the language pack. But I was able to pin the problem down to
./public/legacy/modules/Administration/upgrade_custom_relationships.php

[...]
/**
 * Searches through the installed relationships to find broken self referencing one-to-many relationships
 * (wrong field used in the subpanel, and the left link not marked as left)
 */
function upgrade_custom_relationships($modules = array())
{
    global $current_user, $moduleList;
#    if (!is_admin($current_user)) {
#        sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
#    }
    
[...]

So the migration don’t stop anymore and quit without error message. Now I face the blank page problem (api/graphql not found) but so far that’s another problem.

Thank you.

regards
Peter

1 Like

My working solution is to create a DB-Dump of this migration and restore the DB into a plain new installation of SuiteCRM same version (v8.3.0).
Now is all working on latest version.