0

When I run drush updb on my Drupal 8.3.1 site, I get:

PHP Fatal error: Call to undefined function system_rebuild_module_data() in /var/www/mysite/web/core/includes/update.inc on line 46

system_rebuild_module_data() is defined in web/core/modules/system.module on line 1102.

So I'm guessing this is not a bug in Drupal 8.3.1 given that it has been released; rather it must be something to do with my setup. Perhaps the PHP class autoloader or equivalent isn't working properly such that the function in system.module is not being made visible to update.inc.

Can you advise what the root cause might be and how I could overcome this fatal error stopping me running drush updb?

This is my composer.json file.

{
  "name": "my-site",
  "description": "My Site Website",
  "type": "project",
  "authors": [
    {
      "name": "",
      "role": ""
    }
  ],
  "repositories": [
    {
      "type": "composer",
      "url": "https://packages.drupal.org/8"
    },
    {
      "type": "composer",
      "url": "https://packagist.org"
    }
  ],
  "config": {
    "preferred-install": "source",
    "discard-changes": true
  },
  "require": {
    "composer/installers": "^1.0.20",
    "cweagans/composer-patches": "~1.0",
    "drupal/core": "8.3.1",
    "drush/drush": "8.1.2",
    "drupal/migrate_tools": "2.0.0-beta1",
    "drupal/migrate_upgrade": "2.0.0-beta1",
    "drupal/admin_toolbar": "1.19.0",
    "drupal/coder": "8.2.5",
    "drupal/libraries": "3.x-dev",
    "drupal/pathauto": " 1.0.0",
    "drupal/honeypot": "1.24.0",
    "drupal/metatag": "1.0.0",
    "drupal/mollom": "1.1.0",
    "drupal/smtp": "1.0.0-beta2",
    "drupal/token": "1.0.0",
    "drupal/simple_sitemap": "2.9.0",
    "drupal/google_analytics": "2.1.0",
    "wkse/google_tag": "8.0.2",
    "drupal/video_embed_media": "1.5.0",
    "drupal/video_embed_field": "1.5.0",
    "drupal/masquerade": "2.0.0-beta1",
    "drupal/paragraphs": "1.1.0",
    "drupal/slick": "1.0.0-rc3",
    "drupal/blazy":"1.0.0-rc1",
    "drupal/slick_extras": "1.0.0-beta2",
    "drupal/slick_media": "1.0.0-rc1",
    "drupal/responsive_menu": "2.4.0",
    "drupal/addtoany": "1.8.0",
    "drupal/videojs": "1.0.0",
    "drupal/redis": "1.0.0-beta1",
    "drupal/views_infinite_scroll": "1.3.0",
    "drupal/twig_tweak": "1.7.0",
    "drupal/maxlength": "1.0.0-beta1",
    "drupal/entity": "1.0.0-alpha4",
    "drupal/migrate_plus": "3.0.0-beta1",
    "drupal/focal_point": "1.0.0-beta4",
    "drupal/crop": "1.2.0",
    "mollom/client":"dev-psr4",
    "drupal/ctools": "3.0.0",
    "drupal/superfish": "1.0.0-rc6",
    "drupal/devel": "1.0.0-rc2"
  },
  "require-dev": {
    "behat/mink": "~1.6",
    "behat/mink-goutte-driver": "~1.2",
    "jcalderonzumba/gastonjs": "^1.1@dev",
    "jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
    "mikey179/vfsStream": "~1.2",
    "phpunit/phpunit": "~4.8",
    "symfony/css-selector": "2.7.*"
  },
  "conflict": {
    "drupal/drupal": "*"
  },
  "prefer-stable": true,

  "scripts": {
    "post-install-cmd": "sh ./scripts/composer/post-install.sh"
  },
  "extra": {
    "installer-paths": {
      "web/core": ["type:drupal-core"],
      "web/modules/contrib/{$name}": ["type:drupal-module"],
      "web/profiles/contrib/{$name}": ["type:drupal-profile"],
      "web/themes/contrib/{$name}": ["type:drupal-theme"],
      "drush/contrib/{$name}": ["type:drupal-drush"]
    },
    "patches": {
      "drupal/core": {
        "Contextual links broken because of JS error": "web/modules/patches/core-js-fix-contextual.patch",
        "Fix quick edit contextual link not available and throwing js error": "web/modules/patches/drupalbehaviorerror.patch"
      }
    }
  }
}

This is the full stack trace that was outputted with the error at the terminal. I have included my Composer, Drush and PHP versions in the output.

