Opened 3 years ago

Closed 3 years ago

#18 closed defect (fixed)

Drush

Reported by: chris Owned by: chris
Priority: major Milestone: Maintenance
Component: drupal Version:
Keywords: Cc: gillian, jenny, peter
Estimated Number of Hours: 0 Add Hours to Ticket: 0
Billable?: yes Total Hours: 0.48

Description

Drush doesn't work on Crin2:

su - www-data -s /bin/bash
drush pm-updatestatus
Command pm-updatestatus needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal        [error]
environment to run this command.
The drush command 'pm-updatestatus' could not be executed.                                                                         [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         :  7.24                                  
 Site URI               :  http://crin1.crin.org/                
 Database driver        :  mysql                                 
 Database hostname      :  crin1                                 
 Database port          :                                        
 Database username      :  drupal                                
 Database name          :  drupal                                
 PHP executable         :  /usr/bin/php                          
 PHP configuration      :  /etc/php5/cli/php.ini                 
 PHP OS                 :  Linux                                 
 Drush script           :  /usr/local/src/drush-master/drush.php 
 Drush version          :  7.0-dev                               
 Drush temp directory   :  /tmp                                  
 Drush configuration    :  /var/www/.drush/drushrc.php           
 Drush alias files      :                                        
 Drupal root            :  /var/www/drupal                       
 Site path              :  sites/default                         

Change History (4)

comment:1 Changed 3 years ago by chris

  • Add Hours to Ticket changed from 0 to 0.15
  • Total Hours set to 0.15

Here is the error:

su - www-data -s /bin/bash
/usr/local/bin/drush --root=/var/www/drupal --uri=www.crin.org -dv pm-updatestatus
...
  ERROR 1045 (28000): Access denied for user 'drupal'@'crin2' (using password: YES)
...

And this is a open issue on Github:

So I think the Drupal cron job will need to be set up to use wget rather than drush, see: ticket:6#comment:29

comment:2 follow-up: Changed 3 years ago by chris

  • Add Hours to Ticket changed from 0 to 0.2
  • Total Hours changed from 0.15 to 0.35

Looking at setting up the Drupal cronjob, first get a one time login:

sudo -i
su - www-data -s /bin/bash
cd drupal/
drush uli

Following this documentation it turns out that the site is set to use "poor mans cron" every 3 hours, see the cron config page, so the www-data crontab was commented out.

I'm leaving this ticket open as the web developers might need to have drush available for SQl commands and stunnel or a SSH tunnel was used for the MySQL traffic then drush would fully work.

comment:3 in reply to: ↑ 2 ; follow-up: Changed 3 years ago by chris

  • Add Hours to Ticket changed from 0 to 0.05
  • Cc peter added
  • Total Hours changed from 0.35 to 0.4

Peter has been added to this ticket. See also ticket:27.

Replying to chris:

I'm leaving this ticket open as the web developers might need to have drush available for SQl commands and stunnel or a SSH tunnel was used for the MySQL traffic then drush would fully work

Drush running SQL commands does appear to work as root:

sudo -i
cd /var/www/drupal
drush sqlq "show tables"
  actions
  ...

But not as another user:

sudo -i
su - www-data -s /bin/bash
cd /var/www/drupal
drush sqlq "show tables"
  Query failed.                [error]

Peter -- any better idea than simply doing everything as root (this might not be the worst idea...)?

comment:4 in reply to: ↑ 3 Changed 3 years ago by chris

  • Add Hours to Ticket changed from 0 to 0.08
  • Resolution set to fixed
  • Status changed from new to closed
  • Total Hours changed from 0.4 to 0.48

I have solved this, we simply need to create ~/.my.cnf files for every user that uses MySQl on Crin2 containing:

[client]
host=crin1
ssl-cipher=DHE-RSA-AES256-SHA
ssl-ca=/etc/ssl/cacert/cacert.pem
ssl-cert=/etc/ssl/cacert/crin1_cert.pem
ssl-key=/etc/ssl/cacert/crin1_yassl_privatekey.pem

And then Drush works without a problem:

sudo -i
su - www-data -s /bin/bash
cd /var/www/drupal
drush sqlq "show tables" | less
  actions
  ...

So closing this ticket, I'll also post a comment to the Drush ticket.

Note: See TracTickets for help on using tickets.