[Bug 41337] New: koha-create --request-db and --populate-db creates log files owned by root (intranet-error.log, opac-error.log)
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Bug ID: 41337 Summary: koha-create --request-db and --populate-db creates log files owned by root (intranet-error.log, opac-error.log) Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: Linux Status: NEW Severity: major Priority: P5 - low Component: Installation and upgrade (command-line installer) Assignee: koha-bugs@lists.koha-community.org Reporter: saiful@semanticconsulting.com QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com When creating a new Koha instance using the two-step workflow (--request-db and --populate-db), some log files under /var/log/koha/<instance>/ end up with incorrect permissions. Specifically, intranet-error.log and opac-error.log are created as root:root instead of <inst>-koha:<inst>-koha. This causes Apache/Plack to fail to start cleanly until the ownership is corrected manually. Steps to Reproduce: 1. Run: koha-create --request-db test 2. Create the DB/user on the remote or local DB host as instructed. 3. Then run: koha-create --populate-db test 4. Check ownership of generated logs: ls -l /var/log/koha/test Actual Result: Two files are owned by root:root: -rw-r--r-- 1 root root 0 intranet-error.log -rw-r--r-- 1 root root 0 opac-error.log All other logs have correct ownership (test-koha:test-koha). Koha will not start smoothly until these two files are manually chowned. Expected Result: All log files under /var/log/koha/<instance>/ should be owned by <instance>-koha:<instance>-koha, identical to a normal koha-create run without the request/populate split. Notes: This only happens when using the two-step creation (--request-db + --populate-db). A normal one-step koha-create with --create-db assigns the correct ownership. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Saiful Amin <saiful@semanticconsulting.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 - low |P1 - high -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |CONFIRMED --- Comment #1 from Andreas Roussos <a.roussos@dataly.gr> --- (In reply to Saiful Amin from comment #0)
[...] Expected Result: All log files under /var/log/koha/<instance>/ should be owned by <instance>-koha:<instance>-koha, identical to a normal koha-create run without the request/populate split. [...] Thank you, Saiful, for the detailed Bug Description and the steps to reproduce.
I can confirm this is still an issue, which relates to this line in the script: https://git.koha-community.org/Koha-community/Koha/src/commit/c58989fc51bf41... 924 chown $username:$username /var/log/koha/$name/*.log At this point in the script the $username variable is empty, so the `chown` command becomes: chown : /var/log/koha/test/*.log The chown(1) man page states: "If only a colon is given, or if the entire operand is empty, neither the owner nor the group is changed." -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|CONFIRMED |ASSIGNED Assignee|koha-bugs@lists.koha-commun |a.roussos@dataly.gr |ity.org | CC| |a.roussos@dataly.gr -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 --- Comment #2 from Andreas Roussos <a.roussos@dataly.gr> --- Created attachment 192809 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=192809&action=edit Bug 41337: Add missing Bash variable to `koha-create` When creating a new Koha instance using the two-step workflow (`koha-create --request-db <instance>`, followed by `koha-create --populate-db <instance>`), some log files under /var/log/koha/<instance>/ end up with incorrect ownership. Specifically, intranet-error.log and opac-error.log are owned by root:root instead of <instance>-koha:<instance>-koha. This patch fixes that. Test plan (tailored for KTD): 1) Before applying this patch, run the following commands inside your KTD Koha container: $ sudo koha-create --request-db test1 $ SQLPASS=`sudo grep password: test1-db-request.txt | cut -c 16-` $ mysql -hdb -uroot -ppassword -e "CREATE DATABASE koha_test1;" $ mysql -hdb -uroot -ppassword -e "GRANT ALL PRIVILEGES ON koha_test1.* TO 'koha_test1'@'%' IDENTIFIED BY '${SQLPASS}';" $ mysql -hdb -uroot -ppassword -e "FLUSH PRIVILEGES;" $ sudo koha-create --populate-db test1 $ ls -l /var/log/koha/test1/ total 8 -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 indexer-error.log -rw-r--r-- 1 test1-koha test1-koha 1278 Feb 9 15:35 indexer-output.log -rw-r--r-- 1 root root 0 Feb 9 15:35 intranet-error.log -rw-r--r-- 1 root root 0 Feb 9 15:35 opac-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 worker-error.log -rw-r--r-- 1 test1-koha test1-koha 1828 Feb 9 15:35 worker-output.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 zebra-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 zebra-output.log Notice the incorrect user/group ownership on two files: `intranet-error.log` and `opac-error.log`. 2) Apply this patch, and remove the `test1` instance along with the database request text file: $ sudo koha-remove test1 $ sudo rm test1-db-request.txt 3) Repeat the commands in Step 1. This time, the output of the last command should resemble the following: total 8 -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 indexer-error.log -rw-r--r-- 1 test1-koha test1-koha 1520 Feb 9 15:42 indexer-output.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 intranet-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 opac-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 worker-error.log -rw-r--r-- 1 test1-koha test1-koha 1828 Feb 9 15:42 worker-output.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 zebra-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 zebra-output.log All files should now have the correct user/group ownership. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=25284 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #192809|0 |1 is obsolete| | --- Comment #3 from Andreas Roussos <a.roussos@dataly.gr> --- Created attachment 192822 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=192822&action=edit Bug 41337: Add missing Bash variable to `koha-create` When creating a new Koha instance using the two-step workflow (`koha-create --request-db <instance>`, followed by `koha-create --populate-db <instance>`), some log files under /var/log/koha/<instance>/ end up with incorrect ownership. Specifically, intranet-error.log and opac-error.log are owned by root:root instead of <instance>-koha:<instance>-koha. This patch fixes that. Test plan (tailored for KTD): 1) Before applying this patch, run the following commands inside your KTD Koha container: $ sudo koha-create --request-db test1 $ SQLPASS=`sudo grep password: test1-db-request.txt | cut -c 16-` $ mysql -hdb -uroot -ppassword -e "CREATE DATABASE koha_test1;" $ mysql -hdb -uroot -ppassword -e "GRANT ALL PRIVILEGES ON koha_test1.* TO 'koha_test1'@'%' IDENTIFIED BY '${SQLPASS}';" $ mysql -hdb -uroot -ppassword -e "FLUSH PRIVILEGES;" $ sudo koha-create --populate-db test1 $ ls -l /var/log/koha/test1/ total 8 -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 indexer-error.log -rw-r--r-- 1 test1-koha test1-koha 1278 Feb 9 15:35 indexer-output.log -rw-r--r-- 1 root root 0 Feb 9 15:35 intranet-error.log -rw-r--r-- 1 root root 0 Feb 9 15:35 opac-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 worker-error.log -rw-r--r-- 1 test1-koha test1-koha 1828 Feb 9 15:35 worker-output.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 zebra-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 zebra-output.log Notice the incorrect user/group ownership on two files: `intranet-error.log` and `opac-error.log`. 2) Apply this patch, remove the `test1` instance along with the database request text file, and copy the modified script to its system-wide location: $ sudo koha-remove test1 $ sudo rm test1-db-request.txt $ sudo cp debian/scripts/koha-create /usr/sbin/koha-create 3) Repeat the commands in Step 1. This time, the output of the last command should resemble the following: total 8 -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 indexer-error.log -rw-r--r-- 1 test1-koha test1-koha 1520 Feb 9 15:42 indexer-output.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 intranet-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 opac-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 worker-error.log -rw-r--r-- 1 test1-koha test1-koha 1828 Feb 9 15:42 worker-output.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 zebra-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 zebra-output.log All files should now have the correct user/group ownership. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Brendan Lawlor <blawlor@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Brendan Lawlor <blawlor@clamsnet.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #192822|0 |1 is obsolete| | --- Comment #4 from Brendan Lawlor <blawlor@clamsnet.org> --- Created attachment 193015 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=193015&action=edit Bug 41337: Add missing Bash variable to `koha-create` When creating a new Koha instance using the two-step workflow (`koha-create --request-db <instance>`, followed by `koha-create --populate-db <instance>`), some log files under /var/log/koha/<instance>/ end up with incorrect ownership. Specifically, intranet-error.log and opac-error.log are owned by root:root instead of <instance>-koha:<instance>-koha. This patch fixes that. Test plan (tailored for KTD): 1) Before applying this patch, run the following commands inside your KTD Koha container: $ sudo koha-create --request-db test1 $ SQLPASS=`sudo grep password: test1-db-request.txt | cut -c 16-` $ mysql -hdb -uroot -ppassword -e "CREATE DATABASE koha_test1;" $ mysql -hdb -uroot -ppassword -e "GRANT ALL PRIVILEGES ON koha_test1.* TO 'koha_test1'@'%' IDENTIFIED BY '${SQLPASS}';" $ mysql -hdb -uroot -ppassword -e "FLUSH PRIVILEGES;" $ sudo koha-create --populate-db test1 $ ls -l /var/log/koha/test1/ total 8 -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 indexer-error.log -rw-r--r-- 1 test1-koha test1-koha 1278 Feb 9 15:35 indexer-output.log -rw-r--r-- 1 root root 0 Feb 9 15:35 intranet-error.log -rw-r--r-- 1 root root 0 Feb 9 15:35 opac-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 worker-error.log -rw-r--r-- 1 test1-koha test1-koha 1828 Feb 9 15:35 worker-output.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 zebra-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 zebra-output.log Notice the incorrect user/group ownership on two files: `intranet-error.log` and `opac-error.log`. 2) Apply this patch, remove the `test1` instance along with the database request text file, and copy the modified script to its system-wide location: $ sudo koha-remove test1 $ sudo rm test1-db-request.txt $ sudo cp debian/scripts/koha-create /usr/sbin/koha-create 3) Repeat the commands in Step 1. This time, the output of the last command should resemble the following: total 8 -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 indexer-error.log -rw-r--r-- 1 test1-koha test1-koha 1520 Feb 9 15:42 indexer-output.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 intranet-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 opac-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 worker-error.log -rw-r--r-- 1 test1-koha test1-koha 1828 Feb 9 15:42 worker-output.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 zebra-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 zebra-output.log All files should now have the correct user/group ownership. Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #193015|0 |1 is obsolete| | --- Comment #5 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 193247 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=193247&action=edit Bug 41337: Add missing Bash variable to `koha-create` When creating a new Koha instance using the two-step workflow (`koha-create --request-db <instance>`, followed by `koha-create --populate-db <instance>`), some log files under /var/log/koha/<instance>/ end up with incorrect ownership. Specifically, intranet-error.log and opac-error.log are owned by root:root instead of <instance>-koha:<instance>-koha. This patch fixes that. Test plan (tailored for KTD): 1) Before applying this patch, run the following commands inside your KTD Koha container: $ sudo koha-create --request-db test1 $ SQLPASS=`sudo grep password: test1-db-request.txt | cut -c 16-` $ mysql -hdb -uroot -ppassword -e "CREATE DATABASE koha_test1;" $ mysql -hdb -uroot -ppassword -e "GRANT ALL PRIVILEGES ON koha_test1.* TO 'koha_test1'@'%' IDENTIFIED BY '${SQLPASS}';" $ mysql -hdb -uroot -ppassword -e "FLUSH PRIVILEGES;" $ sudo koha-create --populate-db test1 $ ls -l /var/log/koha/test1/ total 8 -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 indexer-error.log -rw-r--r-- 1 test1-koha test1-koha 1278 Feb 9 15:35 indexer-output.log -rw-r--r-- 1 root root 0 Feb 9 15:35 intranet-error.log -rw-r--r-- 1 root root 0 Feb 9 15:35 opac-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 worker-error.log -rw-r--r-- 1 test1-koha test1-koha 1828 Feb 9 15:35 worker-output.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 zebra-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:35 zebra-output.log Notice the incorrect user/group ownership on two files: `intranet-error.log` and `opac-error.log`. 2) Apply this patch, remove the `test1` instance along with the database request text file, and copy the modified script to its system-wide location: $ sudo koha-remove test1 $ sudo rm test1-db-request.txt $ sudo cp debian/scripts/koha-create /usr/sbin/koha-create 3) Repeat the commands in Step 1. This time, the output of the last command should resemble the following: total 8 -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 indexer-error.log -rw-r--r-- 1 test1-koha test1-koha 1520 Feb 9 15:42 indexer-output.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 intranet-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 opac-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 worker-error.log -rw-r--r-- 1 test1-koha test1-koha 1828 Feb 9 15:42 worker-output.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 zebra-error.log -rw-r--r-- 1 test1-koha test1-koha 0 Feb 9 15:42 zebra-output.log All files should now have the correct user/group ownership. Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> Signed-off-by: Jan Kissig <bibliothek@th-wildau.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |bibliothek@th-wildau.de |y.org | CC| |bibliothek@th-wildau.de -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Andreas Roussos <a.roussos@dataly.gr> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This fixes the UNIX release notes| |user/group ownership of the | |log files | |`intranet-error.log` and | |`opac-error.log` inside | |`/var/log/koha/<instance>/` | |. | |Previously, running | |`koha-create --request-db` | |followed by `koha-create | |--populate-db` would result | |in the two log files being | |owned by root/root. | |The correct ownership is | |now applied, meaning the | |log files will be owned by | |the | |<instance>-koha/<instance>- | |koha UNIX user/group. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.05.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 --- Comment #6 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 26.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 Jacob O'Mara <jacob.omara@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|26.05.00 |26.05.00,25.11.04 released in| | Status|Pushed to main |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41337 --- Comment #7 from Jacob O'Mara <jacob.omara@openfifth.co.uk> --- Thanks all, pushed to 25.11.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org