[07:56 PM]-[vagrant@redisvmadded]-[/var/www/mysite.dev/web]-[git mysite_security_updates_apr2017] 
$ drush updb
The following module is missing from the file system: minimal bootstrap.inc:240                                                                                                                                   [warning]
PHP Fatal error:  Call to undefined function system_rebuild_module_data() in /var/www/mysite.dev/web/core/includes/update.inc on line 46
PHP Stack trace:
PHP   1. {main}() /var/www/mysite.dev/vendor/drush/drush/drush.php:0
PHP   2. drush_main() /var/www/mysite.dev/vendor/drush/drush/drush.php:12
PHP   3. Drush\Boot\BaseBoot->bootstrap_and_dispatch() /var/www/mysite.dev/vendor/drush/drush/includes/preflight.inc:66
PHP   4. drush_dispatch() /var/www/mysite.dev/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php:67
PHP   5. call_user_func_array:{/var/www/mysite.dev/vendor/drush/drush/includes/command.inc:185}() /var/www/mysite.dev/vendor/drush/drush/includes/command.inc:185
PHP   6. drush_command() /var/www/mysite.dev/vendor/drush/drush/includes/command.inc:185
PHP   7. _drush_invoke_hooks() /var/www/mysite.dev/vendor/drush/drush/includes/command.inc:217
PHP   8. call_user_func_array:{/var/www/mysite.dev/vendor/drush/drush/includes/command.inc:366}() /var/www/mysite.dev/vendor/drush/drush/includes/command.inc:366
PHP   9. drush_core_updatedb() /var/www/mysite.dev/vendor/drush/drush/includes/command.inc:366
PHP  10. update_main() /var/www/mysite.dev/vendor/drush/drush/commands/core/core.drush.inc:462
PHP  11. update_fix_compatibility() /var/www/mysite.dev/vendor/drush/drush/commands/core/drupal/update.inc:112
PHP  12. update_check_incompatibility() /var/www/mysite.dev/web/core/includes/update.inc:22

Fatal error: Call to undefined function system_rebuild_module_data() in /var/www/mysite.dev/web/core/includes/update.inc on line 46

Call Stack:
    0.0001     224136   1. {main}() /var/www/mysite.dev/vendor/drush/drush/drush.php:0
    0.0018     390448   2. drush_main() /var/www/mysite.dev/vendor/drush/drush/drush.php:12
    0.2686    9406544   3. Drush\Boot\BaseBoot->bootstrap_and_dispatch() /var/www/mysite.dev/vendor/drush/drush/includes/preflight.inc:66
    0.8071    8732656   4. drush_dispatch() /var/www/mysite.dev/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php:67
    0.9030   11534768   5. call_user_func_array:{/var/www/mysite.dev/vendor/drush/drush/includes/command.inc:185}() /var/www/mysite.dev/vendor/drush/drush/includes/command.inc:185
    0.9030   11535120   6. drush_command() /var/www/mysite.dev/vendor/drush/drush/includes/command.inc:185
    0.9032   11540088   7. _drush_invoke_hooks() /var/www/mysite.dev/vendor/drush/drush/includes/command.inc:217
    0.9069   11583864   8. call_user_func_array:{/var/www/mysite.dev/vendor/drush/drush/includes/command.inc:366}() /var/www/mysite.dev/vendor/drush/drush/includes/command.inc:366
    0.9069   11584144   9. drush_core_updatedb() /var/www/mysite.dev/vendor/drush/drush/includes/command.inc:366
    0.9109   11771208  10. update_main() /var/www/mysite.dev/vendor/drush/drush/commands/core/core.drush.inc:462
    1.9984   26727888  11. update_fix_compatibility() /var/www/mysite.dev/vendor/drush/drush/commands/core/drupal/update.inc:112
    2.0147   26930512  12. update_check_incompatibility() /var/www/mysite.dev/web/core/includes/update.inc:22

Drush command terminated abnormally due to an unrecoverable error.                                                                                                                                                [error]
Error: Call to undefined function system_rebuild_module_data() in /var/www/mysite.dev/web/core/includes/update.inc, line 46

[07:56 PM]-[vagrant@redisvmadded]-[/var/www/mysite.dev/web]-[git mysite_security_updates_apr2017] 
$ drush --version
 Drush Version   :  8.1.2 


[08:13 PM]-[vagrant@redisvmadded]-[/var/www/mysite.dev]-[git mysite_security_updates_apr2017] 
$ composer --version
Composer version 1.4.1 2017-03-10 09:29:45

[09:48 PM]-[vagrant@redisvmadded]-[/var/www/mysite.dev]-[git mysite_security_updates_apr2017] 
$ 


[09:48 PM]-[vagrant@redisvmadded]-[/var/www/mysite.dev]-[git ou82_security_updates_apr2017] 
$ php -v
PHP 5.6.30-7+deb.sury.org~trusty+1 (cli) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.5.1, Copyright (c) 2002-2017, by Derick Rethans

I'm running the site locally inside a Vagrant/puphpet.com provisioned VM running Ubuntu 14.04 LTS 64bit on top of a Mac OS X Sierra 10.12.4 host.

  • 2
    Sounds to me like system.module (or possibly all modules) isn't installed properly. That might be tricky to restore from, I'd start by trying to check the content of core.extension directly in the config table. – Berdir May 3 '17 at 23:06
  • 1
    I see that the minimal (profile?) is missing - "The following module is missing from the file system: minimal". Don't think that is the reason, but you never know. What does drush status report? – hansfn May 9 '17 at 11:11
  • +1 thanks Berdir - I tried it again on another machine and it was OK there. So your suggestion may be the cause. And +1 thanks hansfn, I will bear that point in mind. Thank you. – therobyouknow May 10 '17 at 13:16
1

We ran into exactly the same issue. It turns out it that our caches were broken as the host Drupal was running on was rebooted without Drupal having the chance to shutdown cleanly.

To resolve this we used Drush and simply ran drush cr. After this Drupal was back to normal.

0

It can happen if drush updb run from the parent of the docroot and it cannot see the docroot (docroot might be web)

cd docroot
drush updb

solved it for us. Some older installations can not see the docroot from the parent directory.

Perhaps one can also specify the root

drush updb --root=/var/www/example
0

This can happen when the files of installation profile of the site are missing.

Restore the files of the installation profile(s) it into web/code/profile, and rerun drush updb

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.