[Fedora-livecd-list] /etc/mtab symlink to /proc/self/mounts
Gregory Fowler
gregory.fowler at oracle.com
Mon Jun 20 20:56:59 UTC 2011
Hi
I use el6 based Live CDs and I think this last commit is causing the
liveinst anaconda scripts some headaches. After pulling version 16.3
of the tools from the git repo and updating my Build Host, I started
having problems doing install to HD from LiveCD.
Basically, anaconda included in el6 and el6u1 assumes that /etc/mtab is
a regular file with rw attributes.
When the installer tries to open the file for writing and populate it,
we are getting a traceback because /etc/mtab is symlinked to
/proc/self/mounts and that file is not writable.
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?
**Commit:
http://git.fedorahosted.org/git/?p=livecd;a=commit;h=9e431a9c86398705ec7b30328dc0981539e15a40
diff --git a/imgcreate/creator.py
<http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=ec4c1ba82fb00a3360362a26ab8fd0be8c1a58ae;hb=731ba56081dcc580b314d3214d0758a932a96118>
b/imgcreate/creator.py
<http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=675dcf6cdf3e34b03ae3dd0ada5498b1faefa32b;hb=9e431a9c86398705ec7b30328dc0981539e15a40>
index ec4c1ba
<http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=ec4c1ba82fb00a3360362a26ab8fd0be8c1a58ae;hb=731ba56081dcc580b314d3214d0758a932a96118>..675dcf6
<http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=675dcf6cdf3e34b03ae3dd0ada5498b1faefa32b;hb=9e431a9c86398705ec7b30328dc0981539e15a40>
100644(file)
--- a/imgcreate/creator.py
<http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=ec4c1ba82fb00a3360362a26ab8fd0be8c1a58ae;hb=731ba56081dcc580b314d3214d0758a932a96118>
+++ b/imgcreate/creator.py
<http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=675dcf6cdf3e34b03ae3dd0ada5498b1faefa32b;hb=9e431a9c86398705ec7b30328dc0981539e15a40>
@@ -536,7
<http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=ec4c1ba82fb00a3360362a26ab8fd0be8c1a58ae;hb=731ba56081dcc580b314d3214d0758a932a96118#l536>
+536,7
<http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=675dcf6cdf3e34b03ae3dd0ada5498b1faefa32b;hb=9e431a9c86398705ec7b30328dc0981539e15a40#l536>
@@ class ImageCreator(object):
self.__create_minimal_dev()
- os.symlink("../proc/mounts", self._instroot + "/etc/mtab")
+ os.symlink("/proc/self/mounts", self._instroot + "/etc/mtab")
self.__write_fstab()
@@ -548,11
<http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=ec4c1ba82fb00a3360362a26ab8fd0be8c1a58ae;hb=731ba56081dcc580b314d3214d0758a932a96118#l548>
+548,6
<http://git.fedorahosted.org/git?p=livecd;a=blob;f=imgcreate/creator.py;h=675dcf6cdf3e34b03ae3dd0ada5498b1faefa32b;hb=9e431a9c86398705ec7b30328dc0981539e15a40#l548>
@@ class ImageCreator(object):
from the install root.
"""
- try:
- os.unlink(self._instroot + "/etc/mtab")
- except OSError:
- pass
-
self.__destroy_selinuxfs()
self._undo_bindmounts()
**Install to HD Failure:
The failure looks like
Traceback (most recent call first):
File "/usr/lib/anaconda/livecd.py", line 408, in doPostInstall
f.close()
File "/usr/lib/anaconda/backend.py", line 239, in doPostInstall
anaconda.backend.doPostInstall(anaconda)
File "/usr/lib/anaconda/dispatch.py", line 208, in moveStep
rc = stepFunc(self.anaconda)
File "/usr/lib/anaconda/dispatch.py", line 126, in gotoNext
self.moveStep()
File "/usr/lib/anaconda/gui.py", line 1381, in nextClicked
self.anaconda.dispatch.gotoNext()
File "/usr/lib/anaconda/iw/progress_gui.py", line 79, in renderCallback
self.intf.icw.nextClicked()
File "/usr/lib/anaconda/gui.py", line 1402, in handleRenderCallback
self.currentWindow.renderCallback()
IOError: [Errno 22] Invalid argument
...
IOError: [Errno 22] Invalid argument
Local variables in innermost frame:
**Simple test:
When I echo foo into /proc/self/mounts ..
[root at bur374-199 ~]# echo foo >> /proc/self/mounts
-bash: echo: write error: Invalid argument
...Looks like the anaconda python exception.
**Workaround:
I think this file from anaconda package /usr/lib/anaconda/livecd.py ,
needs to take into account the possibility that /etc/mtab is symlinked
to a ro file in proc and either do nothing (patch below), or unlink
and create a regular file before trying to write data.
I have had to add this patch to my el6 finish scripts as a workaround.
###Finish script to fix anaconda liveinst when /etc/mtab is symlinked
%post
cat > /tmp/apatch << EOF_patch
--- /usr/lib/anaconda/livecd.py 2011-06-10 12:53:52.141225479 -0400
+++ /usr/lib/anaconda/livecd.py_new 2011-06-10 12:57:17.190133970 -0400
@@ -403,9 +403,10 @@
# now write out the "real" fstab and mtab
anaconda.id.storage.write(anaconda.rootPath)
- f = open(anaconda.rootPath + "/etc/mtab", "w+")
- f.write(anaconda.id.storage.mtab)
- f.close()
+ if not os.path.islink("/etc/mtab"):
+ f = open(anaconda.rootPath + "/etc/mtab", "w+")
+ f.write(anaconda.id.storage.mtab)
+ f.close()
# copy over the modprobe.conf
if os.path.exists("/etc/modprobe.conf"):
EOF_patch
patch -d /usr/lib/anaconda < /tmp/apatch
Thanks
Gregory Fowler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/livecd/attachments/20110620/0d59c684/attachment.html
More information about the livecd
mailing list