Bug 125405

Summary: Anaconda fails because of hyphen in previous LVM1 root partition name
Product: [Fedora] Fedora Reporter: major <major>
Component: anacondaAssignee: Chris Lumens <clumens>
Status: CLOSED DEFERRED QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 2CC: mhw, theitsmith
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-03-10 19:27:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 133260    

Description major 2004-06-06 13:01:06 UTC
Description of problem:
When updating from Fedora Core 1 to Fedora Core 2, I received a
failure because of a previous logical volume management version 1
(LVM1) installation that used a hyphen in the logical volume name for
the root partition.

Version-Release number of selected component (if applicable):
anaconda on the FC2-i386-disc1.iso CD

How reproducible:
My previous logical volume names were "lv-ROOT", "lv-SWAP", "lv-home",
"lv-tmp", "lv-usr", and "lv-var". The volume group was called "vg0". I
presume that any logical volume root partition with a hyphen in the
name will reproduce the problem. I am unsure if hyphens in the
non-root partition names will also cause problems.

Actual results:
########################################
Traceback (most recent call last):
  File "/usr/lib/anaconda/gui.py", line 1048, in handleRenderCallback
    self.currentWindow.renderCallback()
  File "/usr/lib/anaconda/iw/progress_gui.py", line 242, in renderCallback
    self.intf.icw.nextClicked()
  File "/usr/lib/anaconda/gui.py", line 763, in nextClicked
    self.dispatch.gotoNext()
  File "/usr/lib/anaconda/dispatch.py", line 169, in gotoNext
    self.moveStep()
  File "/usr/lib/anaconda/dispatch.py", line 237, in moveStep
    rc = apply(func, self.bindArgs(args))
  File "/usr/lib/anaconda/packages.py", line 521, in doMigrateFilesystems
    thefsset.makeLVMNodes(instPath, trylvm1 = 1)
  File "/usr/lib/anaconda/fsset.py", line 1500, in makeLVMNodes
    iutil.copyDeviceNode(dmdev, instPath + dmdev)
  File "/usr/lib/anaconda/iutil.py", line 403, in copyDeviceNode
    filestat = os.lstat(src)
OSError: [Errno 2] No such file or directory: '/dev/mapper/vg0-lv-ROOT'
 
Local variables in innermost frame:
dest: /mnt/sysimage/dev/mapper/vg0-lv-ROOT
src: /dev/mapper/vg0-lv-ROOT
######################################## 

Expected results:
I expected a correct update of LVM1 without the device mapper to LVM2
with the device mapper.

Additional info:
The "copyDeviceNode" function eventually calls LVM2 activation code,
the source code of which can be found in the "dev_manager.c" file of
"LVM2/lib/activate" in the LVM2 source tree. When making the device
mapper node entries, if any hyphens are found in the logical volume
names, then those are "quoted" by replacing each with two hyphens. The
"/dev/mapper/vg0-lv-ROOT" entry would be created as
"/dev/mapper/vg0-lv--ROOT". One hyphen would be expected by the
calling script, not two.

As a work-around, I used the "lvrename" command to change the hyphens
into underscores (e. g., "lv-ROOT" to "lv_ROOT"), then changed
"/etc/fstab", the GRUB boot line, and the initial ramdisk image to
correspond. When trying with underscores instead of hyphens, I
encountered no problems.

Since LVM2 activation code regards hyphens in logical volume names as
special, I recommend using anaconda to replace those hyphens as I did.

Comment 1 Mark Wilkinson 2004-06-23 20:03:08 UTC
I've experienced the same problem, although for me it was because my
volume group names contain hyphens (/dev/vg-main). I get the same
traceback trying to open /dev/mapper/vg-main-root. From the shell I
can see that /dev/mapper/vg--main-root exists.

Comment 2 Chris Lumens 2005-03-10 19:27:00 UTC
Unfortunately, solving this problem is rather complicated as you explained. 
It's not just a simple matter of changing the name of the logical volume - the
bootloader configs need to be updated, the fstab needs changing, and so forth. 
What's unfortunate is that the dash gained some special significance, making
moving to the newer version more difficult.

Comment 3 Chris Lumens 2009-03-10 15:40:02 UTC
*** Bug 489428 has been marked as a duplicate of this bug. ***