Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 882963

Summary: anaconda crashes with gpt_read() assertion failure despite explicit "clearpart"
Product: Red Hat Enterprise Linux 5 Reporter: Philip Rowlands <bugzilla>
Component: partedAssignee: Brian Lane <bcl>
Status: CLOSED WONTFIX QA Contact: Release Test Team <release-test-team-automation>
Severity: high Docs Contact:
Priority: high    
Version: 5.9CC: fkrska
Target Milestone: rc   
Target Release: 5.10   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-01 00:18:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Compressed GPT which causes the crash none

Description Philip Rowlands 2012-12-03 13:57:18 UTC
In bug 530465, which was CLOSED WONTFIX, the suggested workaround was to use clearpart to clear the existing partition table. This doesn't work.

This affects the version of anaconda shipped with rhel-server-5.9-x86_64-dvd.iso, RHEL 5.9 beta.

The hardware is a Proliant DL580 G7 with Smart Array controller, rebuilding a host which previously had a GUID Partition Table.

The exact error message displayed is:
Assertion ((PedSector) PED_LE64_TO_CPU
(gpt->AlternateLBA) <= disk->dev->length -1)
at gpt.c:815 in function gpt_read() failed.

The relevant snippet of kickstart config file is:
bootloader
zerombr
clearpart --initlabel --drives=cciss/c0d0

/tmp/anaconda.log up to the point of the crash:
13:26:04 INFO    : moving (1) to step partitionobjinit
13:26:04 INFO    : ISCSID is /usr/sbin/iscsid
13:26:04 INFO    : no initiator set
13:26:04 INFO    : no /tmp/fcpconfig; not configuring zfcp
13:26:04 DEBUG   : starting mpaths
13:26:04 DEBUG   : self.driveList(): ['cciss/c0d0']
13:26:04 DEBUG   : DiskSet.skippedDisks: []
13:26:04 DEBUG   : DiskSet.skippedDisks: []
13:26:04 DEBUG   : done starting mpaths.  Drivelist: ['cciss/c0d0']
13:26:04 INFO    : Reinitializing label for drive cciss/c0d0
13:26:04 CRITICAL: parted exception: Bug: Assertion ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA) <= disk->dev->length - 1) at gpt.c:815 in function gpt_read() failed.

What I expected to happen was that the combination of zerombr and clearpart commands in the kickstart file would unconditionally wipe and repartition the disk.

anaconda should not rely on known-buggy parted code to perform the documented "clearpart" workaround.

Comment 1 Philip Rowlands 2012-12-03 14:02:00 UTC
Created attachment 656646 [details]
Compressed GPT which causes the crash

The attached file is the result of running
dd bs=512 count=2000 if=/dev/cciss/c0d0 of=/tmp/bad-gpt
on the affected server.

The problem can be reproduced using the latest RHEL 5 parted binary from package parted-1.8.1-29.el5:
$ parted bad-gpt print

Comment 3 RHEL Program Management 2013-05-01 06:50:28 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 4 Brian Lane 2013-06-01 00:18:33 UTC
I am not sure why clearpart was previously suggested. parted is used to scan the disks before we ever think about making changes to them and this bug is likely related to the various label probing issues that have been fixed in newer versions.

The right way to make sure the disk can be used is to zero out the start of the disk with:

dd if=/dev/zero of=/dev/whatever bs=1M count=10

Note that this will result in data loss if there is anything you care about on the disk.

Comment 5 Philip Rowlands 2013-06-01 11:27:03 UTC
"If zerombr is specified any invalid partition tables found on disks are initialized. This destroys all of the contents of disks with invalid partition tables."

It's strange that the option which explicitly deals with invalid partition tables can only handle certain types of invalid partition table, i.e. those which libparted can read, and won't crash on.

Perhaps zerombr should get first shot at the disk(s)?

Comment 6 Brian Lane 2013-06-03 18:47:53 UTC
That isn't possible, the disks need to be examined before we touch them.