<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi<br>
    I use el6 based Live CDs and I think this last commit is causing the
    liveinst&nbsp; anaconda scripts some headaches.&nbsp; After pulling version
    16.3 of the tools from the git repo and updating my Build Host, I
    started having problems doing&nbsp; install to HD from LiveCD.<br>
    <br>
    Basically, anaconda included in el6 and el6u1 assumes that /etc/mtab
    is a regular file with rw attributes.<br>
    When the installer tries to open the file for writing and populate
    it,&nbsp; we are getting a traceback&nbsp; because /etc/mtab is symlinked to
    /proc/self/mounts&nbsp; and that file is not writable.<br>
    <br>
    If it is necessary to symlink /etc/mtab to proc/self/mounts in the
    livecd creator tool, would it be possible to implement a fix for
    anaconda scripts that do not like seeing /etc/mtab as a link to a
    read only /proc file?<br>
    <br>
    <br>
    <br>
    **Commit:<br>
    <tt><a class="moz-txt-link-freetext" href="http://git.fedorahosted.org/git/?p=livecd;a=commit;h=9e431a9c86398705ec7b30328dc0981539e15a40">http://git.fedorahosted.org/git/?p=livecd;a=commit;h=9e431a9c86398705ec7b30328dc0981539e15a40</a><br>
      <br>
    </tt>
    <div class="patchset">
      <div class="patch" id="patch1">
        <div class="diff header"><tt>diff --git <a class="path"
href="http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=ec4c1ba82fb00a3360362a26ab8fd0be8c1a58ae;hb=731ba56081dcc580b314d3214d0758a932a96118">a/imgcreate/creator.py</a>
            <a class="path"
href="http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=675dcf6cdf3e34b03ae3dd0ada5498b1faefa32b;hb=9e431a9c86398705ec7b30328dc0981539e15a40">b/imgcreate/creator.py</a></tt></div>
        <div class="diff extended_header"><tt>
            index <a class="hash"
href="http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=ec4c1ba82fb00a3360362a26ab8fd0be8c1a58ae;hb=731ba56081dcc580b314d3214d0758a932a96118">ec4c1ba</a>..<a
              class="hash"
href="http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=675dcf6cdf3e34b03ae3dd0ada5498b1faefa32b;hb=9e431a9c86398705ec7b30328dc0981539e15a40">675dcf6</a>
            100644<span class="info"> (file)</span><br>
          </tt>
        </div>
        <div class="diff from_file"><tt>--- a/<a class="path"
href="http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=ec4c1ba82fb00a3360362a26ab8fd0be8c1a58ae;hb=731ba56081dcc580b314d3214d0758a932a96118">imgcreate/creator.py</a></tt></div>
        <div class="diff to_file"><tt>+++ b/<a class="path"
href="http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=675dcf6cdf3e34b03ae3dd0ada5498b1faefa32b;hb=9e431a9c86398705ec7b30328dc0981539e15a40">imgcreate/creator.py</a></tt></div>
        <div class="diff chunk_header"><tt><span class="chunk_info">@@ <a
                class="list"
href="http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=ec4c1ba82fb00a3360362a26ab8fd0be8c1a58ae;hb=731ba56081dcc580b314d3214d0758a932a96118#l536">-536,7</a>
              <a class="list"
href="http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=675dcf6cdf3e34b03ae3dd0ada5498b1faefa32b;hb=9e431a9c86398705ec7b30328dc0981539e15a40#l536">+536,7</a>
              @@</span><span class="section">&nbsp;class&nbsp;ImageCreator(object):</span></tt></div>
        <div class="diff"><tt>&nbsp;</tt></div>
        <div class="diff"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.__create_minimal_dev()</tt></div>
        <div class="diff"><tt>&nbsp;</tt></div>
        <div class="diff rem"><tt>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;os.symlink("../proc/mounts",&nbsp;self._instroot&nbsp;+&nbsp;"/etc/mtab")</tt></div>
        <div class="diff add"><tt>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;os.symlink("/proc/self/mounts",&nbsp;self._instroot&nbsp;+&nbsp;"/etc/mtab")</tt></div>
        <div class="diff"><tt>&nbsp;</tt></div>
        <div class="diff"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.__write_fstab()</tt></div>
        <div class="diff"><tt>&nbsp;</tt></div>
        <div class="diff chunk_header"><tt><span class="chunk_info">@@ <a
                class="list"
href="http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=ec4c1ba82fb00a3360362a26ab8fd0be8c1a58ae;hb=731ba56081dcc580b314d3214d0758a932a96118#l548">-548,11</a>
              <a class="list"
