[mythtv-users] mythshutdown: Could not initialize myth context. Exiting.

Michael T. Dean mtdean at thirdcontact.com
Sat Feb 16 17:52:37 UTC 2008


On 02/16/2008 10:52 AM, nospam312 wrote:
>> 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?
>> (I'm running SVN 16053)
> I have recently had an issue with shutting down but -H (and a little
> rewrite of the script I was using) sorted it for me.
>   

$ man sudo
...
       -H  The -H (HOME) option sets the HOME environment variable to 
the homedir of the target user (root by default) as specified in 
passwd(5).  By default, sudo does not modify HOME (see set_home and 
always_set_home in sudoers(5)).
...

The whole, "By default, sudo does /not/ modify HOME," (emphasis added) 
part indicates that if you have to use sudo -H, you are running one or 
more Myth applications in a broken environment.  I.e. whatever program 
is calling sudo is running in an environment in which HOME is either not 
set or, more likely, not properly exported, so you're having to tell 
sudo to artificially set HOME to the HOME directory of the target user, 
rather than inherit the HOME directory of the user calling sudo.   Even 
with the -H, it can fail if the target user's HOME does not have the 
proper MythTV configuration information available (i.e. ~/.mythtv).

> Like you, I am still having issues as you describe using SVN 15878
> however.  The Shutdown Now option does not work and the logfile says
> Could not initialize myth context. Exiting.
>   

Fix the environment that starts the program that calls sudo so you don't 
need sudo -H...

> I am also looking for a solution or to whether I should add it to trac
> as a problem?  Has anyone else got the same problem - if a few more
> people have the same problem it probably needs adding to trac?

It's really a system configuration issue, not a Myth issue.  Myth SVN 
has recently changed to forbid users from executing Myth in an 
improperly configured environment (specifically, one without a valid 
HOME directory).  That will not be changed, so a ticket isn't useful.  
You just need to fix your system configuration.

Mike


More information about the mythtv-users mailing list