I am using Ubuntu 14.04 . When I try to download, enable, disable any module drush gives the following error:

Additional uncaught exception thrown while handling exception.


Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in Drupal::getContainer() (line 129 of /var/www/html/gitrepo/drupal/core/lib/Drupal.php).

drush_bootstrap(3, 7)


Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in Drupal::getContainer() (line 129 of /var/www/html/gitrepo/drupal/core/lib/Drupal.php).

_drupal_log_error(Array, 1)

Drush command terminated abnormally due to an unrecoverable error. [error]

  • Trying to get more info: Are you accessing drush from the root folder? Does Drush respond to other commands such as drush --version? Can you post the command that produces that output (and give the folder location).
    – Rick
    Mar 3, 2015 at 21:30
  • Any command from anywhere is the drupal folder gives the same result. Mar 4, 2015 at 12:39
  • At this point I'm placing bets on @greg_1_anderson response. D8 moves fast. APIs change. The drush version may be off. I'm going to advise on using a Dev VM that has Drupal 8 installed along with proper dependencies. That greatly reduces the headache of D8 development -- at least right now. Best of luck.
    – Rick
    Mar 4, 2015 at 15:46
  • Just another potential helpful article: Install Drush 7 for Drupal 8 without throwing away Drush 6 x-team.com/2015/02/install-drush-drupal-8
    – Rick
    Mar 5, 2015 at 15:46

3 Answers 3


Sounds like you are not using the right version of Drush. For Drupal 8.0-beta7, you need Drush 7.0.0-alpha9. For Drupal 8.0-beta6, you need Drush 7.0.0-alpha8.

Drupal 8 APIs are changing rapidly; if you have mixed versions, you can easily encounter spurious problems. Tracking HEAD of Drupal 8.0.x and Drush master is another viable strategy.

  • yes, D8 development has made me upgrade drush several times while facing error messages like these. I'm just doing it old school for now not to get too frustrated :) Mar 4, 2015 at 0:20
  • I am having drush version 7.0-dev. Is it right version. If not how can I find which version is suitable for my drupal installation? Mar 4, 2015 at 8:20
  • Drush 7.0-dev is not a version, it is a branch. If you install like darol100 suggests, Drush should work on the day you install it, but you might occasionally need to run git pull from the Drush directory to update to the latest head. To install a specific version of Drush, install via Composer as described in the Drush installation documentation: docs.drush.org/en/master/install Mar 4, 2015 at 22:42
  • Thanks this worked I installed an alpha release for drush and its now working. Mar 5, 2015 at 4:17

For D8 don't you need php 5.4+? Check your version of PHP. I believe Ubuntu 14.x has 5.3 by default but that's just a wild guess.

What do you see when you execute php --version on the commandline?

You may need to upgrade through a back channel upgrade through other PPAs or run Drupal in a Virtual Machine / Vagrant.

  • PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10) Mar 3, 2015 at 21:29
  • Well that qualifies! IF this is just a dev project, you may still want to investigate the vagrant route. This repo is pretty much a fully configured machine to run D6, 7, or 8. github.com/geerlingguy/drupal-dev-vm
    – Rick
    Mar 3, 2015 at 21:32
  • But on the same thing is working with another local installation of drupal on same machine... What can be the reason for this ? Mar 3, 2015 at 23:24

You probably have the wrong version or you installed wrong.

Here are the instruction on how to install Drush on Ubuntu.

# Install Composer
php -r "readfile('https://getcomposer.org/installer');" | php

# Access composer from anywhere on your system:
sudo mv composer.phar /usr/local/bin/composer

# Install Drush
cd /usr/share
sudo git clone --branch master https://github.com/drush-ops/drush.git
cd drush
composer install
cd ~/
# Access drush from anywhere on your system:
ln -s /usr/share/drush/drush /usr/bin/drush

Source: lazydubuntu/bin/basictools.sh

This would make sure that you installed the latest version

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.