[mythtv-users] mythshutdown: Could not initialize myth context. Exiting.
Michael T. Dean
mtdean at thirdcontact.com
Sat Feb 16 22:26:24 UTC 2008
On 02/16/2008 02:40 PM, Ashley Bostock wrote:
> On 16/02/2008, Michael T. Dean <mtdean at thirdcontact.com> wrote:
>
>> On 02/16/2008 01:01 PM, Paul Harrison wrote:
>>
>>> Ashley Bostock wrote:
>>>> In mythwelcome if I bring up the menu and choose the "Shutdown Now"
>>>> option, nothing happens (used to work) and in the mythwelcome log I
>>>> get this...
>>>>
>>>> mythshutdown --startup returned: 1
>>>> mythshutdown: Could not initialize myth context. Exiting.
>>>>
>>>> I've seen people talk about it is due to the $HOME variable not being
>>>> set, but running echo $HOME before starting mythwelcome does output
>>>> the correct directory. I've also tried adding sudo -H to every place
>>>> I can find which runs mythshutdown but that makes no difference either.
>>>>
>>>> My auto shutdown/wake up is working perfectly still, so it's only the
>>>> "Shutdown Now" option that's broken.
>>>> Is it working for anyone else?
>>>>
>>> It's probably something to do with the way mythwelcome does the
>>> shutdown. The command it uses is hardcoded to this:-
>>> system("sudo " + m_installDir + "/bin/mythshutdown --shutdown")
>>>
>>> Not sure at this stage why some people are suddenly having problems, my
>>> parents machine has been running mythwelcome/mythshutdown for well over
>>> 2 years now with no problems although they are still running svn that is
>>> probably 6 months old now. Most problems can be traced to the user not
>>> having things setup right but if it was working and now isn't then I
>>> suspect the new auto-discovery stuff may have a hand in it.
>>>
>> Exactly! Fix the environment in which mythwelcome/mythshutdown is
>> executed to have a properly-exported HOME directory and everything will
>> work.
> Thanks for the info. Any pointers on what a "properly exported HOME
> directory" requires?
>
> If I type export, I can see HOME listed and set to the correct value.
> If I type echo $HOME, it shows the correct value. But then running sudo
> mythshutdown, gives me the error.
>
> I accept my system configuration is broken, but it's a stock Ubuntu install
> so if I can get some help in figuring out what needs to be fixed, then I'm
> sure it'll save a lot of threads like this from others when 0.21 gets
> released to the masses.
Depending on the value specified for env_reset in your sudoers file, the
handling of the HOME environment variable can differ. If env_reset is
enabled (the default, and really the configuration you should use), only
a few variables (including HOME) are passed to the environment in which
the sudone ;) command is executed. However, the value may be determined
by the sudo default depending on the values of env_keep, env_delete,
and/or env_check.
See the sudo and sudoers man page (and especially the SECURITY NOTES
section of the sudo man page), and check your /etc/sudoers to see if
you're changing the HOME variable handling. Also, run "sudo -V" as root
to see more info on your sudo config. You may also find it easier to
get help from someone else using Ubuntu (who probably has a sudo
configuration like yours)--chances are some of the guys in
#ubuntu-mythtv (I think that's the right channel) could help out once
you explain Myth now requires a proper value for HOME (and you may be
helping them to fix the configuration the packages for 0.21 will use).
If you have an exported HOME environment variable, it's got something to
do with your sudo configuration, so fixing it should fix the problem.
Mike
More information about the mythtv-users
mailing list