• Aegir 3.144
  • Drupal 8.4.4 -> 8.4.5 (repeatable with Drupal 8.2.0)
  • Drush 8.1.17-dev (also 8.1.16)

Sites import and create on the platform correctly but when trying to clone a site to same platform (8.4.4) or to new platform (8.4.5) or when trying to migrate to new platform it fails.

Initially it failed with "ERROR! Registry Rebuild requires a working Drupal site to operate on" but I found that it was testing for the presence of the module_list function - even though it doesn't use it for D8 - and that presumably got dropped recently as it was marked as @deprecated in Drupal 8.0. A bit of logic later and it passed that check.

I then hit another issue:

I now get "Fatal error: Call to undefined function cache() in /var/aegir/.drush/registry_rebuild/registry_rebuild.drush.inc on line 158" where cache is a function defined in core/lib/Drupal.php, changing the call to \Drupal::cache() gives "exception 'Drupal\Core\DependencyInjection\ContainerNotInitializedException' with message '\Drupal::$container is not initialized yet."

drush --debug rr
Using the Drush script found at /var/aegir/.config/composer/vendor/drush/drush/drush.launcher using pcntl_exec
Loading drushrc "/var/aegir/.drush/drushrc.php" into "home.drush" scope. [0.01 sec, 2.84 MB]                                                                                                    [bootstrap]
Include /var/aegir/hostmaster-7.x-3.144/profiles/hostmaster/modules/aegir/hosting_tasks_extra/http_basic_auth/drush [0.01 sec, 2.86 MB]                                                            [notice]
Include /var/aegir/hostmaster-7.x-3.144/profiles/hostmaster/modules/aegir/hosting_tasks_extra/fix_permissions/drush [0.01 sec, 2.86 MB]                                                            [notice]
Include /var/aegir/hostmaster-7.x-3.144/profiles/hostmaster/modules/aegir/hosting_tasks_extra/fix_ownership/drush [0.01 sec, 2.87 MB]                                                              [notice]
Include /var/aegir/hostmaster-7.x-3.144/profiles/hostmaster/modules/aegir/hosting_tasks_extra/drush [0.01 sec, 2.87 MB]                                                                            [notice]
Include /var/aegir/hostmaster-7.x-3.144/profiles/hostmaster/modules/aegir/hosting_site_backup_manager/drush [0.01 sec, 2.87 MB]                                                                    [notice]
Include /var/aegir/hostmaster-7.x-3.144/profiles/hostmaster/modules/aegir/hosting_remote_import/drush [0.01 sec, 2.87 MB]                                                                          [notice]
Cache HIT cid: 8.1.17-dev-commandfiles-0-89e108e056f1078378c8d0877e0d0710 [0.01 sec, 2.93 MB]                                                                                                       [debug]
Loading drushrc "/var/aegir/platforms/drupal-8.4.4-staging/sites/all/drush/drushrc.php" into "drupal" scope. [0.04 sec, 6.14 MB]                                                                [bootstrap]
Bootstrap to phase 0. [0.12 sec, 10.92 MB]                                                                                                                                                      [bootstrap]
Bootstrap to phase 0. [0.12 sec, 10.93 MB]                                                                                                                                                      [bootstrap]
Found command: registry-rebuild (commandfile=registry_rebuild) [0.12 sec, 10.93 MB]                                                                                                             [bootstrap]
Loaded alias @server_master from file /var/aegir/.drush/server_master.alias.drushrc.php [0.14 sec, 10.99 MB]                                                                                       [notice]
Loading apache driver for the http service [0.14 sec, 11.08 MB]                                                                                                                                    [notice]
Calling hook drush_registry_rebuild [0.15 sec, 11.41 MB]                                                                                                                                            [debug]
Bootstrap to phase 4. [0.15 sec, 11.41 MB]                                                                                                                                                      [bootstrap]
Drush bootstrap phase : bootstrap_drupal_root() [0.15 sec, 11.98 MB]                                                                                                                            [bootstrap]
Loading drushrc "/var/aegir/platforms/drupal-8.4.4-staging/sites/all/drush/drushrc.php" into "drupal" scope. [0.15 sec, 11.99 MB]                                                               [bootstrap]
Initialized Drupal 8.4.4 root directory at /var/aegir/platforms/drupal-8.4.4-staging [0.16 sec, 11.99 MB]                                                                                       [bootstrap]
Find command files for phase 1 (max=4) [0.16 sec, 9.24 MB]                                                                                                                                          [debug]
Cache HIT cid: 8.1.17-dev-commandfiles-1-88345322626fe4254094b893cfd5846e [0.16 sec, 9.25 MB]                                                                                                       [debug]
Cache HIT cid: 8.1.17-dev-annotationfiles-1-07190c11fa2acabad3c4805ba4771846 [0.16 sec, 9.33 MB]                                                                                                    [debug]
Drush bootstrap phase : bootstrap_drupal_site() [0.17 sec, 10.16 MB]                                                                                                                            [bootstrap]
Loading drushrc "/var/aegir/platforms/drupal-8.4.4-staging/sites/staging.andydev8.internal.admin.cam.ac.uk/drushrc.php" into "site" scope. [0.17 sec, 10.16 MB]                                 [bootstrap]
Initialized Drupal site staging.andydev8.internal.admin.cam.ac.uk at sites/staging.andydev8.internal.admin.cam.ac.uk [0.22 sec, 13.41 MB]                                                       [bootstrap]
Find command files for phase 2 (max=4) [0.23 sec, 10.51 MB]                                                                                                                                         [debug]
Cache HIT cid: 8.1.17-dev-install_profile-60c747bfdc14cdc330ea9d8a6124de78 [0.23 sec, 10.52 MB]                                                                                                     [debug]
Cache MISS cid: 8.1.17-dev-commandfiles-2-f4034f9781ca6975fd1dc0e8e667ab21 [0.23 sec, 10.53 MB]                                                                                                     [debug]
Cache SET cid: 8.1.17-dev-commandfiles-2-f4034f9781ca6975fd1dc0e8e667ab21 [0.23 sec, 10.54 MB]                                                                                                      [debug]
Drush bootstrap phase : bootstrap_drupal_configuration() [0.23 sec, 10.53 MB]                                                                                                                   [bootstrap]
Create from request [0.23 sec, 10.57 MB]                                                                                                                                                            [debug]
add service modifier [0.23 sec, 10.9 MB]                                                                                                                                                            [debug]
Find command files for phase 3 (max=4) [0.23 sec, 10.9 MB]                                                                                                                                          [debug]
sql-query: SELECT 1; [0.24 sec, 11.02 MB]                                                                                                                                                          [notice]
Executing: mysql --defaults-extra-file=/tmp/drush_VXDeZp --database=stagingandydev8i --host=drupal-uas1-dev1.internal.admin.cam.ac.uk --port=3306 --silent  < /tmp/drush_oplyXT
sql-query: SHOW TABLES; [0.26 sec, 11.02 MB]                                                                                                                                                       [notice]
Executing: mysql --defaults-extra-file=/tmp/drush_VCw2as --database=stagingandydev8i --host=drupal-uas1-dev1.internal.admin.cam.ac.uk --port=3306 --silent  < /tmp/drush_Dza84V

