New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some drush commands doesn't work (mysql not found error) #1318

Closed
ezenko opened this Issue Nov 29, 2018 · 12 comments

Comments

Projects
None yet
9 participants
@ezenko
Copy link

ezenko commented Nov 29, 2018

I am using v3.0.0-rc.1 on Ubuntu 18.04
When I try to run lando drush cr - everything works.
But some other commands do not. For example: lando drush cim fails

Setup:

name: project
recipe: pantheon
config:
  framework: drupal8
  site: project
  id: {site-id}
tooling:
  drupal:
    cmd:
      - "/app/vendor/bin/drupal --root=/app/web"
  drush:
    service: appserver
    cmd:
      - "/app/vendor/bin/drush --root=/app/web"
  behat:
    service: appserver
    description: Run behat tests locally.
    cmd:
      - "/app/vendor/bin/behat"

Command log:

lando drush cim -d
PHP Recoverable fatal error:  PHP Startup: Cannot set 'user' save handler by ini_set() or session_module_name() in Unknown on line 0
Using the Drush script found at /app/vendor/drush/drush/drush.launcher using pcntl_exec
PHP Recoverable fatal error:  PHP Startup: Cannot set 'user' save handler by ini_set() or session_module_name() in Unknown on line 0
Cache HIT cid: 8.1.17-commandfiles-0-65996b7c9f4fb66e553c1512b35bcff8    [debug]
[0.01 sec, 5.76 MB]
Bootstrap to phase 0. [0.09 sec, 10.99 MB]                           [bootstrap]
Bootstrap to phase 6. [0.09 sec, 10.99 MB]                           [bootstrap]
Drush bootstrap phase : bootstrap_drupal_root() [0.09 sec, 11.15 MB] [bootstrap]
Initialized Drupal 8.6.3 root directory at /app/web [0.09 sec, 11.15 [bootstrap]
MB]
Find command files for phase 1 (max=6) [0.09 sec, 9.96 MB]               [debug]
Cache HIT cid: 8.1.17-commandfiles-1-1e904505e368faf0a4f707280a3139bc    [debug]
[0.09 sec, 9.96 MB]
Cache HIT cid:                                                           [debug]
8.1.17-annotationfiles-1-d5578b113a0092012feb8c55becbc141 [0.09 sec,
10.15 MB]
Drush bootstrap phase : bootstrap_drupal_site() [0.11 sec, 10.72 MB] [bootstrap]
Initialized Drupal site default at sites/default [0.11 sec, 10.72 MB][bootstrap]
Find command files for phase 2 (max=6) [0.11 sec, 10.72 MB]              [debug]
Drush bootstrap phase : bootstrap_drupal_configuration() [0.11 sec,  [bootstrap]
10.72 MB]
Create from request [0.11 sec, 10.74 MB]                                 [debug]
add service modifier [0.11 sec, 11 MB]                                   [debug]
Find command files for phase 3 (max=6) [0.11 sec, 11 MB]                 [debug]
sql-query: SELECT 1; [0.11 sec, 11.09 MB]                               [notice]
Executing: mysql --defaults-extra-file=/tmp/drush_5fS4T9 --database=pantheon --host=database --port=3306 --silent  < /tmp/drush_cO9Fyi
  sh: 1: mysql: not found
Bootstrap to phase 1. [0.11 sec, 11.09 MB]                           [bootstrap]
Bootstrap to phase 6. [0.16 sec, 12.37 MB]                           [bootstrap]
Bootstrap to phase 5. [0.16 sec, 12.37 MB]                           [bootstrap]
Command config-import needs a higher bootstrap level to run - you        [error]
will need to invoke drush from a more functional Drupal environment
to run this command. [0.16 sec, 12.37 MB]
The drush command 'cim' could not be executed. [0.16 sec, 12.37 MB]      [error]
Drush was not able to start (bootstrap) the Drupal database.             [error]
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See `drush topic docs-aliases` for
details.
 * connect the database through a socket. The socket file may be
wrong or the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.

