[mythtv-users] mythfilldatabase autorun config file location error
R. G. Newbury
newbury at mandamus.org
Tue Oct 17 21:12:30 UTC 2006
Michael T. Dean wrote:
> On 10/17/06 09:56, Daniel Kristjansson wrote:
>
>> On Sat, 2006-10-14 at 16:26 +0100, Neil Sedger wrote:
>>
>>
>>> Michael T. Dean wrote:
>>>
>>>
>>>> Because the environment from which this is being run doesn't have a HOME
>>>> environment variable defined.
>>>>
>>>>
>>> Indeed. How odd. I thought that Fedora initscripts would automatically pick up the user's (root) environment. A quick test shows it doesn't even have $USER!
>>> I've edited the initscript to hardcode the HOME var as you suggested, thanks.
>>> I'd have thought this problem would happen to more people though, I haven't seen it mentioned in the docs, install guide or FAQ.
>>>
>>>
>> I would think very few people run mythfilldatabase as root..
>>
>> Too many people do something crazy like run mythbackend or mythfrontend
>> as root, but I've never seen anyone recommend running mythfilldatabase
>> that way.
>>
> Of course, if running (the master) mythbackend as root and if MythTV is
> set to automatically run mythfilldatabase, mythfilldatabase is run as
> root. :)
>
> The most common reason to be lacking a HOME environment variable is
> because an init script (which is not executed under a login shell)
> starts mythbackend and doesn't go to the trouble of setting up the
> environment correctly. Those without a HOME environment variable tend
> to end up with /.qt and /.mythtv directories (off the root of the fs)
> because the HOME expands to nothing (in MythContext::GetConfDir()). In
> this case--whether using XMLTV or DataDirect--mythfilldatabase will
> download the channel icons into /.mythtv/channels directory (off the
> root of the filesystem).
>
> Another issue caused by running mythbackend as root is the lack of an
> XMLTV configuration file (for XMLTV users). Often, the user will
> configure XMLTV as user mythtv (the user running mythfrontend) or
> sometimes even as the root user, but from a login shell (with a HOME
> environment variable). In doing so, the XMLTV configuration file is
> written to the user's home directory. Then, when mythfilldatabase runs
> automatically (by the mythbackend process started in an environment
> lacking a HOME), if often fails because it's lacking an XMLTV
> configuration file.
>
> IMHO, we shouldn't be looking through random directories for
> configuration information when a HOME environment variable doesn't exist
> (even hard-coding in paths like /home/{root,mythtv} and /root. So, we
> just need to ensure that users configure their environments appropriately.
>
> I don't know how any of the distros set things up, but if, as the OP
> suggests, the FC init scripts don't set the HOME environment variable,
> it means that a large number of FC users are probably relying on /.qt
> and /.mythtv directories for their mythbackend/mythfilldatabase
> configurations. If Axel were to change the init scripts to specify a
> HOME, then those users who had gotten configuration information into
> directories of the root filesystem would no longer be using that
> information (and would, therefore, have to be taught to move their
> configuration information). So, changing the scripts and not changing
> the scripts both have their benefits.
>
> But, as you were saying, running mythfilldatabase as root is not a good
> idea. So, by extension, figuring out how to run mythbackend as non-root
> is a good idea. :)
>
> Mike
Verrrryyy interesting. Firstly, I always run mythfilldatabase as root
and it runs fine!
Under Fedora, at least, the $HOME variable is taken from the /etc/passwd
file, and set by 'login' on logging in.
I would think that the only way to get running without a $HOME
environment variable set would be to bypass login somehow.
Regarding running/starting mythbackend as root, I have just noticed that
the /etc/sysconfig/mythbackend file has an entry providing for I
mythbackend to be started by some other user than root.
I will try out that possibility to see if it will work together with an
auto-login as the myth user. If so, it will resolve one major problem
where the myth user cannot stop and restart the mythbackend service.
If that works I suspect that chown and chgrp of mythfilldatabase may be
sufficient to avoid the problem referred to above.
Although I still do not understand why 'running mythfilldatabase root is
not a good idea'.
This is a myth.
Geoff
--
R. Geoffrey Newbury
Barrister and Solicitor
Suite 106, 150 Lakeshore Road West
Mississauga, Ontario, L5H 3R2
o905-271-9600 f905-271-1638
newbury at mandamus.org
Helping with the HTTP issue
<a href="http://www.w3.org/Protocols/">HTTP</a>
More information about the mythtv-users
mailing list