Bug 1382988 - Mariadb server fail to start
Summary: Mariadb server fail to start
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: mariadb
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
Assignee: Michal Schorm
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-08 21:52 UTC by vadim
Modified: 2016-12-13 23:10 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-12-13 23:10:32 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description vadim 2016-10-08 21:52:36 UTC
Description of problem:
Mariadb server fail to start after fresh install

Version-Release number of selected component (if applicable):
mariadb-server-10.1.17-1.fc24.x86_64

How reproducible:
Always Reproduceble

Steps to Reproduce:
1. Install Fedora 24
2. Install mariadb-server
3. make "systemctl start mariadb"

Actual results:
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.

Expected results:
The service is started

Additional info:
/usr/lib/systemd/system/mariadb.service has ExecStartPre=/usr/libexec/mysql-prepare-db-dir

/usr/libexec/mysql-prepare-db-dir failed.

How to fix:

--- /usr/libexec/mysql-prepare-db-dir.orig      2016-10-09 00:27:56.258271675 +0300
+++ /usr/libexec/mysql-prepare-db-dir   2016-10-09 00:26:32.261895113 +0300
@@ -20,7 +20,7 @@
 should_initialize ()
 {
     case `ls_check_datadir "$1"` in
-    ""|lost+found) true ;;
+    ""|lost+found|*.err) true ;;
     *) false ;;
     esac
 }

Comment 1 Honza Horak 2016-10-12 13:59:10 UTC
It works in my case on really fresh machine, so your machine was not as clear as mine :) Is it the reason of failing  that there has been some log file from previous run, in the /var/lib/mysql directory?

Comment 2 vadim 2016-10-12 18:18:02 UTC
This error is happens when /var/lib/mysql is empty.

You can look into /usr/libexec/mysql-prepare-db-dir

1. The script creates errorlog at line 59

# Set up the errlogfile with appropriate permissions
touch "$errlogfile"
ret=$?

2. The script calls should_initialize() at line 79

=====
unpatched variant at line 20

should_initialize ()
{
    case `ls_check_datadir "$1"` in
    ""|lost+found) true ;;
    *) false ;;
    esac
}
====

3. should_initialize return false, because error log is created at step 1

4. The script skip lines 80..122 ("Initializing MariaDB database") and jumps to line 124 ("Database MariaDB is probably initialized in $datadir already, nothing is done."). But database is NOT initialized, only error log was created.

My package is mariadb-server-10.1.17-1.fc24.x86_64

Your installation works, because your error log file is placed outside /var/lib/mysql via option log-error=/var/log/mariadb/mariadb.log
 in /etc/my.cnf.d/mariadb-server.cnf

I use config file, based on /usr/share/mariadb/my-innodb-heavy-4G.cnf, without this option.

Comment 3 Fedora Admin XMLRPC Client 2016-11-15 10:32:37 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 4 Michal Schorm 2016-11-16 10:45:36 UTC
You are right.

It is unusual use-case, but it seems, nothing else should be impacted by your patch.

I'll work on moving this patch into Rawhide. It should be released with 10.1.19.2, but I will notice you, when it comes live.

Comment 5 vadim 2016-11-16 19:21:10 UTC
There is /usr/share/mariadb/my-innodb-heavy-4G.cnf in the mariadb package.

Use case:
1. Install
2. Make config from my-innodb-heavy-4G.cnf

I think, that log-error=/var/log/mariadb/mariadb.log option must be added into all config examples  /usr/share/mariadb/*

Comment 6 Tim Flink 2016-11-30 07:38:01 UTC
I'm hitting the same problem in F25 because I'm also using a custom config with the log file in /var/lib/mysql/

Are there plans to get this patch into more than just rawhide or do I need to be fixing my config so that initialization doesn't blow up?

Comment 7 Tim Flink 2016-11-30 08:45:22 UTC
(In reply to Tim Flink from comment #6)
> I'm hitting the same problem in F25 because I'm also using a custom config
> with the log file in /var/lib/mysql/
> 
> Are there plans to get this patch into more than just rawhide or do I need
> to be fixing my config so that initialization doesn't blow up?

Reading that again, it sounds a bit more combative and less productive than I intended. I've already changed my config to move the log files in question.

This took a bit longer to debug than I'd like to admit, though and it'd be nice to see the patch from the description applied to F24 and F25 and/or the example configs changed to move the log file. I also based my config off of an example from a past Fedora and I suspect that there are more of two of us who have.

Comment 8 Michal Schorm 2016-11-30 14:14:33 UTC
I confirm that I plan to get this patch to all Fedora branches that use mariadb-10.1.*

Actually, the suggested patch from [comment 1] is pushed to all - f24, f25, f26, but waiting to build.

I would like to add missing options to all config examples in [comment 5], but it could take some time to find them all and test them.

I can build current f25 branch for you, to have the patch faster, if you are interested.

Comment 9 Michal Schorm 2016-11-30 14:33:52 UTC
I do most of my testing in COPR.
Those builds could be what you are looking for:

https://copr.fedorainfracloud.org/coprs/mschorm/MariaDB-F25/build/482243/
https://copr.fedorainfracloud.org/coprs/mschorm/MariaDB-F24/build/482244/

Those builds should contain patch in [comment 1], but not updated example config files. They are builded directly from content pushed in mariadb branches.

Take a look, this could give me time to release this bugfix as a one.

Comment 11 Michal Schorm 2016-12-13 23:10:32 UTC
Both builds has been successfully pushed to the stable repository.


Note You need to log in before you can comment on or make changes to this bug.