1

I'm pretty new to Drupal and I'm trying to update a website from 8.0.0 to 8.6.1.

I've followed the guide here: https://www.drupal.org/docs/8/update/update-core-via-composer

The composer part went pretty well. However, when I run the command:

drush updatedb

I get the following error:

Command updatedb needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command.
The drush command 'updatedb' could not be executed.

I've read online that I had to use cc all first, but when I do:

drush cc all

I get the following:

No Drupal site found, only 'drush' cache was cleared.

I thought that I might have to update my Drush version since I was running on 8.1.17 because version 9.x was not supporting Drupal 8.0.0. Therefore, I updated to 9.4.0.

Now when I execute the updatedb command, I get the following:

Bootstrap failed. Run your command with -vvv for more information.

And the stacktrace:

Exception trace:
 Drush\Boot\BootstrapHook->initialize() at /root/.composer/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:34
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook() at /root/.composer/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:27
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize() at /root/.composer/vendor/consolidation/annotated-command/src/CommandProcessor.php:117
 Consolidation\AnnotatedCommand\CommandProcessor->initializeHook() at /root/.composer/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:391
 Consolidation\AnnotatedCommand\AnnotatedCommand->initialize() at /root/.composer/vendor/symfony/console/Command/Command.php:217
 Symfony\Component\Console\Command\Command->run() at /root/.composer/vendor/symfony/console/Application.php:964
 Symfony\Component\Console\Application->doRunCommand() at /root/.composer/vendor/symfony/console/Application.php:248
 Symfony\Component\Console\Application->doRun() at /root/.composer/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /root/.composer/vendor/drush/drush/src/Runtime/Runtime.php:112
 Drush\Runtime\Runtime->doRun() at /root/.composer/vendor/drush/drush/src/Runtime/Runtime.php:41
 Drush\Runtime\Runtime->run() at /root/.composer/vendor/drush/drush/drush.php:66
 require() at /root/.composer/vendor/drush/drush/drush:4

And if I open my drupal website, I'm getting a fatal error:

Fatal error: Class 'Drupal\Component\Utility\String' not found in /home/username/public_html/themes/name/name.theme on line 548

I'm executing all commands from the root of my drupal website. I've also tried to execute it from sites/default/.


Update

I've restored to the version before the update, then performed the following steps in order:

  1. Updated composer.json to "drupal/core": "8.6.1"
  2. Executed the command: composer update drupal/core --with-dependencies
  3. Changed directory into the core/ folder
  4. Executed the command: composer install in the subdirectory
  5. Opened domain.com/update.php.

If I don't perform step 3 & 4, I get an error when trying to load my website saying that it cannot load the file core/vendor/autoload.php.

Then I'm still getting the same fatal error as mentioned above.

composer.json

This is the original composer.json before the update.

{
  "name": "drupal/drupal",
  "description": "Drupal is an open source content management platform powering millions of websites and applications.",
  "type": "project",
  "license": "GPL-2.0+",
  "require": {
    "composer/installers": "^1.0.20",
    "drupal/core": "8.0.0-beta6"
  },
  "minimum-stability": "dev",
  "prefer-stable": true,
  "repositories": [],
  "config": {
    "preferred-install": "dist",
    "autoloader-suffix": "Drupal8"
  },
  "extra": {
    "_readme": [
      "This is an example file to show how a Drupal website can be managed via",
      "Composer. It does not work out of the box but requires a Git subtree",
      "split of the core directory to be added to the repositories",
      "section above."
    ]
  }
}
  • 1
    If you look at your composer.json file, you'll notice that it's a "drupal/drupal" project. Using that is strongly discourage - ref drupal.org/docs/develop/using-composer/… - because updating is so hard. The best solution, if the Composerize Drupal composer plugin doesn't work, is to start over with a new sites based on drupal-composer/drupal-project. – hansfn Sep 11 '18 at 17:23
  • @hansfn How can I update it without restart over? Is there another way to update without proceeding with composer? – Chin Leung Sep 11 '18 at 17:31
  • Composer is the recommended way, but then you have to convert your project like in the answer from Ismail. You should not continue to use Composer and "drupal/drupal". You might of course do a manual update (without calling Composer). That might work out just fine - read drupal.org/docs/8/update/update-core-manually – hansfn Sep 11 '18 at 21:11
  • ´Command updatedb needs a higher bootstrap level to run´. Have you try drush updb from the Drupal webroot or from another parent directory ? You need to be in the Drupal directory ( /public_html, /web or similar). – xaa Sep 11 '18 at 22:48
  • @xaa I executed in the root directory. – Chin Leung Sep 12 '18 at 14:04
0

I tried to replicate the steps you've done.

  1. I installed Drupal v8.0.0
  2. I installed Bootstrap Theme
  3. I installed some modules
  4. I used the composerize-drupal plugin to create a composer.json file

And from now, things started to get nasty. First of all, I ran the command in the plugin README:
composer composerize-drupal --composer-root=. --drupal-root=.
It successfully created a compsoer.json file, however:
- It updated Drupal core to 8.6.1 (without confirmation)
- It didn't add the contributed modules or themes that I've manually installed and enabled through Drupal's admin
So, I tried to run my old friend update.php script, but it broke in the middle, because one of the modules I installed was using obsolete code.
So, I ran composer require drush/drush to install Drush 9 locally, and then I uninstalled it via drush then ran drush updbatedb which went smoothly afterwards.
My point is: This process is very buggy and can lead to disasters.
Many things can go wrong in the middle due to PHP version, current contributed modules version, etc.
My suggestion to you is to restore your installation from backup, create a local copy, and do the whole process again. Also, you can try to run your_site_domain/update.php script on your current installation.

  • Regarding the skipped contributed modules or themes: Were they installed in a contrib subdirectory as the Composerize Drupal plugin requires - ref github.com/grasmash/composerize-drupal – hansfn Sep 11 '18 at 17:19
  • Yes you are right. But I thought it could handle the modules installed via Drupal admin on its own – Ismail Cherri Sep 11 '18 at 17:56
0

For Drush to be able to understand your site it has to be run from a location within the site. So from the root web directory, for example: /home/user123/public_html/

Run Drush commands in the user (/home/user123/)or system (/) root directories will not work.

  • I did execute it in the root directory of the website. (public_html) – Chin Leung Sep 14 '18 at 13:34
  • have you run $ drush status and/or $ drush pmpi the first will give at least basic Drush and server info and if run from within a Drupal install some basic Drupal info will be shown. the second give a good amount of info about the current Drupal install. again if run from with in the Drupal install, else you will get the error "Command pm-projectinfo needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command. [error] The drush command 'pmpi' could not be executed." – LittleCoding Sep 14 '18 at 13:53

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.