Bug 177079 - Updating fstab fails if /etc and /tmp are on different filesystems
Updating fstab fails if /etc and /tmp are on different filesystems
Status: CLOSED DUPLICATE of bug 175131
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: system-config-lvm (Show other bugs)
4.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jim Parsons
:
Depends On: 175131
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-05 20:35 EST by Håvard Lygre
Modified: 2009-04-16 19:12 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-05-15 12:39:49 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Håvard Lygre 2006-01-05 20:35:11 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050914 Firefox/1.0.4 (Debian package 1.0.4-2sarge4)

Description of problem:
s-c-l updates fstab by creating a modified version in /tmp/fstab and _renaming_ (os.rename) it to /etc/fstab.  This does not work when /tmp and /etc are on different filesystems.  Everything else works (the LV is created, the filesystem is created and mounted on correct mountpoint), but the application hangs after this error. 

Traceback (most recent call last):
  File "/usr/share/system-config-lvm/InputController.py", line 645, in on_new_lv    if dlg.run() == False:
  File "/usr/share/system-config-lvm/InputController.py", line 1324, in run
    if self.apply() == True:
  File "/usr/share/system-config-lvm/InputController.py", line 2002, in apply
    Fstab.add(lv_path, mountpoint_new, filesys_new.name)
  File "/usr/share/system-config-lvm/Fstab.py", line 33, in add
    os.rename(FSTAB_TMP, FSTAB)
OSError: [Errno 18] Invalid cross-device link


The same problem occurs if you try to remove an LV, however then the app crashes before being able to do anything (as editing fstab is probably the first thing that happens).

Using shutil.move instead of os.rename fixes the problem for me.

--- Fstab.py.old        2005-09-13 16:46:05.000000000 +0200
+++ Fstab.py    2006-01-06 02:32:05.000000000 +0100
@@ -1,6 +1,7 @@

 import sys
 import os
+import shutil

 import Filesystem

@@ -30,12 +31,12 @@
     fstab.write(line)
     fstab.close()

-    os.rename(FSTAB_TMP, FSTAB)
+    shutil.move(FSTAB_TMP, FSTAB)

 def remove(mnt_point):
     fstab = __remove(mnt_point)
     fstab.close()
-    os.rename(FSTAB_TMP, FSTAB)
+    shutil.move(FSTAB_TMP, FSTAB)

 def __remove(mnt_point):
     fstab = open(FSTAB, 'r')


Version-Release number of selected component (if applicable):
system-config-lvm-1.0.5-1.0

How reproducible:
Always

Steps to Reproduce:
/etc and /tmp on different filesystems.  Create a new LV, and ask s-c-l to mount after reboot (so it updates the fstab).

Actual Results:  The application crashes, having performed some of the tasks.

Additional info:
Comment 2 Stanko Kupcevic 2006-05-15 12:39:49 EDT
Fixed in 1.0.17

*** This bug has been marked as a duplicate of 175131 ***

Note You need to log in before you can comment on or make changes to this bug.