R. G. Newbury
newbury at mandamus.org
Tue Jul 10 15:22:56 UTC 2012
On 07/10/2012 09:29 AM, James Linder wrote:
> G'day all
> I'm going crazy trying to start mythbackend using systemctrl
> If anybody can help --- pretty please ...
> Got the (fedora) systemctl file from the wiki: http://www.mythtv.org/wiki/Systemd_mythbackend_Configuration
> It does not start and status is
> sandypit:/mnt/store/mythlogs # systemctl status mythbackend.service
> mythbackend.service - MythTV backend service
> Loaded: loaded (/etc/systemd/system/mythbackend.service; enabled)
> Active: inactive (dead) since Tue, 10 Jul 2012 12:50:41 +0800; 30s ago
> Process: 3036 ExecStart=/usr/local/bin/mythbackend --daemon --logpath /mnt/store/mythlogs --pidfile /var/run/myth.pid (code=exited, status=0/SUCCESS)
> CGroup: name=systemd:/system/mythbackend.service
> The log file IS created, but is empty.
> I can pickup the ExecStart line, execute it, and it does run normally.
> Help ...
Hah! Been there, messed it up too. It is almost assuredly a permissions
problem somewhere. When the backend starts, systemd starts the process
but switches so that mythbackend ends up being run as user mythtv.
Systemd seem to systematically steal error messages (say that three
times quickly) so you do not see what goes wrong. Here is a code snippet
which I put into my rc.local file ( and I enable rc-local.service):
# Sanity check on required folders
if [ ! -x /var/log/mythtv ]; then
# make logging folder
mkdir -p -m 755 /var/log/mythtv
chown -hR mythtv:mythtv /var/log/mythtv
# make pid folder
mkdir -p -m 755 /var/run/mythtv
chown -hR mythtv:mythtv /var/run/mythtv
(Besides the 'stabilized hardware and naming problems' referred to in
the wiki, the mythtv user has to be able to access the hardware too, so a
chown -R mythtv:mythtv /dev/dvb
or similar can obviate a problem appearing later on.)
Regarding the pidfile: mythtv 0.25 now also creates a mythlogserver
process which has its own pid, so creating a pidfile to avoid confusion
seems helpful. Also for that reason, I use type forking (although
otherwise the same setup as for simple) to alert systemd to the
situation. It then creates a group for the processes and keeps track of
things. You will see this in 'systemctl status' report
On both Fedora 16 and 17, systemd seems to have problems creating
folders in /run. And since /run gets created on every boot this can be a
blocker. The /run/mythtv folder just does not get created. As a result,
I have been using --pidfile /var/log/mythtv/backend.pid
PS. I edited the wiki page to fix the formatting.
I have also found the systemd sometimes fails to create
More information about the mythtv-users