I just installed the Aegir system on an Ubuntu server and have serveral sites up on different platforms. I did import some existing sites per these instructions. The sites work though I did have some issues with imagecache. The sites verified but when I try to do a backup of these imported sites from Aegir I see the following errors.

Could not generate database backup from mysqldump
An error occurred at function : drush_provision_mysql_pre_provision_backup
Deleted mysql dump from sites directory
An error occurred at function : drush_hosting_hosting_task

The imported sites were already on the same server and I did not create new databases. I used the exsiting ones. Not sure if there is an issue with the databases, drush, or what. I just installed Aegir last night so I am a newbie with it.

Comments

Anonymous’s picture

Hi there,

Is this issue limited to just sites that have been imported? i.e, do newly-created sites have successful Backup tasks, or do they all fail? This may help us identify if it's a) a general system problem executing the mysqldump (we do do some funky stuff with file descriptors to hide the password from being displayed)), or whether it's specific to the import process + backup.

Thanks!

kepford’s picture

It is only happening on the imported sites. The clean sites built from Aegir such as Atrium and Managing News backup perfectly.

kepford’s picture

I think I have found the problem. Not sure if this is the proper solution but here is what I did.

I typically set up a new database user for each site. In the case of these imported sites the users were already in place but the backups weren't working. I changed the user to my aegir mysql user in the drushrc.php files and the sites backup properly now. I noticed that when I looked at some sites that were built from the Aegir gui they have a database user such as site_328 and a database like site_328.

Is using the mysql user aegir bad practice? Thanks

Anonymous’s picture

It shouldn't have to be the aegir mysql user: what I think is happening here is that somehow the existing user you have, doesn't have the right GRANT permissions to do a mysqldump? But that's strange, so I didn't bring it up.

You could try and manually do a mysqldump of an imported site using the 'real' database user/pass per the settings.php, from the commandline, and see if there is a more helpful error given to you (if any) ?

Anonymous’s picture

Status: Active » Fixed

I believe the issue here was solved over IRC and was traced to the existing db user's insufficient GRANT privileges. Hence why it only affected existing sites and not new sites provisioned by aegir. Closing

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jacobson’s picture

For future reference, mig5's post #5 is the problem I ran into also. The privileges recommended by the Drupal installation documentation for the database user do not include the ability to perform a database dump. So you need to give that user sufficient privileges to do a DB dump before you try a migrate, for example, which attempts a backup.

Carl Johan’s picture

..and for future reference: mysql passwords containing funky characters (including but not limited to dollar signs, question marks, etc) do not play well with bash and seems to have been the cause of my problems as described in #1

solved by setting a new grant in mysql + updating the settings.php and drushrc.php files.

tema’s picture

Status: Closed (fixed) » Active

Reopen it. Have same problem with fresh installed Aegir and created site:

