Bug 19547 - Maria DB doesn't have a debian.cnf
Summary: Maria DB doesn't have a debian.cnf
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Database (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Mark Tompsett
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-30 18:27 UTC by Mark Tompsett
Modified: 2019-10-14 19:56 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 19547: MariaDB install has no debian.cnf (809 bytes, patch)
2017-10-30 22:01 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 19547: Deal with --create-db missing debian.cnf issue (1.11 KB, patch)
2017-10-31 02:29 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 19547: Deal with --create-db missing debian.cnf issue (1.33 KB, patch)
2018-02-28 01:55 UTC, Dilan Johnpullé
Details | Diff | Splinter Review
Bug 19547: MariaDB install has no debian.cnf (907 bytes, patch)
2018-03-02 08:03 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 19547: Deal with --create-db missing debian.cnf issue (1.42 KB, patch)
2018-03-02 08:03 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Tompsett 2017-10-30 18:27:38 UTC
This means if you install Debian with no root password set (so sudo is installed by default), and then you start to following the typical installation instructions (https://wiki.koha-community.org/wiki/Koha_on_ubuntu_-_packages), when you get to the point where you want to koha-create you get something like this:
$ sudo koha-create --create-db library
awk: cannot open /etc/mysql/koha-common.cnf (No such file or directory)
Comment 1 Mark Tompsett 2017-10-30 22:01:09 UTC
Created attachment 68850 [details] [review]
Bug 19547: MariaDB install has no debian.cnf

This attempts to handle issues arising when running
koha-create on a system that never had MySQL installed.
Comment 2 Mark Tompsett 2017-10-31 00:29:17 UTC
Further thought makes me think we should be generating our koha-common.cnf file if there is no debian.cnf, rather than soft-link. MariaDB generates a dummy debian.cnf with root user and blank password when I ran 'sudo dpkg-reconfigure mariadb-server'. This patch may work for koha-create options other than --create-db, but I have yet to test further after these results thus far.
Comment 3 Mark Tompsett 2017-10-31 02:29:46 UTC
Created attachment 68851 [details] [review]
Bug 19547: Deal with --create-db missing debian.cnf issue
Comment 4 Mark Tompsett 2017-10-31 14:56:32 UTC
TEST PLAN
-----------
1) Fresh KohaDevBox to be thrown away later.
2) login vagrant/vagrant or vagrant ssh
3) sudo -i
4) cd /etc/mysql
5) mv debian.cnf broken_debian.cnf
   -- this makes sure the link is broken
      (as is the case in long hard old school koha installs with MariaDB)
6) exit
7) cd ~/kohaclone
8) git checkout master
9) git pull
10) git checkout -b bug_19547 origin/master
11) git checkout master
12) perl ~/misc4dev/cp_debian_files.pl
13) sudo koha-create --create-db testmaster1
    -- nasty error
14) sudo koha-create --request-db testmaster2
    -- nasty error
14) git checkout bug_19547
15) perl ~/misc4dev/cp_debian_files.pl
16) sudo koha-create --create-db testfix1
    -- should work
17) sudo koha-create --request-db testfix2
    -- should work

-- Sadly, testmaster1 and testmaster2 may require manual steps to remove. That is why I wrote "to be thrown away later."
Comment 5 Mark Tompsett 2017-10-31 16:54:14 UTC
This problem does exist if you manually install yourself. You will have to do the move, because the problem does not exist on the kohadevbox, and I don't know why a fresh git install manually done following the wiki instructions using mariadb-server and mariadb-client does not have a debian.cnf file.
Comment 6 Mark Tompsett 2017-11-06 15:45:41 UTC
(In reply to M. Tompsett from comment #4)
> TEST PLAN
> -----------
...
> 10) git checkout -b bug_19547 origin/master
-- 10.5 git bz apply 19547
> 11) git checkout master

Oops... forgot the obvious line.
Comment 7 Dilan Johnpullé 2018-02-28 01:55:27 UTC
Created attachment 72283 [details] [review]
Bug 19547: Deal with --create-db missing debian.cnf issue

Followed test plan. Patch functions as described and both commands execute.
Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>
Comment 8 Marcel de Rooy 2018-03-02 08:03:15 UTC
Created attachment 72345 [details] [review]
Bug 19547: MariaDB install has no debian.cnf

This attempts to handle issues arising when running
koha-create on a system that never had MySQL installed.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 9 Marcel de Rooy 2018-03-02 08:03:20 UTC
Created attachment 72346 [details] [review]
Bug 19547: Deal with --create-db missing debian.cnf issue

Followed test plan. Patch functions as described and both commands execute.
Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 10 Jonathan Druart 2018-03-19 18:30:47 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 11 Nick Clemens (kidclamp) 2018-04-24 01:32:44 UTC
Awesome work all, backported to stable for 17.11.05
Comment 12 Fridolin Somers 2018-04-24 05:18:09 UTC
Pushed to 17.05.x for 17.05.11