Bug #4098
closedGNU parted "crash" (well, sort of)
100%
Description
When running parted on my eSATA-connected hard drive I get the following output:
---
$ sudo parted /dev/dsk/c5d0 GNU Parted 1.8.8 Using /dev/dsk/c5d0 Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print print Backtrace has 7 calls on stack: 7: /usr/lib/libparted.so.8'ped_assert+0x33 [0xfeef5be7] 6: /usr/lib/libparted.so.8'gpt_read+0x13a [0xfef31546] 5: /usr/lib/libparted.so.8'ped_disk_new+0x93 [0xfeef9d8f] 4: /usr/sbin/parted'do_print+0x84 [0x8056fe8] 3: /usr/sbin/parted'interactive_mode+0xe3 [0x805c0a3] 2: /usr/sbin/parted'main+0x56 [0x805959a] 1: /usr/sbin/parted'_start+0x7d [0x8054d0d] You found a bug in GNU Parted! Here's what you have to do: Don't panic! The bug has most likely not affected any of your data. Help us to fix this bug by doing the following: Check whether the bug has already been fixed by checking the last version of GNU Parted that you can find at: http://ftp.gnu.org/gnu/parted/ Please check this version prior to bug reporting. If this has not been fixed yet or if you don't know how to check, please visit the GNU Parted website: http://www.gnu.org/software/parted for further information. Your report should contain the version of this release (1.8.8) along with the error message below, the output of parted DEVICE unit co print unit s print and the following history of commands you entered. Also include any additional information about your setup you consider important. Assertion ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA) <= disk->dev->length - 1) at unknown:0 in function unknown() failed. Ignore/Cancel? i i Backtrace has 8 calls on stack: 8: /usr/lib/libparted.so.8'ped_assert+0x33 [0xfeef5be7] 7: /usr/lib/libparted.so.8'_parse_header+0x171 [0xfef30e61] 6: /usr/lib/libparted.so.8'gpt_read+0x179 [0xfef31585] 5: /usr/lib/libparted.so.8'ped_disk_new+0x93 [0xfeef9d8f] 4: /usr/sbin/parted'do_print+0x84 [0x8056fe8] 3: /usr/sbin/parted'interactive_mode+0xe3 [0x805c0a3] 2: /usr/sbin/parted'main+0x56 [0x805959a] 1: /usr/sbin/parted'_start+0x7d [0x8054d0d] You found a bug in GNU Parted! Here's what you have to do: Don't panic! The bug has most likely not affected any of your data. Help us to fix this bug by doing the following: Check whether the bug has already been fixed by checking the last version of GNU Parted that you can find at: http://ftp.gnu.org/gnu/parted/ Please check this version prior to bug reporting. If this has not been fixed yet or if you don't know how to check, please visit the GNU Parted website: http://www.gnu.org/software/parted for further information. Your report should contain the version of this release (1.8.8) along with the error message below, the output of parted DEVICE unit co print unit s print and the following history of commands you entered. Also include any additional information about your setup you consider important. Assertion (last_usable <= disk->dev->length) at unknown:0 in function unknown() failed. Ignore/Cancel? i i Error: Can't have a partition outside the disk! Error: Can't have a partition outside the disk! (parted) q q
--- "iostat -E" says the following about the attached disk:
---
cmdk0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0 Model: WDC WD3200BEVT- Revision: Serial No: WD-WXE508N Size: 320,07GB <320070352896 bytes> Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0 Illegal Request: 0
---
The kernel can apparently read the GPT partition table properly, as evidenced by the output of a small utility that I wrote myself, which simply issues the DKIOCEXTPARTINFO IOCTL and displays the result:
---
$ sudo bin/getpartinfo /dev/rdsk/c5d0 p_start: 0 p_length: 625142448 $ sudo bin/getpartinfo /dev/rdsk/c5d0s0 p_start: 40 p_length: 409600 $ sudo bin/getpartinfo /dev/rdsk/c5d0s1 p_start: 409640 p_length: 272629761 $ sudo bin/getpartinfo /dev/rdsk/c5d0s2 p_start: 273301545 p_length: 104857601 $ sudo bin/getpartinfo /dev/rdsk/c5d0s3 p_start: 378421290 p_length: 104857601 $ sudo bin/getpartinfo /dev/rdsk/c5d0s4 p_start: 483541035 p_length: 104857601 $ sudo bin/getpartinfo /dev/rdsk/c5d0s5 p_start: 588398636 p_length: 1954 $ sudo bin/getpartinfo /dev/rdsk/c5d0s6 p_start: 588400590 p_length: 35115235
---
This disk has the hybrid MBR/GPT partition scheme that Apple uses (formatted on a Mac), but I'm not sure that has anything to do with the bug.
The parted version is very recent (system was 'pkg update':ed to oi_151a8 a few days ago):
---
$ pkg info parted Namn: system/storage/parted Sammanfattning: GNU Parted - Partition Editor Beskrivning: GNU Parted is for the display and manipulation of disk partitions Kategori: System/Administration and Configuration Status: Installerat Utgivare: openindiana.org Version: 1.8.8 Kompilering släppt: 5.11 Gren: 0.151.1.8 Paketeringsdatum: 21 juli 2013 13:38:59 Storlek: 898.65 kB FMRI: pkg://openindiana.org/system/storage/parted@1.8.8,5.11-0.151.1.8:20130721T133859Z
---
(Apologies for the Swedish localization, but you probably understand.)
I do not know if this is a regression since I didn't ever attach this hard drive to OI until now.
This is the first time I report a bug here, so please get back to me if more info is needed. I put this category kernel/userland, which seemed to be the best match.
Updated by Ken Mays over 8 years ago
- Assignee set to OI illumos
- Difficulty set to Medium
- Tags changed from needs-triage to parted
Updated by Erik Larsson over 8 years ago
So I learned how to build OS components from illumos-gate and rebuilt libparted with some simple debug printouts:
$ sudo parted /dev/rdsk/c5d0 GNU Parted 1.8.8 Using /dev/dsk/c5d0 Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print print [DEBUG] About to check assertion. [DEBUG] Alternate LBA: 625142447 [DEBUG] disk->dev->length: 625137408 Backtrace has 7 calls on stack: 7: /usr/lib/libparted.so.8'ped_assert+0x33 [0xfeeff824] 6: /usr/lib/libparted.so.8'gpt_read+0x102 [0xfef36c66] 5: /usr/lib/libparted.so.8'ped_disk_new+0xac [0xfef06f24] 4: /usr/sbin/parted'do_print+0x84 [0x8056fe8] 3: /usr/sbin/parted'interactive_mode+0xe3 [0x805c0a3] 2: /usr/sbin/parted'main+0x56 [0x805959a] 1: /usr/sbin/parted'_start+0x7d [0x8054d0d] You found a bug in GNU Parted! Here's what you have to do: Don't panic! The bug has most likely not affected any of your data. Help us to fix this bug by doing the following: Check whether the bug has already been fixed by checking the last version of GNU Parted that you can find at: http://ftp.gnu.org/gnu/parted/ Please check this version prior to bug reporting. If this has not been fixed yet or if you don't know how to check, please visit the GNU Parted website: http://www.gnu.org/software/parted for further information. Your report should contain the version of this release (1.8.8) along with the error message below, the output of parted DEVICE unit co print unit s print and the following history of commands you entered. Also include any additional information about your setup you consider important. Assertion ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA) <= disk->dev->length - 1) at ../common/libparted/labels/gpt.c:839 in function gpt_read() failed.
So disk->dev->length is definitely less than the alternate LBA. However disk->dev->length is incorrect, as evidenced by the kernel itself:
$ sudo getpartinfo /dev/rdsk/c5d0 p_start: 0 p_length: 625142448
I don't know where parted gets the number 625137408 which is 5040 sectors less than the correct value.
Updated by Erik Larsson over 8 years ago
Update: I now know where the number 625137408 comes from. There seems to be some disagreement within the kernel regarding the size/capacity of this hard drive.
For /dev/rdsk/c5d0 DKIOCGMEDIAINFO says 625137408, while DKIOCEXTPARTINFO says 625142448 (which is correct).
Notably, DKIOCGMEDIAINFOEXT does not work for this particular device, which is also strange.
Also the eSATA device is not AHCI-connected due to some limitation in the controller.
In Linux (on the same hardware), the device size is consistently shown as 625142448 sectors. E.g.
$ sudo parted /dev/sde GNU Parted 2.3 Använder /dev/sde Välkommen till GNU Parted! Skriv "hjälp" för att visa en lista över kommandon. (parted) unit s (parted) print Modell: ATA WDC WD3200BEVT-2 (scsi) Disk /dev/sde: 625142448s Sektorstorlek (logisk/fysisk): 512B/512B Partitionstabell: gpt Nummer Början Slut Storlek Filsystem Namn Flaggor 1 40s 409639s 409600s fat32 EFI System Partition startbar 2 409640s 273039400s 272629761s hfs+ Apple_HFS_Untitled_2 3 273301545s 378159145s 104857601s hfs+ Apple_HFSX_Untitled_2 4 378421290s 483278890s 104857601s ntfs Untitled 2 5 483541035s 588398635s 104857601s hfs+ Apple_HFS_Untitled_2 6 588398636s 588400589s 1954s bios_grub 7 588400590s 623515824s 35115235s ext4 8 623515825s 625142414s 1626590s linux-swap(v1)
...and no problem is detected.
In addition, I can access the last sector of the device from within OpenIndiana:
$ sudo dd if=/dev/rdsk/c5d0 of=lastsector bs=512 skip=625142447 count=1 Password: 1+0 records in 1+0 records out 512 bytes (512 B) copied, 0,0352888 s, 14,5 kB/s
...but not the sector after the last sector:
$ sudo dd if=/dev/rdsk/c5d0 of=lastsector bs=512 skip=625142448 count=1 0+0 records in 0+0 records out 0 bytes (0 B) copied, 6,7277e-05 s, 0,0 kB/s
So the value returned by DKIOCGMEDIAINFO is clearly incorrect.
Updated by Erik Larsson over 8 years ago
...and as a final piece of info, when this hard drive is attached to OI with a USB connection, everything works as expected i.e. DKIOCGMEDIAINFO returns the correct number of sectors:
$ sudo getmediainfo /dev/rdsk/c4t0d0 dki_media_type: DK_FIXED_DISK (0x10001) dki_lbsize: 512 dki_capacity: 625142448 dki_pbsize: 512 $ sudo getpartinfo /dev/rdsk/c4t0d0 p_start: 0 p_length: 625142448
...and parted works as well. So the problem should lie in the storage driver that takes care of the (non-AHCI) eSATA connection.
Updated by Ken Mays over 7 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
Fixed for Hipster 2014.1.