Verbatim USB stick crashes gParted

Bug #710696 reported by T Kortehisto
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gparted (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: gparted

If Verbatim Store'n'Go Pinstripe USB drive is mounted before starting gParted, gParted crashes after starting to scan for devices. If gParted is started before mounting the stick, everything works fine until you ask gParted to refresh devices at which point the program crashes without launching apport. I'm using ubuntu 10.10 64-bit. Here's what it says on the terminal:

======================
libparted : 2.3
======================
Backtrace has 15 calls on stack:
  15: /lib/libparted.so.0(ped_assert+0x31) [0x7f0547bdb5c1]
  14: /lib/libparted.so.0(+0x393b6) [0x7f0547c063b6]
  13: /lib/libparted.so.0(+0x39b33) [0x7f0547c06b33]
  12: /lib/libparted.so.0(+0x3a7ed) [0x7f0547c077ed]
  11: /lib/libparted.so.0(ped_disk_add_partition+0x1cb) [0x7f0547be1d3b]
  10: /lib/libparted.so.0(+0x3bd34) [0x7f0547c08d34]
  9: /lib/libparted.so.0(+0x3bf25) [0x7f0547c08f25]
  8: /lib/libparted.so.0(ped_disk_new+0x75) [0x7f0547be2815]
  7: /usr/sbin/gpartedbin() [0x44a7d4]
  6: /usr/sbin/gpartedbin() [0x457d21]
  5: /usr/sbin/gpartedbin() [0x477c97]
  4: /usr/lib/libglibmm-2.4.so.1(+0x383f2) [0x7f05466603f2]
  3: /lib/libglib-2.0.so.0(+0x697e4) [0x7f0545aa97e4]
  2: /lib/libpthread.so.0(+0x7971) [0x7f054508b971]
  1: /lib/libc.so.6(clone+0x6d) [0x7f0544de792d]
Assertion (head_size <= 63) at ../../../libparted/labels/dos.c:662 in function probe_partition_for_geom() failed.

Revision history for this message
Curtis Gedak (gedakc) wrote :

How large is this USB drive (e.g., 4 GiB)?
What file system is being used (e.g, FAT32, NTFS)?

What is the output from the following command:

   sudo parted /path-to-device unit s print

Where: /path-to-device is something like /dev/sdc
        This is the device location for the USB drive

Revision history for this message
T Kortehisto (kortehisto) wrote :

The drive is 4 GB and the filesystem was FAT32, the one which was on the drive after I took it out of the box.

Here's the output of the command you asked for (sudo parted /dev/sdb unit s print):
Model: Verbatim STORE N GO (scsi)
Disk /dev/sdb: 7831552s
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 2048s 7831551s 7829504s primary ext2

However, after submitting the bug report I used cfdisk to format the drive into linux filesystem.
Here's the output of the original filesystem, which crashed gParted. The command used is 'sudo fdisk -l'

Disk /dev/sdg: 4009 MB, 4009754624 bytes
23 heads, 23 sectors/track, 14804 cylinders
Units = cylinders of 529 * 512 = 270848 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3082e17

   Device Boot Start End Blocks Id System
/dev/sdg1 16 14805 3911744 c W95 FAT32 (LBA)

If you need more information of the original configuration of the drive, I should have another similar USB drive with same make&model, bought at the same time, lying somewhere.

Revision history for this message
Curtis Gedak (gedakc) wrote :

Since the drive now works with parted after being reformatted, I suspect a problem with the original formatting.

If you could find a similar drive for testing that would help. Otherwise we do not know exactly what the problem is.

The original report has the following line:

Assertion (head_size <= 63) at ../../../libparted/labels/dos.c:662 in function probe_partition_for_geom() failed.

This suggests to me that perhaps the device had an different or invalid geometry (e.g., Cylinders/Heads/Sectors), but that this was fixed when the device was reformatted.

Revision history for this message
T Kortehisto (kortehisto) wrote :

I agree, the problem was in the original formating of the drive.

I had to use the -z option with cfdisk to disregard the drive geometry in order to not get a fatal error closing the program right after it started. The error I got without -z option was 'FATAL ERROR: Bad primary partition' and after that something along the lines of partition being outside of disk.

Even if the drive now works, there's a quirk in its behaviour. When you unmount it in Nautilus-window, the drive just disappears and you are unable to mount it again in Nautilus unless you physically remove and reinsert the drive. My other drives stay visible in Nautilus' left sidebar even after being ejected so that they can be easily remounted if needed. However, the icon of the drive in the (location) Computer stays visible in the main window, but when chosen says 'Verbatim STORE N GO selected' but does nothing or sometimes provides a pop up window saying 'Could not display "/media/Verbatim". The file is of unknown type' and below that text are two buttons 'Select Application' and 'OK'.

Will post again if I get my hands on my second Verbatim 4 GB drive.

Revision history for this message
Curtis Gedak (gedakc) wrote :

If you do come across your second Verbatim drive, please also post the output from:

fdisk -l -u /path-to-device

That way we can see what fdisk thinks the geometry is on the drive.

Revision history for this message
T Kortehisto (kortehisto) wrote :

I found the second USB drive and it crashes gParted similarly to the first one.

sudo fdisk -l -u /dev/sdg

Disk /dev/sdg: 4007 MB, 4007657472 bytes
86 heads, 22 sectors/track, 4137 cylinders, total 7827456 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot Start End Blocks Id System
/dev/sdg1 8064 7827455 3909696 c W95 FAT32 (LBA)

Revision history for this message
T Kortehisto (kortehisto) wrote :

sudo parted /dev/sdg unit s print

Backtrace has 13 calls on stack:
  13: /lib/libparted.so.0(ped_assert+0x31) [0x7f24b01845c1]
  12: /lib/libparted.so.0(+0x393b6) [0x7f24b01af3b6]
  11: /lib/libparted.so.0(+0x39b33) [0x7f24b01afb33]
  10: /lib/libparted.so.0(+0x3a7ed) [0x7f24b01b07ed]
  9: /lib/libparted.so.0(ped_disk_add_partition+0x1cb) [0x7f24b018ad3b]
  8: /lib/libparted.so.0(+0x3bd34) [0x7f24b01b1d34]
  7: /lib/libparted.so.0(+0x3bf25) [0x7f24b01b1f25]
  6: /lib/libparted.so.0(ped_disk_new+0x75) [0x7f24b018b815]
  5: parted() [0x40698e]
  4: parted(non_interactive_mode+0x8c) [0x40c7cc]
  3: parted(main+0x63) [0x40ab13]
  2: /lib/libc.so.6(__libc_start_main+0xfe) [0x7f24af98cd8e]
  1: parted() [0x404fa9]

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 (2.3)
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 (head_size <= 63) at ../../../libparted/labels/dos.c:662 in function
probe_partition_for_geom() failed.

Aborted

Revision history for this message
Curtis Gedak (gedakc) wrote :

Thank you for reporting back with this information.

From the fdisk output in comment #6 it appears that this disk device is reporting 86 heads. From the current parted code, this is considered an invalid disk geometry. Even so, I do not think a program crash is a good response to this problem.

Since this problem is in the libparted library, it will affect all programs that use libparted, such as parted, gparted, qtparted, pyparted, etc.

Would you be able to report this problem to the Parted project?

http://www.gnu.org/software/parted/index.shtml

Bugs are reported to <email address hidden>

Revision history for this message
T Kortehisto (kortehisto) wrote :

I reported the bug to the email address you gave in post #8. Thanks for your help!

Revision history for this message
Curtis Gedak (gedakc) wrote :

Following are some relevant mailing list posts regarding this problem including the one by T Kortehisto:

Verbatim USB drive crashes libparted
http://lists.gnu.org/archive/html/bug-parted/2011-02/msg00000.html

Re: Bug report
http://lists.gnu.org/archive/html/bug-parted/2011-02/msg00002.html

[parted-devel] > 63 heads. Why does this keep coming up?
http://lists.alioth.debian.org/pipermail/parted-devel/2011-February/003796.html

Revision history for this message
Curtis Gedak (gedakc) wrote :

T Kortehisto,

I am curious. If you plug in this drive with it's default formatting, are you able to read and write to the drive using GNU/Linux? Windows? Other operating systems?

Revision history for this message
Curtis Gedak (gedakc) wrote :

One more request. Would you be able to provide a copy of the Master Boot Record which is contained in the first sector of the device?

You can capture the Master Boot Record in a file with the following command:

NOTE: Be extra careful to type this command in properly, otherwise loss of data could result.

  dd if=/dev/sdg of=sdg.mbr bs=512 count=1

where /dev/sdg is the USB device, and sdg.mbr is the name of the file that will need to be uploaded.

Revision history for this message
T Kortehisto (kortehisto) wrote :

Reply to the comment #9:
I can read and write to the drive in Ubuntu and Windows XP without any problems. Also Sony tv and bluray player handle reading from the drive, but I haven't tried to write onto the drive with either of them. I haven't tried other operating systems such as BSD or Mac as I have no acces to them.

Revision history for this message
T Kortehisto (kortehisto) wrote :

Here's the MBR of the USB drive, which I haven't reformatted.

Revision history for this message
Curtis Gedak (gedakc) wrote :

My analysis of the MBR can be found in the following bug-parted mailing list post:
http://lists.gnu.org/archive/html/bug-parted/2011-02/msg00013.html

For those not wishing to read the analysis, the summary is that the partition table is as follows:

Assuming my calculations are correct, a head_size of 157 sectors was determined. This is the number of sectors that would pass under a single disk head in a single rotation of the disk. Unfortunately this value is too large for the MBR specification (range is 1 to 63 sectors), and hence the partition table on the disk device is indeed invalid.

It would nice if parted/libparted were able to cleanly indicate that the partition table was invalid as opposed to throwing a stack trace.

In order for this to happen, the code for parted/libparted would need enhancement.

Parted is a separate project from GParted.
GParted benefits from and uses the libparted library from the Parted project.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.