Drush was attempting to connect to: 
 Drupal version         :  8.6.3                             
 Site URI               :  http://default                    
 Database driver        :  mysql                             
 Database hostname      :  database                          
 Database port          :  3306                              
 Database username      :  pantheon                          
 Database name          :  pantheon                          
 PHP executable         :  /usr/local/bin/php                
 PHP configuration      :                                    
 PHP OS                 :  Linux                             
 Drush script           :  /app/vendor/drush/drush/drush.php 
 Drush version          :  8.1.17                            
 Drush temp directory   :  /tmp                              
 Drush configuration    :                                    
 Drush alias files      :                                    
 Drupal root            :  /app/web                          
 Drupal Settings File   :  sites/default/settings.php        
 Site path              :  sites/default                     
 Sync config path       :  /app/config                       

 [0.18 sec, 12.52 MB]
@ccharlton

This comment has been minimized.

Copy link
Contributor

ccharlton commented Nov 29, 2018

Known issue. It's a problem with Drush at the moment.

@weaver299

This comment has been minimized.

Copy link

weaver299 commented Nov 30, 2018

drush had been working on my d8 lando sites up until yesterday, then it stopped working. one of my lando sites that had been running for a few days still worked, but when i restarted it, it gained the problem as well.

does lando fetch drush during start?

also, is there a link to the drush issue?

edit to add: It's also difficult to understand how drush would cause a "mysql: not found" error.

@weaver299

This comment has been minimized.

Copy link

weaver299 commented Nov 30, 2018

It looks like this is the other issue ticket: #1315

@ccjjmartin

This comment has been minimized.

Copy link
Contributor

ccjjmartin commented Dec 4, 2018

I didn't get a mysql not found error but I also couldn't connect to the database. I installed drush launcher in the container: https://github.com/drush-ops/drush-launcher

And I also installed drush via composer on my site and drush magically started connecting to the database. Hope this unblocks someone, it isn't a permanent fix though.

@cainaru

This comment has been minimized.

Copy link

cainaru commented Dec 4, 2018

@ccjjmartin noob question here, but how did you install the drush launcher in the container?

@ccjjmartin

This comment has been minimized.

Copy link
Contributor

ccjjmartin commented Dec 4, 2018

I was following these instructions: https://github.com/drush-ops/drush-launcher#installation---phar

And came up with:
lando ssh # to get into the container
cd /usr/local/bin/ # to replace the installed version of drush in the next few commands
wget -O drush.phar https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar # Following the linux instructions from the docs
mv drush.phar drush # To actually replace drush
ls -la # To check file permissions

@cainaru

This comment has been minimized.

Copy link

cainaru commented Dec 5, 2018

Not sure if this will help anyone, but I can confirm that @ccjjmartin's steps for installing drush launcher in the container allows me to use site-local drush 8.1.18 in my Drupal 8.6.3 site that uses the Pantheon recipe. No longer getting the sh: 1: ssh: not found error mentioned in #1315, and can use lando pull now too :)

@gremy

This comment has been minimized.

Copy link

gremy commented Dec 12, 2018

I've had the exact problem with a recent problem and I can also confirm that @ccjjmartin's steps have fixed my drush problem.

@ccjjmartin

This comment has been minimized.

Copy link
Contributor

ccjjmartin commented Dec 13, 2018

I can add that on a D8 instance I was working on recently drush 9.x was working fine using the composer installed drush (without drush launcher) but when I switched to drush 8.x I needed to use drush launcher in order to run the composer installed version of drush otherwise the mysql connection wasn't made. The plot thickens.

@purdy

This comment has been minimized.

Copy link

purdy commented Dec 21, 2018

I also had this problem and @ccjjmartin's steps helped me, too.

@krisrobinson

This comment has been minimized.

Copy link

krisrobinson commented Dec 30, 2018

I frustratingly had this problem after installing lando 3.0.0.rc1 - @ccjjmartin's steps helped me too.

@pirog

This comment has been minimized.

Copy link
Member

pirog commented Jan 13, 2019

Closing this as dupe of #1315

@pirog pirog closed this Jan 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment