[mythtv-users] Logging doesn't work

Bill Meek keemllib at gmail.com
Sun Sep 17 16:52:29 UTC 2017


On 09/17/2017 11:31 AM, Enno Middelberg wrote:
> 2017-09-17 15:17 GMT+02:00 Bill Meek <keemllib at gmail.com>:
>> You may be looking in the wrong place (logging works great
>> as you saw from the command line test.)
>>
>> I'd try this: $ systemctl cat mythtv-backend
>>
>> And expect to see a line similar to:
>>
>>      # /etc/systemd/system/mythtv-backend.service
>>
>> I believe if a .service file exists, then it will be preferred
>> to an entry in /etc/init.d (it does for me.)
>>
>> Also, try: $ systemctl status mythtv-backend
>> to verify where your service is being loaded,
>> e.g.:
> 
> Everything seems to point to /etc/init.d/mythtv-backend:
> 
> root at medienpc:/etc/init.d# systemctl cat mythtv-backend
> # /run/systemd/generator.late/mythtv-backend.service
> # Automatically generated by systemd-sysv-generator
> 
> [Unit]
> Documentation=man:systemd-sysv-generator(8)
> SourcePath=/etc/init.d/mythtv-backend
> Description=LSB: Start/Stop the MythTV server.
> Before=multi-user.target
> Before=multi-user.target
> Before=multi-user.target
> Before=graphical.target
> After=remote-fs.target
> After=mysql.service
> 
> [Service]
> Type=forking
> Restart=no
> TimeoutSec=5min
> IgnoreSIGPIPE=no
> KillMode=process
> GuessMainPID=no
> RemainAfterExit=yes
> SuccessExitStatus=5 6
> ExecStart=/etc/init.d/mythtv-backend start
> ExecStop=/etc/init.d/mythtv-backend stop
> 
> 
> root at medienpc:/etc/init.d# systemctl status mythtv-backend
> ● mythtv-backend.service - LSB: Start/Stop the MythTV server.
>     Loaded: loaded (/etc/init.d/mythtv-backend; generated; vendor
> preset: enabled)
>     Active: active (running) since Sun 2017-09-17 16:17:46 CEST; 2h 3min ago
>       Docs: man:systemd-sysv-generator(8)
>    Process: 1054 ExecStop=/etc/init.d/mythtv-backend stop (code=exited,
> status=0/SUCCESS)
>    Process: 1460 ExecStart=/etc/init.d/mythtv-backend start
> (code=exited, status=0/SUCCESS)
>      Tasks: 20 (limit: 4915)
>     CGroup: /system.slice/mythtv-backend.service
>             └─962 /usr/bin/mythbackend --daemon --pidfile
> /var/run/mythtv/mythbackend.pid
> 
> Sep 17 16:17:46 medienpc systemd[1]: Starting LSB: Start/Stop the
> MythTV server....
> Sep 17 16:17:46 medienpc mythtv-backend[1460]: Starting MythTV server:
> mythbackend .
> Sep 17 16:17:46 medienpc systemd[1]: Started LSB: Start/Stop the MythTV server..
> 
> 
> Also when I change /etc/init.d/mythtv-backend, for example, to pass
> extra command line args such as "--syslog" then this option will
> appear in the process list, indicating that I'm editing the correct
> file:
> 
> root at medienpc:/etc/init.d# ps aux | grep mythbackend
> mythtv    2924  1.6  1.2 3660892 44220 ?       Ssl  18:26   0:00
> /usr/bin/mythbackend --daemon --pidfile
> /var/run/mythtv/mythbackend.pid --syslog
> 
> I don't get it. Where does it write logging information?

OK, good info. You're clearly running systemd (as expected for
Debian.) And it's making a service out of the init.d file (which
is perfectly normal.)

With --syslog still in the init.d backend script, see if the log is
going to the journal. Try journalctl --unit mythtv-backend (or if that
doesn't work, just journalctl.)

Also, journald may be forwarding entries to /etc/log/syslog. Try this
to check:

     grep ForwardToSyslog /etc/systemd/journald.conf

I set mine to no, but that's just personal preference.

> Also, to clarify: the backend usually won't come up when the machine
> wakes itself up of after a reboot ("All tuners are busy" or some such
> problem). However, when I manually stop/start the process, the backend
> will typicall work. So that's what I'm trying to debug.

This has been observed when the backend starts before the
network is up (or maybe before tuner firmware is loaded
etc.)

You could put a simple sleep in the script just before the backend
is started.

Again, personally, I'd remove the init.d entry and the rc<x>.d
pointers to it and put a real service in /etc/systemd/system.

See: https://www.mythtv.org/wiki/Systemd_mythbackend_Configuration
if you're interested.

-- 
Bill


More information about the mythtv-users mailing list