On 18/02/2008, <b class="gmail_sendername">Ashley Bostock</b> &lt;<a href="mailto:abostock@gmail.com">abostock@gmail.com</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><span class="e" id="q_1182cbd243bc52b0_0">On 16/02/2008, <b class="gmail_sendername">Michael T. Dean</b> &lt;<a href="mailto:mtdean@thirdcontact.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">mtdean@thirdcontact.com</a>&gt; wrote:</span></div>
<div><div><span class="e" id="q_1182cbd243bc52b0_2"><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 02/16/2008 02:40 PM, Ashley Bostock wrote:<br>&gt; On 16/02/2008, Michael T. Dean &lt;<a href="mailto:mtdean@thirdcontact.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">mtdean@thirdcontact.com</a>&gt; wrote:<br>
&gt;<br>&gt;&gt; On 02/16/2008 01:01 PM, Paul Harrison wrote:<br>
&gt;&gt;<br>&gt;&gt;&gt; Ashley Bostock wrote:<br>&gt;&gt;&gt;&gt; In mythwelcome if I bring up the menu and choose the &quot;Shutdown Now&quot;<br>&gt;&gt;&gt;&gt; option, nothing happens (used to work) and in the mythwelcome log I<br>

&gt;&gt;&gt;&gt; get this...<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; mythshutdown --startup returned: 1<br>&gt;&gt;&gt;&gt; mythshutdown: Could not initialize myth context. Exiting.<br>&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; I&#39;ve seen people talk about it is due to the $HOME variable not being<br>

&gt;&gt;&gt;&gt; set, but running echo $HOME before starting mythwelcome does output<br>&gt;&gt;&gt;&gt; the correct directory.&nbsp;&nbsp;I&#39;ve also tried adding sudo -H to every place<br>&gt;&gt;&gt;&gt; I can find which runs mythshutdown but that makes no difference either.<br>

&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt;&gt; My auto shutdown/wake up is working perfectly still, so it&#39;s only the<br>&gt;&gt;&gt;&gt; &quot;Shutdown Now&quot; option that&#39;s broken.<br>&gt;&gt;&gt;&gt; Is it working for anyone else?<br>

&gt;&gt;&gt;&gt;<br>&gt;&gt;&gt; It&#39;s probably something to do with the way mythwelcome does the<br>&gt;&gt;&gt; shutdown. The command it uses is hardcoded to this:-<br>&gt;&gt;&gt; system(&quot;sudo &quot; + m_installDir + &quot;/bin/mythshutdown --shutdown&quot;)<br>

&gt;&gt;&gt;<br>&gt;&gt;&gt; Not sure at this stage why some people are suddenly having problems, my<br>&gt;&gt;&gt; parents machine has been running mythwelcome/mythshutdown for well over<br>&gt;&gt;&gt; 2 years now with no problems although they are still running svn that is<br>

&gt;&gt;&gt; probably 6 months old now. Most problems can be traced to the user not<br>&gt;&gt;&gt; having things setup right but if it was working and now isn&#39;t then I<br>&gt;&gt;&gt; suspect the new auto-discovery stuff may have a hand in it.<br>

&gt;&gt;&gt;<br>&gt;&gt; Exactly!&nbsp;&nbsp;Fix the environment in which mythwelcome/mythshutdown is<br>&gt;&gt; executed to have a properly-exported HOME directory and everything will<br>&gt;&gt; work.<br>&gt; Thanks for the info.&nbsp;&nbsp;Any pointers on what a &quot;properly exported HOME<br>

&gt; directory&quot; requires?<br>&gt;<br>&gt; If I type export, I can see HOME listed and set to the correct value.<br>&gt; If I type echo $HOME, it shows the correct value.&nbsp;&nbsp;But then running sudo<br>&gt; mythshutdown, gives me the error.<br>

&gt;<br>&gt; I accept my system configuration is broken, but it&#39;s a stock Ubuntu install<br>&gt; so if I can get some help in figuring out what needs to be fixed, then I&#39;m<br>&gt; sure it&#39;ll save a lot of threads like this from others when 0.21 gets<br>

&gt; released to the masses.</blockquote></span></div><div><div><span class="e" id="q_1182cbd243bc52b0_4"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Depending on the value specified for env_reset in your sudoers file, the<br>
handling of the HOME environment variable can differ.&nbsp;&nbsp;If env_reset is<br>enabled (the default, and really the configuration you should use), only<br>a few variables (including HOME) are passed to the environment in which<br>

the sudone ;) command is executed.</blockquote></span></div><div><br>
My sudoers file doesn&#39;t have env_reset in it, so I&#39;m using the default setting of it being enabled.<br>
</div><span class="q"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">However, the value may be determined<br>by the sudo default depending on the values of env_keep, env_delete,<br>

and/or env_check.</blockquote></span><div><br>
I don&#39;t change/set any of these either in my sudoers file.<br>
</div><span class="q"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">See the sudo and sudoers man page (and especially the SECURITY NOTES<br>
section of the sudo man page), and check your /etc/sudoers to see if<br>
you&#39;re changing the HOME variable handling.</blockquote></span><div><br>
Cross referencing each line and setting (there are hardly any) in my
sudoers file with the description from the man pages, I can&#39;t find any
thing in it that would change it.<br>
</div><span class="q"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Also, run &quot;sudo -V&quot; as root to see more info on your sudo config.</blockquote>

</span><div><br>
Running that gives me...<br>
Environment variables to check for sanity:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XAUTHORIZATION<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; XAUTHORITY<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DISPLAY<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOGNAME<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HOME<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TERM<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LANGUAGE<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LANG<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LC_*<br>
<br>
Which I assume is saying that the HOME variable should be exported and
set correctly when I use sudo.&nbsp; No other line on the output talks about
the HOME setting or anything regarding removing, modifying, not
setting, etc... its value.<br>
</div><div><br>
So I&#39;m completely confused as to what a properly configured sudo setup
should look like, as based off what you&#39;ve said and what the man page
states I&#39;m not specifically telling it to not set HOME, in fact
everything seems to imply that it should be set.<br>
</div><br>
Any one else out there who has this working, could you post your sudoers file?<br>
Mike I assume you do have this working, do you have any extra settings in your sudoers file?<br>
<br>
Ash<br></div></div><br>
</blockquote></div><br><br>Just had a thought, added /usr/bin/env to my list of commands mythtv user can run and a &quot;sudo env&quot; doesn&#39;t list HOME as you said was the problem where as the &quot;sudo -H env&quot; does.<br>
<br>So adding env_keep=HOME to the end of my Defaults line in the sudoers file has fixed the error with mythshutdown.<br><br>Although I still don&#39;t understand why HOME is getting removed when using the default settings.<br>
<br>Thanks for the help.<br>Ash<br>