[rhel6-branch 2/2] rescue mode: fix traceback writing /mnt/sysimage/etc/mtab.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the /mnt/sysimage is mounted from a systemd distro,
/mnt/sysimage/etc/mtab is linked to /proc/mount and can not be written,
exception is thrown upon close().

Related: rhbz#730714
---
 rescue.py |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/rescue.py b/rescue.py
index f2c9c64..dbae8bd 100644
--- a/rescue.py
+++ b/rescue.py
@@ -138,18 +138,21 @@ class RescueInterface(InstallInterfaceBase):
 
 # XXX grub-install is stupid and uses df output to figure out
 # things when installing grub.  make /etc/mtab be at least
-# moderately useful.  
+# moderately useful.
 def makeMtab(instPath, storage):
     try:
         f = open(instPath + "/etc/mtab", "w+")
-    except IOError, e:
-        log.info("failed to open /etc/mtab for write: %s" % e)
-        return
-
-    try:
         f.write(storage.mtab)
+    except IOError as e:
+        log.info("failed to write /etc/mtab: %s" % e)
     finally:
-        f.close()
+        try:
+            # if this file is a symlink to /proc/mounts, as it is in F16, the
+            # close will raise an exception.
+            f.close()
+        except Exception as  e:
+            log.info("error closing /etc/mtab: %s" % e)
+            pass
 
 def makeFStab(instPath = ""):
     if os.access("/proc/mounts", os.R_OK):
-- 
1.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux