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

Ashley Bostock abostock at gmail.com
Mon Feb 18 14:02:22 UTC 2008


On 18/02/2008, Ashley Bostock <abostock at gmail.com> wrote:
>
> On 16/02/2008, Michael T. Dean <mtdean at thirdcontact.com> wrote:
>
> > 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.
>
>
> My sudoers file doesn't have env_reset in it, so I'm using the default
> setting of it being enabled.
>
> However, the value may be determined
> > by the sudo default depending on the values of env_keep, env_delete,
> > and/or env_check.
>
>
> I don't change/set any of these either in my sudoers file.
>
> 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.
>
>
> Cross referencing each line and setting (there are hardly any) in my
> sudoers file with the description from the man pages, I can't find any thing
> in it that would change it.
>
> Also, run "sudo -V" as root to see more info on your sudo config.
>
>
> Running that gives me...
> Environment variables to check for sanity:
>         XAUTHORIZATION
>         XAUTHORITY
>         DISPLAY
>         LOGNAME
>         HOME
>         TERM
>         LANGUAGE
>         LANG
>         LC_*
>
> Which I assume is saying that the HOME variable should be exported and set
> correctly when I use sudo.  No other line on the output talks about the HOME
> setting or anything regarding removing, modifying, not setting, etc... its
> value.
>
> So I'm completely confused as to what a properly configured sudo setup
> should look like, as based off what you've said and what the man page states
> I'm not specifically telling it to not set HOME, in fact everything seems to
> imply that it should be set.
>
> Any one else out there who has this working, could you post your sudoers
> file?
> Mike I assume you do have this working, do you have any extra settings in
> your sudoers file?
>
> Ash
>
>

Just had a thought, added /usr/bin/env to my list of commands mythtv user
can run and a "sudo env" doesn't list HOME as you said was the problem where
as the "sudo -H env" does.

So adding env_keep=HOME to the end of my Defaults line in the sudoers file
has fixed the error with mythshutdown.

Although I still don't understand why HOME is getting removed when using the
default settings.

Thanks for the help.
Ash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-users/attachments/20080218/0c5e1cd9/attachment.htm 


More information about the mythtv-users mailing list