Nicholas Barnes's picture

Hi,

I've done a Turnkey/Core install and then put MySQL on it.

The MySQL database isn't being backed up through tklbam-backup even though it's configured to run database backups. I can only assume that this is a permissions issue.

I've gone through the docs and there is no mention anywhere (at least, anywhere I can see) that mentions how MySQL authentication is managed and configured.

So, how do I configure tklbam-backup to backup my MySQL instance?

Cheers,

Nicholas.

Forum: 
Nicholas Barnes's picture

I have double-checked and unix socket authentication is enabled and working, so I'm not sure it is authentication after all.

There is no mention of mysql being backed up or any errors in the log tklbam-backup generates.

I'm stumped.

Nicholas Barnes's picture

Gone through the log with a fine toothed comb and there's no mention of a database backup (no mysqldump and no mention of /var/lib/mysql).

So, I'm guessing that somehow, somewhere I need to tell tklbam that we have a database, that it's MySQL/Mariadb and that we should back it up.

Any ideas?

Nicholas Barnes's picture

Found it.

OTRS creates

/etc/mysql/mariadb.conf.d/50-znuny_config.cnf

which contains

[client]
max_allowed_packet = 256M

[mysqld]
innodb_file_per_table
innodb_log_file_size = 256M
max_allowed_packet = 256M

Unfortunately, mysqladmin (which is used by tklbam-backup to check whether MySQL is running) doesn't think 'max_allowed_packet' is permitted under [client] and then refuses to run as a result. This then makes tklbam-backup think that MySQL isn't running. If it's not running, it skips backing it up.

Solving this was as simple as commenting out the line under [client].

Phew!

Jeremy Davis's picture

It sounds like you went the "install Znuny on Core" route as per your other thread. And it sounds like you have it up and running. Great work!

Bonus points for reporting the issues that you hit with TKLBAM and extra bonus points for working out the problem (sounds like a bug in mysqladmin).

I've opened an issue regarding this and hopefully we'll be able to at least ensure that TKLBAM gives an error message that makes the issue obvious and clear to the user (at least so they are aware of it and can report it). Although obviously a workaround would be better. It's been a while since I've touched the TKLBAM code, but if it's as you say that it's only using mysqladmin to check that MySQL/MariaDB is running - then a workaround should be really easy.

Thanks again for all your work and sharing every step. I really appreciate all the info you've provided. It really supports us to make TurnKey better!

Jeremy Davis's picture

I hit the same issue as you (but in a slightly different context). So I dug in and did some research. It turns out that it's a bug in the Znuny docs. 'max_allowed_packet' is not a valid option for all clients - only the 'mysql' client itself.

TL;DR the fix is to change the section that the 'max_allowed_packet = 256M' line is in. Change the section name from '[client]' to '[mysql]'. I.e. so the top of the '/etc/mysql/mariadb.conf.d/50-znuny_config.cnf' config file looks like this:

[mysql]
max_allowed_packet = 256M

Then both the 'mysql' and 'mysqladmin' commands will work as expected! :)

Nicholas Barnes's picture

Yes, I thought I'd have a play with installing Znuny on core. I take your previous point about LAMP being a better starting place, but I'd just had fun trying (and failing) to install ISPConfig on Turnkey/LAMP and thought if I started with as few already installed packages I would have a better chance of the installation working!

I started with Znuny 6.0.48 LTS which installed from source on Turnkey/Core flawlessly and then followed the Znuny upgrade path to 6.5 - again, all worked flawlessly.

The "max_allowed_packet = 256M" line mysqladmin saw as an error took me a while. As far as I can tell, it's a valid parameter in the [client] section and MySQL/Maria starts and runs with no objection. As you say, it would be very useful if tklbam-backup logged a message along the lines of "mysqladmin reports MySQL/Maria is not running, database not backed up" - it would have saved some time tracing the problem (although the real culprit here is mysqladmin and not tklbam-backup!).

Thank you for all the work you've put into Turnkey - I'm a newish convert (thanks to the templates I found in Proxmox). It's certainly making our move from co-lo to cloud much easier!

Nicholas.

Jeremy Davis's picture

Thanks for your kind words Nicholas. I'm glad to hear that TurnKey is providing some value for you.

Jeremy Davis's picture

As I just posted above, 'max_allowed_packet = 256M' is not a valid option for the '[client]' section. It should go in a '[mysql]' section.

Add new comment