This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 430907 - Anaconda mishandles LVM LV names with -'s in them.
Anaconda mishandles LVM LV names with -'s in them.
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: anaconda (Show other bugs)
5.1
All Linux
medium Severity medium
: rc
: ---
Assigned To: Joel Andres Granados
Alexander Todorov
:
: 428607 (view as bug list)
Depends On: 186439
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-30 09:58 EST by Martin Sivák
Modified: 2010-10-22 18:09 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-01-20 16:36:57 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Martin Sivák 2008-01-30 09:58:04 EST
+++ This bug was initially created as a clone of Bug #186439 +++

Description of problem:
Installing into an LV with a - in its name causes anaconda to crash with an
exception stating that it can't find the LV name.  For an LV named name1-name2
on a VG named 'VG', the name it states its looking for is
/dev/mapper/VG-name1-name2.  For LV names with -'s in them, the name in the
mapper directory will be VG-name1--name2.

Version-Release number of selected component (if applicable):
The version that shows up on the FC5 installation CD.

How reproducible:
Every time

Steps to Reproduce:
1.Create some LVs with -'s in their names
2.Try to install Fedora Core 5 with some partitions on those LVs
3.Watch Fedore Core 5 anaconda crash
  
Actual results:
Anaconda throws an exception

Expected results:
The installation proceeding normally

Additional info:

-- Additional comment from katzj@redhat.com on 2006-09-22 00:00 EST --
anaconda disallows a - in the LV or VG name, so this is only a problem for
preexisting ones.

-- Additional comment from eric-bugs@omnifarious.org on 2006-10-09 17:54 EST --
That means that Anaconda should be fixed to allow LV names with a '-' in them.  :-)

-- Additional comment from jgranado@redhat.com on 2007-03-16 14:15 EST --
For now the idea is to avoid crashes.  There are two possibilities:
To tell the user that the lv or vg name with the '-' character is not accepted.
Or to replace the character.

FIRST OPTION:
--- ../FC-D/kickstart.py	2007-03-08 19:43:45.000000000 +0100
+++ kickstart.py	2007-03-16 19:00:50.000000000 +0100
@@ -257,6 +257,9 @@
         elif (lvd.percent <= 0 or lvd.percent > 100) and not lvd.preexist:
             raise KickstartValueError, formatErrorMsg(self.lineno,
msg="Percentage must be between 0 and 100")
 
