So I was following this doc to add a new setting which asked me to run bin/regen.sh script. But running the script failed with the following error:

PHP Fatal error:  Call to undefined function db_query() in /opt/buildkit/build/mytestbuild/sites/all/modules/civicrm/CRM/Utils/System/DrupalBase.php on line 303

Now I cannot access CiviCRM at all. I get the following message. Drupal works fine though.

The website encountered an unexpected error. Please try again later.
Error message
CRM_Core_Exception: Found installation canary. This suggests that something went wrong with tracking installation process. Please post to forum or JIRA. in Civi\Core\InstallationCanary::check() (line 53 of /opt/buildkit/build/mytestbuild/sites/all/modules/civicrm/Civi/Core/InstallationCanary.php).

There seem to be two concerns here - how to get mytestbuild working again - and how to get regen.sh to work.

Get mytestbuild working

The quickfix is to drop the table civicrm_install_canary.

The more general fix is to put your codebase to a pristine state (e.g. no local changes/patches; check out the official upstream branch; git scan status may help). Then you can create a pristine DB using one of these commands:

  • civibuild restore mytestbuild - This is faster -- it loads a SQL snapshot from the last time you ran civibuild.
  • civibuild reinstall mytestbuild - This is slower -- it drops the Drupal+Civi databases, deletes any config files, and recreates them.

Get regen.sh working

This appears to be a regression affecting regen.sh. To determine this, I did a few things:

  1. Checkout the latest code from master and run regen.sh. See the same problem.
  2. Clear out uncommitted changes (e.g. git checkout -- sql/civicrm_generated.mysql)
  3. Repeat above, but checkout tag 4.7.0 instead of branch master. (When jumping among different versions, I usually use ./bin/givi checkout <TAG> because that checks out corresponding tags in packages/, drupal/, etc. The need to )

After spot-checking a few tags, I determined the problem arose somewhere after 4.7.0 and before 4.7.2. Since the context involves bin/ and the error involves CRM/Utils/System, we can make an educated guess that there was a change in one of those folders and skim the log:

git log 4.7.0..4.7.2 bin/
git log 4.7.0..4.7.2 CRM/Utils/System
git log -p 4.7.0..4.7.2 bin/
git log -p 4.7.0..4.7.2 CRM/Utils/System

I'm pretty sure that the regression occurred due to https://github.com/civicrm/civicrm-core/commit/40d5632a25086d7c963538f2b6daf2a2546e16a6 ; undoing that patch allows regen.sh to run, but you'd need to read/think a bit more figure out a proper fix.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.