[mythtv] Systemd expertise needed: systemctl fails to start mythbackend

Richard Shaw hobbes1069 at gmail.com
Thu Jul 5 22:44:22 UTC 2012


On Thu, Jul 5, 2012 at 5:21 PM, R. G. Newbury <newbury at mandamus.org> wrote:
> Thanks Richard. I have been using a variant of your service file for some
> time now. *With* user=mythtv.

Now, when you run manually and it succeeds, what user are you running as?

> I was under the impression (from something I read) that pidfile was not
> needed. That may have been in reference to mysqld..

The answer is "maybe". You need the PID file for Type=forking. You
don't need it for Type=simple, although it shouldn't hurt anything,
it's just useless.


> So I added --pidfile /run/mythtv/backend.pid (using forking and daemon)
> This fails but now reports 'deactivating' (not 'failed') until I kill
> mythlogserver. The log file message is the same 'failed init MythContext'.
> As before, the cli startup is fine.
>
> With pidfile and simple (no daemon and no ExecStartPre), I get this:
>
>
> root at tor6 mythtv]# systemctl start mythbackend.service
> [root at tor6 mythtv]# systemctl status mythbackend.service
> mythbackend.service - mythbackend daemon
>           Loaded: loaded (/usr/lib/systemd/system/mythbackend.service;
> enabled)
>           Active: deactivating (stop-sigterm) (Result: exit-code) since Thu,
> 05 Jul 2012 18:06:17 -0400; 2s ago
>          Process: 5713 ExecStart=/usr/local/bin/mythbackend --logpath
> /var/log/mythtv --loglevel crit --pidfile /run/mythtv/backend.pid
> (code=exited, status=130)
>           CGroup: name=systemd:/system/mythbackend.service
>                   └ 5730 /usr/local/bin/mythlogserver --daemon --verbose
> general --logpath /var/l...
[snip]
> The actual startup fails with code=extied, status=130). I have been unable
> to find any description of systemd error code messages.

This is the exit code of mythbackend, not systemd. That may provide
some insight.

There really should be documentation for this, maybe there is, but all
I could find was exitcodes.h with:

#define GENERIC_EXIT_NO_MYTHCONTEXT     130 ///< No MythContext available


> The import of the last lines, is that mythbackend cannot talk to the mysqld
> server...which it does, when started from the command line...The logfile
> repeats its same refrain.
>
> Same results using user=root group=root in the service file.
>
> I'm wondering if systemd is blocking interprocess communications until it*
> thinks the new program is stable and has started properly? Meanwhile, the
> backend attempts to contact the mysqld server, which fails.

Do you have the environment variables set as well?

Environment=MYTHCONFDIR=/etc/mythtv
Environment=HOME=/usr/share/mythtv

And do they point to config.xml or whatever it's called?

Good luck! I'm about out of ideas :)

RIchard


More information about the mythtv-dev mailing list