+        if "-" in lvd.name:
+            raise KickstartValueError, formatErrorMsg(self.lineno, msg="The '-'
character must not be used in logical volume names.")
+
         request = partRequests.LogicalVolumeRequestSpec(filesystem,
                                       format = lvd.format,
                                       mountpoint = lvd.mountpoint,
@@ -605,6 +608,9 @@
         if vgd.pesize not in lvm.getPossiblePhysicalExtents(floor=1024):
             raise KickstartValueError, formatErrorMsg(self.lineno, msg="Volume
group specified invalid pesize")
 
+        if "-" in vgd.vgname:
+            raise KickstartValueError, formatErrorMsg(self.lineno, msg="The '-'
character must not be used in volume group names.")
+
         # get a sort of hackish id
         uniqueID = self.handler.ksID
         self.handler.ksVGMapping[vgd.vgname] = uniqueID

SECOND OPTION:
--- ../FC-D/kickstart.py	2007-03-08 19:43:45.000000000 +0100
+++ kickstart.py	2007-03-16 19:07:40.000000000 +0100
@@ -257,6 +257,11 @@
         elif (lvd.percent <= 0 or lvd.percent > 100) and not lvd.preexist:
             raise KickstartValueError, formatErrorMsg(self.lineno,
msg="Percentage must be between 0 and 100")
 
+        if "-" in lvd.name:
+            #We can also change it and not fail.
+            lvd.name.replace("-","t") 
+
+
         request = partRequests.LogicalVolumeRequestSpec(filesystem,
                                       format = lvd.format,
                                       mountpoint = lvd.mountpoint,
@@ -610,6 +615,10 @@
         self.handler.ksVGMapping[vgd.vgname] = uniqueID
         self.handler.ksID += 1
             
+        if "-" in vgd.vgname:
+            #We can also change it and not fail.
+            vgd.vgname.replace("-","t") 
+
         request = partRequests.VolumeGroupRequestSpec(vgname = vgd.vgname,
                                                       physvols = pvs,
                                                       preexist = vgd.preexist,



-- Additional comment from eric-bugs@omnifarious.org on 2007-03-16 19:15 EST --
This is great, except I have LV names already that have -'s in them.  Right now
what I have to do is hand-edit the fstab file after installation to make them
show up in the right place.  I'd prefer not to have to do that.


-- Additional comment from jgranado@redhat.com on 2007-03-27 08:14 EST --
I had misunderstood the exact situation.  The mishandling of the LVM names
happens not only with new kickstart names but also can happen with inside the
partition gui with preexisting lvm structures.  With this in mind I propose
another patch that informs the user instead of spitting out an ugly trace back.
The problem is not fixed but anaconda does not die if this situation presents
itself. FYI Im working on FC7.
The diff is attached.


-- Additional comment from jgranado@redhat.com on 2007-03-27 08:18 EST --
Created an attachment (id=151023)
partitions.py diff

It doesn't solve the proble but it avoids an  ugly trace back when the
situation presents itself.

-- Additional comment from jgranado@redhat.com on 2007-03-27 12:12 EST --
Created an attachment (id=151045)
patch trying to solve issue with "-" in lvm names

It worked for all my test cases.  I tried to install using kickstart, there
seemed to be no problem.  I tried with kickstart and the installation ended
smoothly as well.  I tested for logical volumes and volume groups that had ht
"-" character in there names.


-- Additional comment from clumens@redhat.com on 2007-08-15 11:27 EST --
*** Bug 250409 has been marked as a duplicate of this bug. ***

-- Additional comment from creitz@gmail.com on 2007-10-25 10:37 EST --
On a related note: the lv-config GUI in anaconda does not allow - in the name, 
system-config-lvm and lvcreate do.  All of these should match so that this isn't
a problem later.  We have somebody who creates a standard naming scheme for our
servers based on what he sets up with lvcreate... then we can't conform to that
naming scheme using anaconda's lvm configurator.

-- Additional comment from msivak@redhat.com on 2008-01-30 09:18 EST --
*** Bug 407701 has been marked as a duplicate of this bug. ***
Comment 1 Chris Lumens 2008-02-16 13:05:57 EST
*** Bug 428607 has been marked as a duplicate of this bug. ***
Comment 2 Alasdair Kergon 2008-03-19 09:53:39 EDT
In case it's not obvious, the algorithm to convert an LV name into a kernel
mapped device name (visible directly in /dev/mapper) works like this:
  replace every '-' in the VG name with '--'
  replace every '-' in the LV name with '--'
  concatenate VG name and LV name placing a single '-' between them

To reverse the process, starting from the left, if you see *two* hyphens, delete
one of them and move to the next character; if you see *one* hyphen not followed
by another then split the string at that point into VG name and LV name.  (LV
names are not permitted to begin with a hyphen, and the lvm2 tools enforce this.)
Comment 3 Alasdair Kergon 2008-03-19 10:09:28 EDT
And in case there are other problems lurking, the characters allowed in VG and
LV names are:  a-z A-Z 0-9 + _ . -

Neither a VG nor an LV can begin with a hyphen.

There are also various reserved names.

A VG cannot be called anything that appears in 'ls /dev' at the time it is
created (including '.' and '..' of course).

An LV can also not be called '.' or '..'.
A new LV cannot begin with the strings 'snapshot' or 'pvmove'.
It may not contain the strings '_mlog' or '_mimage'.
Additional reserved strings are likely to be added over time.

Pre-existing LVs may be found with these names, and the tools will normally cope
adequately.  (Internally-generated LVs do use these reserved names - that's why
they are reserved.)
Comment 4 Joel Andres Granados 2008-05-27 05:41:29 EDT
commit 6b8ef69abd2f581f9f0a64af5998a6e2abe42b33 from rawhide solves this problem.
Comment 5 Joel Andres Granados 2008-06-09 11:58:21 EDT
should be fixed in anaconda 11.1.2.113, commit
40a5a4badc960a221ffd54a5acae025265bf6a00
Comment 6 Joel Andres Granados 2008-06-09 11:59:11 EDT
ups!! its anaconda 11.1.2.114 and the commit number is in rhel5 branch.
Comment 7 RHEL Product and Program Management 2008-06-12 16:29:11 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 10 Alexander Todorov 2008-11-10 09:21:08 EST
5.3 snap #2 doesn't allow to install with VG or LV names containing "-".

Testing with previous install where I did:
lvrename /dev/VolGroup00/LogVol00 /dev/VolGroup00/Log-Vol00

Anaconda didn't crash and I was able to assign a mount point for the logical volume. After install /dev/mapper/VolGroup00-Log--Vol00 was mounted under /
Comment 12 errata-xmlrpc 2009-01-20 16:36:57 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0164.html

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