Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 442996

Summary: media-tv/mythtv - logging to a file in /etc/conf.d/mythbackend fails because of hard-wired /etc/init.d/mythbackend settings
Product: Gentoo Linux Reporter: Wilson M. Michaels <thebitpit>
Component: Current packagesAssignee: MythTV Maintainers <mythtv+disabled>
Status: RESOLVED FIXED    
Severity: normal CC: henson, olav
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Wilson M. Michaels 2012-11-13 17:58:35 UTC
When syslog is enabled by adding an option in /etc/conf.d/mythbackend:

MYTHBACKEND_OPTS="--syslog local7"

file logging to /var/log/mythtv is still set up by the backend.

Reproducible: Always

Steps to Reproduce:
1. Add line to /etc/conf.d/mythbackend:
MYTHBACKEND_OPTS="--syslog local7"
2. Restart mythbackend as root
# /etc/init.d/mythbackend restart

Actual Results:  
Look at the system log file and see that both syslog and file logging are set up.

Expected Results:  
Only start syslog logging.

I fixed it with a small change the /etc/init.d/mythbackend:

--- mythbackend 2012-11-13 11:42:58.452881037 -0600
+++ mythbackend.modified        2012-11-13 10:39:31.081983948 -0600
@@ -18,13 +18,15 @@
 start() {
        [ -z "${MYTHBACKEND_VERBOSE}" ] && \
                MYTHBACKEND_VERBOSE="general"
+       [ -z "${MYTHBACKEND_OPTS}" ] && \
+               MYTHBACKEND_OPTS="--logpath /var/log/mythtv/ " && \
+               chown -R mythtv:video /var/log/mythtv/
 
        #fixes for bug #101308
        unset DISPLAY
        unset SESSION_MANAGER
 
        # Work around any strange permissions that may be on these files.
-       chown -R mythtv:video /var/log/mythtv/
        chown -R mythtv:video /home/mythtv/
 
        ebegin "Starting MythTV Backend"
@@ -32,7 +34,6 @@
                 --pidfile /var/run/mythbackend.pid -- \
                --daemon --pidfile /var/run/mythbackend.pid --user mythtv \
                --verbose ${MYTHBACKEND_VERBOSE} \
-               --logpath /var/log/mythtv/ \
                ${MYTHBACKEND_OPTS}
        eend $?
 }

------------------------

An alternative fix is to move the line:
 "--logpath /var/log/mythtv/ "
from /etc/init.d/mythbackend to /etc/conf.d/mythbackend as MYTHBACKEND_OPTS string.
Comment 1 Richard Freeman gentoo-dev 2014-03-08 02:31:10 UTC
*** Bug 498420 has been marked as a duplicate of this bug. ***
Comment 2 Paul B. Henson 2014-07-19 05:25:58 UTC
I see there's been some activity on new mythtv ebuilds; any possibility on following up on this bug and making the logging configuration set in the conf file rather than the init script? That seems like a pretty simple change and keeps people who want to do syslog logging from having to overwrite the init script. Ideally it could also conditionalize the chown of /var/log/mythtv on whether or not file logging is enabled, as you don't really want to do that with syslog logging.

Thanks...
Comment 3 Richard Freeman gentoo-dev 2014-07-19 12:35:45 UTC
I'll see if I can get this to work.  The trick will be making the corresponding changes to the systemd unit, but I can just stick the logging option in a variable and pass it either way.  Conditionally fixing file permissions conditionally might be trickier, since there is no script running for systemd unless we create and execute one.  I'm not sure if mythbackend supports logging to the console but that would also be a logical option for systemd users.

If I get it all working I'll post new scripts for you to test - I don't actually have any systems running openrc and mythbackend at this point, but the changes will be along the lines of the patch you proposed.  I'm away for a week so it might be a bit before I get to this.
Comment 4 Paul B. Henson 2014-12-04 20:04:22 UTC
Hmm, I don't seem to be reliably getting bugzilla email updates :(, I didn't realize you'd updated this ticket 6 months ago 8-/.

mythbackend will log to stdout if not daemonized; I see your current unit file has:

# Systemd sends stdout to syslog, and mythbackend has console logging enabled without --daemon.
# Send stdout to /dev/null so console logging doesn't go to syslog
StandardOutput=null
# Default setting for Type=simple.
ExecStart=/usr/bin/mythbackend --logpath /var/log/mythtv --loglevel crit

So it looks like you're already doing that, but dumping the console logs and still logging to a file...

I don't really care what the default is, it would just be nice to be able to configure a different setting without having to munge the init script :).

Thanks...

So you're one of those systemd users, eh ;)?
Comment 5 Paul B. Henson 2015-08-07 23:34:44 UTC
Any further thoughts on this? Maybe at least moving the logpath option from the init script to the conf.d file so users can override it?

Thanks...
Comment 6 Doug Goldstein (RETIRED) gentoo-dev 2015-09-05 03:21:39 UTC
I apologize for the delay in resolving this issue. The next bump I'll do to MythTV will include the following in /etc/conf.d/mythbackend.

# Configures where mythbackend logs
# Valid values:
# * files           - logs each individual daemon in /var/log/mythtv (default)
# * database        - logs into the database
# * syslog FACILITY - logs to syslog using FACILITY (see syslog(3))
#MYTHBACKEND_LOGGING="files"
Comment 7 Richard Freeman gentoo-dev 2015-09-05 12:17:26 UTC
(In reply to Doug Goldstein from comment #6)
> I apologize for the delay in resolving this issue. The next bump I'll do to
> MythTV will include the following in /etc/conf.d/mythbackend.
> 
> # Configures where mythbackend logs
> # Valid values:
> # * files           - logs each individual daemon in /var/log/mythtv
> (default)
> # * database        - logs into the database
> # * syslog FACILITY - logs to syslog using FACILITY (see syslog(3))
> #MYTHBACKEND_LOGGING="files"

If you change anything at build-time to accomplish this please coordinate on testing of the systemd units.  As I recall the mythtv logging design is somewhat odd in its behavior.

Obviously if you only end up touching the init.d scripts there shouldn't be any conflict with systemd at all.  Happy to work with you either way.

Long-term upstream is removing the mythlogserver component so these configurations should tend to converge.
Comment 8 Doug Goldstein (RETIRED) gentoo-dev 2015-09-16 17:53:35 UTC
Thanks for the report. Fixed in http://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ada29b52010e465a522fdc68d4eee0da6eaa349