<<List of all the tables removed for brevity>>

Drush bootstrap phase : bootstrap_drupal_database() [0.28 sec, 11.04 MB]                                                                                                                        [bootstrap]
Successfully connected to the Drupal database. [0.28 sec, 11.04 MB]                                                                                                                             [bootstrap]
Find command files for phase 4 (max=4) [0.28 sec, 11.04 MB]                                                                                                                                         [debug]
This DRUSH_MAJOR_VERSION is: 8 [0.29 sec, 12.15 MB]                                                                                                                                                [notice]
Internal Drush cache cleared with drush_cache_clear_drush (1). [0.29 sec, 12.15 MB]                                                                                                                [notice]

Fatal error: Call to undefined function cache() in /var/aegir/.drush/registry_rebuild/registry_rebuild.drush.inc on line 159
Drush command terminated abnormally due to an unrecoverable error.                                                                                                                              [error]
Error: Call to undefined function cache() in /var/aegir/.drush/registry_rebuild/registry_rebuild.drush.inc, line 159 [0.29 sec, 12.15 MB]

I believe this is a clean install of Aegir, drush and registry_rebuild.

  • Where did you find Registry Rebuild 8.1.17-dev? it's not on drupal.org/project/registry_rebuild Mar 1, 2018 at 15:53
  • @HermanvanRink I used composer global require drush/drush:8.x-dev
    – A. Batey
    Mar 2, 2018 at 8:39
  • @HermanvanRink that was meant to be Drush 8.1.17-dev - just realised my error. Apologies.
    – A. Batey
    Mar 7, 2018 at 10:16
  • You could try removing registry_rebuild all together... it should not be needed for D8. Any idea from which part of the clone process triggers registry rebuild? Core aegir does not call it. Mar 8, 2018 at 15:42

1 Answer 1


Thank you to @HermanvanRink for the pointer to the solution to my question.

We do have a "Rebuild Registry" task on each site page from Hosting Tasks Extra but that is not required for Drupal 8 and will not work as installed.

The actual issue here was that my predecessor had implemented the fix from #4 on https://www.drupal.org/project/provision/issues/1694792 in local drush additions so that registry_rebuild was being called for every clone/migrate.

Added a test to avoid doing that for D8 and all is now well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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