href="http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=675dcf6cdf3e34b03ae3dd0ada5498b1faefa32b;hb=9e431a9c86398705ec7b30328dc0981539e15a40#l548">+548,6</a>
              @@</span><span class="section">&nbsp;class&nbsp;ImageCreator(object):</span></tt></div>
        <div class="diff"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from&nbsp;the&nbsp;install&nbsp;root.</tt></div>
        <div class="diff"><tt>&nbsp;</tt></div>
        <div class="diff"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"""</tt></div>
        <div class="diff rem"><tt>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try:</tt></div>
        <div class="diff rem"><tt>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;os.unlink(self._instroot&nbsp;+&nbsp;"/etc/mtab")</tt></div>
        <div class="diff rem"><tt>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;except&nbsp;OSError:</tt></div>
        <div class="diff rem"><tt>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pass</tt></div>
        <div class="diff rem"><tt>-</tt></div>
        <div class="diff"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.__destroy_selinuxfs()</tt></div>
        <div class="diff"><tt>&nbsp;</tt></div>
        <div class="diff"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self._undo_bindmounts()</tt></div>
      </div>
    </div>
    <br>
    **Install to HD Failure:<br>
    The failure looks like<br>
    <br>
    <blockquote><tt>Traceback (most recent call first):</tt><br>
      <tt> File "/usr/lib/anaconda/livecd.py", line 408, in
        doPostInstall</tt><br>
      <tt> f.close()</tt><br>
      <tt> File "/usr/lib/anaconda/backend.py", line 239, in
        doPostInstall</tt><br>
      <tt> anaconda.backend.doPostInstall(anaconda)</tt><br>
      <tt> File "/usr/lib/anaconda/dispatch.py", line 208, in moveStep</tt><br>
      <tt> rc = stepFunc(self.anaconda)</tt><br>
      <tt> File "/usr/lib/anaconda/dispatch.py", line 126, in gotoNext</tt><br>
      <tt> self.moveStep()</tt><br>
      <tt> File "/usr/lib/anaconda/gui.py", line 1381, in nextClicked</tt><br>
      <tt> self.anaconda.dispatch.gotoNext()</tt><br>
      <tt> File "/usr/lib/anaconda/iw/progress_gui.py", line 79, in
        renderCallback</tt><br>
      <tt> self.intf.icw.nextClicked()</tt><br>
      <tt> File "/usr/lib/anaconda/gui.py", line 1402, in
        handleRenderCallback</tt><br>
      <tt> self.currentWindow.renderCallback()</tt><br>
      <tt>IOError: [Errno 22] Invalid argument</tt><br>
      <tt>...</tt><br>
      <tt>IOError: [Errno 22] Invalid argument</tt><br>
      <br>
      <tt>Local variables in innermost frame:</tt><br>
    </blockquote>
    **Simple test:<br>
    When I echo foo into /proc/self/mounts ..<br>
    [root@bur374-199 ~]# echo foo &gt;&gt; /proc/self/mounts<br>
    <br>
    -bash: echo: write error: Invalid argument<br>
    <br>
    ...Looks like the anaconda python exception.<br>
    <br>
    <br>
    <br>
    **Workaround:<br>
    I think this file from anaconda package <tt>/usr/lib/anaconda/livecd.py</tt>
    , needs to take into account the possibility that /etc/mtab is
    symlinked to a ro file in proc and either do nothing&nbsp; (patch
    below),&nbsp; or unlink and create a regular file before trying to write
    data.<br>
    <br>
    I have had to add this patch to my el6 finish scripts as a
    workaround.<br>
    ###Finish script to fix anaconda liveinst&nbsp; when /etc/mtab is
    symlinked<br>
    <tt>%post<br>
      <br>
    </tt><tt>cat &gt; /tmp/apatch &lt;&lt; EOF_patch<br>
      --- /usr/lib/anaconda/livecd.py 2011-06-10 12:53:52.141225479
      -0400<br>
      +++ /usr/lib/anaconda/livecd.py_new&nbsp;&nbsp;&nbsp;&nbsp; 2011-06-10
      12:57:17.190133970 -0400<br>
      @@ -403,9 +403,10 @@<br>
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # now write out the "real" fstab and mtab<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; anaconda.id.storage.write(anaconda.rootPath)<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f = open(anaconda.rootPath + "/etc/mtab", "w+")<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f.write(anaconda.id.storage.mtab)<br>
      -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f.close()<br>
      +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if not os.path.islink("/etc/mtab"):<br>
      +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f = open(anaconda.rootPath + "/etc/mtab", "w+")<br>
      +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f.write(anaconda.id.storage.mtab)<br>
      +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f.close()<br>
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # copy over the modprobe.conf<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if os.path.exists("/etc/modprobe.conf"):<br>
      EOF_patch<br>
      patch -d /usr/lib/anaconda &lt; /tmp/apatch<br>
    </tt><br>
    <br>
    Thanks<br>
    Gregory Fowler<br>
  </body>
</html>