Bug 41337

Summary: koha-create --request-db and --populate-db creates log files owned by root (intranet-error.log, opac-error.log)
Product: Koha Reporter: Saiful Amin <saiful>
Component: Installation and upgrade (command-line installer)Assignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: major    
Priority: P1 - high CC: tomascohen
Version: Main   
Hardware: All   
OS: Linux   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Saiful Amin 2025-12-01 14:12:41 UTC
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.