Bug 150630

Summary: traceback on boot loader install grubbyDiskName
Product: [Fedora] Fedora Reporter: Charles R. Anderson <cra>
Component: bootyAssignee: Anaconda Maintenance Team <anaconda-maint-list>
Status: CLOSED RAWHIDE QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: clumens
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-03-09 20:20:37 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:

Description Charles R. Anderson 2005-03-08 23:48:39 UTC
Description of problem:

Anaconda crashes during boot loader install.  Traceback in grubbyDiskName.

Version-Release number of selected component (if applicable):
10.2.0.27-1

How reproducible:
Did not try

Steps to Reproduce:
1. Custom install
2. Auto partition, but deleted and rearranged/renamed LVM partitions
3. Complete install until boot loader install stage
  
Actual results:

Traceback (most recent call last):
  File "/usr/src/build/536412-i386/install//usr/lib/anaconda/gui.py", line 1128,
in handleRenderCallback
    self.currentWindow.renderCallback()
  File
"/usr/src/build/536412-i386/install//usr/lib/anaconda/iw/progress_gui.py", line
242, in renderCallback
    self.intf.icw.nextClicked()
  File "/usr/src/build/536412-i386/install//usr/lib/anaconda/gui.py", line 872,
in nextClicked
    self.dispatch.gotoNext()
  File "/usr/src/build/536412-i386/install//usr/lib/anaconda/dispatch.py", line
173, in gotoNext
    self.moveStep()
  File "/usr/src/build/536412-i386/install//usr/lib/anaconda/dispatch.py", line
241, in moveStep
    rc = apply(func, self.bindArgs(args))
  File "/usr/src/build/536412-i386/install//usr/lib/anaconda/bootloader.py",
line 146, in writeBootloader
    justConfigFile, intf)
  File "/usr/src/build/532685-i386/install//usr/lib/booty/bootloaderInfo.py",
line 1096, in write
    justConfig | (not self.useGrubVal))
  File "/usr/src/build/532685-i386/install//usr/lib/booty/bootloaderInfo.py",
line 835, in writeGrub
    f.write("(%s)     /dev/%s\n" % (self.grubbyDiskName(drive),
  File "/usr/src/build/532685-i386/install//usr/lib/booty/bootloaderInfo.py",
line 917, in grubbyDiskName
    return "hd%d" % self.drivelist.index(name)
ValueError: list.index(x): x not in list

Local variables in innermost frame:
self: <bootloaderInfo.x86BootloaderInfo instance at 0xb7b5694c>
name: VGSystem/LVRoot

Expected results:


Additional info:

/tmp/anaconda.log:
[...]
* pv is /dev/hda2 in vg VolGroup00, size is 38016
* lvm vgremove VolGroup00
* lvm pvremove /dev/hda2
* lvm pvcreate -ff -y -v /dev/hda2
* formatting swap as swap
* formatting None as physical volume (LVM)
* formatting None as physical volume (LVM)
* formatting None as physical volume (LVM)
* formatting / as ext3
* Format command:  ['/usr/sbin/mke2fs', '/dev/VGSystem/LVRoot', '-i', '4096', '-j']

* formatting /boot as ext3
* Format command:  ['/usr/sbin/mke2fs', '/tmp/hda1', '-i', '4096', '-j']

* formatting /home as ext3
* Format command:  ['/usr/sbin/mke2fs', '/dev/VGSystem/LVHome', '-i', '4096', '-j']

* trying to mount VGSystem/LVRoot on /
* isys.py:mount()- going to mount /dev/VGSystem/LVRoot on /mnt/sysimage
* trying to mount hda1 on /boot
* isys.py:mount()- going to mount /tmp/hda1 on /mnt/sysimage/boot
* trying to mount VGSystem/LVHome on /home
[...]
* rhgb installed, adding to boot loader config
* no comps package found
* moving (1) to step writeconfig
* Writing main configuration
* moving (1) to step firstboot
* moving (1) to step instbootloader


/tmp/lvmout:
    Finding all logical volumes
 Invalid argument
  /etc/lvm/backup: fsync failed: Invalid argument
  Logical volume "LVSwap" created
  Adding physical volume '/dev/hda4' to volume group 'VGSystem'
    Archiving volume group "VGSystem" metadata.
    Creating volume group backup "/etc/lvm/backup/VGSystem"
  /etc/lvm/backup: fsync failed: Invalid argument
  Volume group "VGSystem" successfully created

Comment 1 Charles R. Anderson 2005-03-09 00:18:59 UTC
Problem appears to be this code in grubby.  Looks like the hack isn't going to
cut it anymore.

            for drive in devs:
                # XXX hack city.  If they're not the sort of thing that'll
                # be in the device map, they shouldn't still be in the list.
                if not drive.startswith('md') and not drive.startswith('Vol'):
                    f.write("(%s)     /dev/%s\n" % (self.grubbyDiskName(drive),
                                                drive))
            f.close()


Comment 2 Charles R. Anderson 2005-03-09 01:19:24 UTC
Moving this bug to booty component, version 0.49-1.  Some other problems are
apparent in the code w.r.t LVM device names.  E.g.:

# return (disk, partition number) eg ('hda', 1)
def getDiskPart(dev):

getDiskPart() is handed LVM partition names from right before the "XXX hack
city" code:

            for dev in devs:
                drive = getDiskPart(dev)[0]
                if usedDevs.has_key(drive):
                    continue
                usedDevs[drive] = 1
            devs = usedDevs.keys()
            devs.sort()
        
Those come from back further when rootDev is LVM:

       for dev in self.getPhysicalDevices(rootDev):
            usedDevs[dev] = 1

Should this function be handling LVM devices?

    def getPhysicalDevices(self, device):
        # This finds a list of devices on which the given device name resides.
        # Accepted values for "device" are raid1 md devices (i.e. "md0"),
        # physical disks ("hda"), and real partitions on physical disks
        # ("hda1").

The comment "# XXX hack city.  If they're not the sort of thing that'll        
       # be in the device map, they shouldn't still be in the list." seems to
suggest that it doesn't want LVM devices in the usedDevs list.