~$ drush @sandbox provision-backup --debug
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.08 sec, 5.12 MB]                            [bootstrap]
Loading drushrc "/var/aegir/drupal-7.0/drushrc.php" into "drupal" scope. [0.08 sec, 5.13 MB]          [bootstrap]
Initialized Drupal 7.0 root directory at /var/aegir/drupal-7.0 [0.1 sec, 6.44 MB]                        [notice]
Found command: provision-backup (commandfile=provision) [0.11 sec, 6.43 MB]                           [bootstrap]
Initializing drush commandfile: drush_make [0.11 sec, 6.44 MB]                                        [bootstrap]
Initializing drush commandfile: drush_make_d_o [0.11 sec, 6.44 MB]                                    [bootstrap]
Initializing drush commandfile: provision [0.11 sec, 6.44 MB]                                         [bootstrap]
Load alias @server_localhost [0.11 sec, 6.45 MB]                                                         [notice]
Load alias @server_master [0.12 sec, 6.46 MB]                                                            [notice]
Loading apache_ssl driver for the http service [0.12 sec, 6.47 MB]                                       [notice]
Loading mysql driver for the db service [0.12 sec, 6.51 MB]                                              [notice]
Load alias @platform_70 [0.12 sec, 6.52 MB]                                                              [notice]
Including /var/aegir/.drush/provision/db/backup.provision.inc [0.13 sec, 6.53 MB]                     [bootstrap]
Including /var/aegir/.drush/provision/platform/backup.provision.inc [0.13 sec, 6.53 MB]               [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.13 sec, 6.57 MB]                            [bootstrap]
Initialized Drupal site sandbox at sites/sandbox [0.13 sec, 6.57 MB]                                     [notice]
Loading drushrc "/var/aegir/drupal-7.0/sites/sandbox/drushrc.php" into "site" scope. [0.13 sec, 6.57  [bootstrap]
MB]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.13 sec, 6.57 MB]                   [bootstrap]
Could not generate database backup from mysqldump. (error: <em class="placeholder">Could not open     [error]
required defaults file: /dev/fd/3
Fatal error in defaults handling. Program aborted
mysqldump: Got error: 1045: Access denied for user &#039;aegir&#039;@&#039;localhost&#039; (using
password: NO) when trying to connect
</em>) [0.14 sec, 6.63 MB]
An error occurred at function : drush_db_pre_provision_backup [0.14 sec, 6.63 MB]                     [error]
Deleted mysql dump from sites directory [0.15 sec, 6.63 MB]                                             [message]
Changes for drush_db_pre_provision_backup module have been rolled back. [0.15 sec, 6.64 MB]            [rollback]
Command dispatch complete [0.15 sec, 6.62 MB]                                                            [notice]
 Timer  Cum (sec)  Count  Avg (msec) 
 page   0.017      1      16.69      

Peak memory usage was 7.03 MB [0.15 sec, 6.62 MB]                                                        [memory]

It's strange: using password: NO, not so?

tema’s picture

After some digging I suppose that my problem is here: Could not open required defaults file: /dev/fd/3. Looks like it's already used or not writable. I'm running Debian Squeeze on VPS.

tema’s picture

Solved. It's known virtual guest problem: http://superuser.com/questions/109913/debian-lenny-expects-udev-on-a-vps..., so here's wrong place for my issue.

A workaround is sudo ln -s /proc/self/fd /dev/fd and corresponding script at /etc/init.d but the question remains: is the best practice to transmit passwords through /dev/fd/3 when it's absent on virtual hosting environment?

tema’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

gaëlg’s picture

Status: Closed (fixed) » Active

Thanks tema. Can you be more precise ? What do you mean by "corresponding script at /etc/init.d" ? Did this workaround work well ? I face the same problem when triying to backup or migrate sites.

Anonymous’s picture

Just because it's absent on your VPS doesn't mean you can't just install it (#11)

apt-get install udev

gaëlg’s picture

Status: Active » Closed (fixed)

Thanks. Got this after install : udev requires hotplug support, not started. I'm on Debian Squeeze. So I'm now trying to install and start hotplug. Shouldn't udev be mentioned in the requirements ?

tema’s picture

@GaëlG: My "corresponding script" is /etc/init.d/fd-workaround.sh:

#! /bin/sh
# http: //superuser.com/questions/109913/debian-lenny-expects-udev-on-a-vps-that-doesnt-support-it

ln -s /proc/self/fd /dev/fd
gaëlg’s picture

Thanks. Actually my sysadmin came back and I asked him for help. We added some packages to make udev work on openvz virtual machines. It works like a charm now :)

rowbotony’s picture

Hi, I had this problem with newly imported sites as well, this thread was the top result on Google in searching for "Could not generate database backup from mysqldump". My problem was with the site directory file permissions - I needed to chmod u+w sites/my-imported-site-that-is-misbehaving, then the backup worked fine and Aegir could dump the sql to the site's home directory.

--Tony