Upgrade 11.0.3 -> 12 failed in post rebuild: Invalid favorite_link

Hi, 

currently upgrading an instance from 11.0.3 to 12. On 11.0.3 with PHP: 7.4.3 and Mysql: 5.7.38. Everything seems to work correctly. When we start the upgrade with the silent installer (or ui installer doesn't matter much) we eventually hit the following error: 

Tue, 14 Jun 2022 07:08:46 +0000 [Upgrader] - Verifying audit tables for modules: Leads,Cases,Bugs,ProjectTask,Campaigns,Prospects,Contacts,Accounts,Opportunities,Notes,Calls,Meetings,Tasks,EmailAddresses,Contracts,ProductTemplates,Quotes,Products,RevenueLineItems,ForecastManagerWorksheets,Quotas,BusinessCenters,Shifts,ShiftExceptions,Messages,Purchases,PurchasedLineItems,DataPrivacy,ReportSchedules,Tags,KBContents,KBContentTemplates,Escalations,DocumentTemplates,DocumentMerges,aconf_Configurator,aconf_Import_Match,aconf_Import_Auto_Fill
Tue, 14 Jun 2022 07:08:46 +0000 [Upgrader] - Database repaired
Tue, 14 Jun 2022 07:08:46 +0000 [Upgrader] - Start rebuilding relationships
Tue, 14 Jun 2022 07:09:33 +0000 [Upgrader] - ERROR: Exception: Invalid link favorite_link
Tue, 14 Jun 2022 07:09:33 +0000 [Upgrader] - Finished script 2_Rebuild
Tue, 14 Jun 2022 07:09:33 +0000 [Upgrader] - ERROR: Post-upgrade stage failed! Error executing post scripts

We already tried the following but without any luch: 

- truncate the relationships table in the database (it's not used anymore to my knowledge)

- prior upgrade hit the repair relationships and do a quick repair / rebuild. 

Does anyone else have any idea what the cause could be and most importantly a solution. 

  • I encountered this invalid link error in past; after installing the package via module loader. But after doing a quick repair and rebuild (or rebuild relationships) the error message went away. May be before the upgrade try repair and rebuild or rebuild relationship. We recently upgraded the instance from 11 to 12 (with heavy customisations) but didn't face this issue.

  • Hi

    we already did a quick repair and rebuild and a rebuild relationships before we started the upgrade. I will try the upgrade again via the UI but I don't think this solves anything since we already tried it in the past. 

  • If repair and rebuild not worked then yes try via UI but agree with you that it will not solve the problem until and unless UI perform some special magic Slight smile

  • Do you get any additional warnings in your PHP logs or Sugar Logs?

    Check your file permissions, I've had issues with file permissions during upgrades since the beginning of time... (v 6.0)

    My fix-it-all is to run each of these from Sugar root (careful doing so, if your uploads is huge it will take forever, we mount our upload directoryand I usually unmount it during the upgrade then mount it again afterwards)

    sudo chown -R  apache:apache * 

    sudo find . -type d -exec chmod 775 {} \;

    sudo find . -type f -exec chmod 664 {} \;

    After that I repeat the upgrade (I always use command line for my upgrades) with the stage set to continue: -S continue.

    Hopefully that helps,
    Francesca

  • We didn't see anything additional in the php logs. In the sugar logs the only thing we noticed was the invalid link. During the upgrade we got some yellow errors about tpl files and a custom field definition that still uses font awsome. But that shouldn't be related. 

    I will try above recommendations somewhere today. 

  • For problems related to file permissions, I would highly recommend using following Sugar config settings to avoid this issues.

    support.sugarcrm.com/.../
  • We just got the cause of this behaviour. One of our admins upgraded mysql / php first and after that upgraded from 11.0.3 to 12.0. We switched it (upgrade sugar first , then mysql/php) and the error was fixed.

  • Encountered similar issues with 11.0.3 to 12.0.0 upgrade at the script 2_Rebuild stage and then at other points after.  Tried both strategies with php 7.4/mysql 5.7 as well as php 8/mysql 8... had to use the -S continue flag and step through various script failures, made it feel super untested in general.  It would be helpful if we could have clarity on which versions are supported/required for the upgrade silent installer itself at the time the scripts are run (vs which versions of php/mysql are supported post-upgrade). Thanks Jeroen for sharing some of your experience here.

  • I usually check the Supported Platforms documentation and go for the highest version supported by both the old and the new version, there is always an overlap.

    In this case MySQL v8.0 and PHP 7.4

    See: 

    https://support.sugarcrm.com/Resources/Supported_Platforms/Sugar_11.0.x_Supported_Platforms/

    and

    https://support.sugarcrm.com/Resources/Supported_Platforms/Sugar_12.0.x_Supported_Platforms/

    I then perform the Sugar Upgrade.
    And only after that perform any further upgrades to the stack (like moving to PHP 8.0)

    FrancescaS

  • Here's the details of the script 2_Rebuild error I was facing: 

    Mon, 13 Jun 2022 20:56:11 +0000 [Upgrader] - Start rebuilding relationships
    Mon, 13 Jun 2022 20:56:14 +0000 [Upgrader] - PHP: [2] mysqli::prepare(): Couldn't fetch mysqli in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php at 96
    Mon, 13 Jun 2022 20:56:14 +0000 [Upgrader] - PHP: [2] Doctrine\DBAL\Driver\Mysqli\Exception\ConnectionError::new(): Couldn't fetch mysqli in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionError.php at 19
    Mon, 13 Jun 2022 20:56:14 +0000 [Upgrader] - PHP: [2] Doctrine\DBAL\Driver\Mysqli\Exception\ConnectionError::new(): Couldn't fetch mysqli in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionError.php at 19
    Mon, 13 Jun 2022 20:56:14 +0000 [Upgrader] - PHP: [2] Doctrine\DBAL\Driver\Mysqli\Exception\ConnectionError::new(): Couldn't fetch mysqli in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Exception/ConnectionError.php at 19
    Mon, 13 Jun 2022 20:56:14 +0000 [Upgrader] - ERROR: Exception: An exception occurred while executing 'DELETE FROM system_process_lock WHERE unique_id = ? AND additional_key = ?' with params ["MetaDataManager::loadAndCacheMetadata", "#"]:
    Wrong parameters for Doctrine\DBAL\Driver\Mysqli\Exception\ConnectionError([string $message [, long $code [, Throwable $previous = NULL]]])
    Mon, 13 Jun 2022 20:56:14 +0000 [Upgrader] - Finished script 2_Rebuild
    Mon, 13 Jun 2022 20:56:14 +0000 [Upgrader] - ERROR: Post-upgrade stage failed! Error executing post scripts