Parted can't handle lack of space between logical partitions

Bug #1543704 reported by antoni helms
50
This bug affects 7 people
Affects Status Importance Assigned to Milestone
parted (Debian)
New
Unknown
parted (Ubuntu)
Confirmed
High
Unassigned

Bug Description

message as follows

Libparted bug found!
Assertion (metadata_length > 0) at ../../../libparted/labels/dos.c:2313 in function add_logical_part_metadata() failed.

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

If I recall correctly this is an old problem that was fixed in newer versions of the libparted library used by GParted.

I assume that you are running on an older version of Ubuntu. If you only wish to use the latest version of GParted, you might try booting from media containing GParted Live.

http://gparted.org/livecd.php

Revision history for this message
Phillip Susi (psusi) wrote :

Actually Curtis, there have been a few reports of this upstream recently. It seems that some partitioning tool out there likes to start logical volumes on the very first sector following the previous logical volume, rather than leaving one or two sectors to hold the EBR, and instead locate the EBR for that volume somewhere else. libparted can't deal with this.

antoni helms, if you could add the output of fdisk -l that would help confirm that is the case here. Also if you can tell us what sort of partitioning tools you have been using to get the disk into this state that might be helpful.

Revision history for this message
antoni helms (tonythetech) wrote :

Thanks Philip attached is screenshot of output of fdisk -l

BTW I am running Ubuntu 15.10

Revision history for this message
Phillip Susi (psusi) wrote :

Yep: sdb6 abd sdb7 have no space between then. How did you create these partitions?

Revision history for this message
antoni helms (tonythetech) wrote :

I have uses Easus Partitionmanager in Windows

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gparted (Ubuntu):
status: New → Confirmed
Revision history for this message
Ed Broadley (rebroad+ubuntu) wrote :

Also, getting this error. fdisk output:-

Disk /dev/sdb: 931.5 GiB, 1000170586112 bytes, 1953458176 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
Disklabel type: dos
Disk identifier: 0x00016dec

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 767444991 767442944 366G f W95 Ext'd (LBA)
/dev/sdb2 767447040 1032615935 265168896 126.5G 7 HPFS/NTFS/exFAT
/dev/sdb4 1032615936 1953458175 920842240 439.1G 83 Linux
/dev/sdb5 4096 735139839 735135744 350.6G 83 Linux
/dev/sdb6 735139840 763346943 28207104 13.5G 83 Linux
/dev/sdb7 763348992 767444991 4096000 2G b W95 FAT32

Partition table entries are not in disk order.

Revision history for this message
Ed Broadley (rebroad+ubuntu) wrote :

I'm using Ubuntu 15.10

Revision history for this message
Nishihama Kenkowo (hitobashira) wrote :

I had similar, before 4Weeks, in ubuntu 16.04 beta.

Assertion (metadata_length > 0) at ../../../libparted/labels/dos.c:2313 in function add_logical_part_metadata() failed.

----
libparted : 3.2
======================
Backtrace has 15 calls on stack:
  15: /lib/x86_64-linux-gnu/libparted.so.2(ped_assert+0x44) [0x7f23bb7fdea4]
  14: /lib/x86_64-linux-gnu/libparted.so.2(+0x1e45f) [0x7f23bb81145f]
  13: /lib/x86_64-linux-gnu/libparted.so.2(+0xf8ba) [0x7f23bb8028ba]
  12: /lib/x86_64-linux-gnu/libparted.so.2(ped_disk_add_partition+0x25f) [0x7f23bb8031af]
  11: /lib/x86_64-linux-gnu/libparted.so.2(+0x1dd4f) [0x7f23bb810d4f]
  10: /lib/x86_64-linux-gnu/libparted.so.2(+0x1dde0) [0x7f23bb810de0]
  9: /lib/x86_64-linux-gnu/libparted.so.2(+0x1dd89) [0x7f23bb810d89]
  8: /lib/x86_64-linux-gnu/libparted.so.2(+0x1ed75) [0x7f23bb811d75]
  7: /lib/x86_64-linux-gnu/libparted.so.2(ped_disk_new+0x48) [0x7f23bb802dd8]
  6: /usr/sbin/gpartedbin() [0x466c0e]
  5: /usr/sbin/gpartedbin() [0x47555e]
  4: /usr/lib/x86_64-linux-gnu/libglibmm-2.4.so.1(+0x4e67d) [0x7f23bcd0e67d]
  3: /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x70b45) [0x7f23bbcc6b45]
  2: /lib/x86_64-linux-gnu/libpthread.so.0(+0x76fa) [0x7f23bab376fa]
  1: /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f23ba86d2dd]
Assertion (metadata_length > 0) at ../../../libparted/labels/dos.c:2313 in function add_logical_part_metadata() failed.
Aborted (core dumped)

----
$ sudo fdisk -l /dev/sda
Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 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
Disklabel type: dos
Disk identifier: 0x50632122

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 14336 209728574 209714239 100G 7 HPFS/NTFS/exFAT
/dev/sda2 209729536 250689535 40960000 19.5G 3 XENIX usr
/dev/sda3 250689536 291650473 40960938 19.5G 3 XENIX usr
/dev/sda4 291651583 500100343 208448761 99.4G f W95 Ext'd (LBA)
/dev/sda5 291651646 332625887 40974242 19.6G 83 Linux
/dev/sda6 332625888 353108699 20482812 9.8G 7 HPFS/NTFS/exFAT
/dev/sda7 353112064 500100343 146988280 70.1G 83 Linux

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

@Nishihama ,

This issue is caused when there is less than two unallocated sectors between logical partitions. The Extended Boot Record is stored in the unallocated sector area. In your situation the problem arises with sda5 and sda6 sda5.

332625887 end of sda5
332625888 start of sda6

The source of the crash is in the libparted library, and hence will show up with partition tools that use libparted, such as parted or gparted.

This issue was also reported in upstream Debian. See:

Debian Bug report logs - #819488 gparted crash with a libparted backtrace
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=819488

Phillip Susi (psusi)
affects: gparted (Ubuntu) → parted (Ubuntu)
summary: - Gparted crashed on loading
+ Parted can't handle lack of space between logical partitions
Changed in parted (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → High
Revision history for this message
V字龍(Vdragon) (vdragon) wrote :

Hi, I encountered the same issue however I merely just fix the wrong order of logical partition using fdisk.

Revision history for this message
V字龍(Vdragon) (vdragon) wrote :

Here's the details and reproducible steps on Parted mailinglist:
http://lists.gnu.org/archive/html/bug-parted/2016-07/msg00001.html

Interestingly, while

Number Start End Size Type File system Flags
 1 1s 204799s 204799s extended lba
 6 3s 202751s 202749s logical
 5 202752s 204799s 2048s logical

does lack of space between logical partitions Parted doesn't complain, while after I fix the order of partitions using fdisk like this

Device Start End Sectors Size Id Type
1 1 204799 204799 100M f W95 Ext'd (LBA)
5 3 202751 202749 99M 83 Linux
6 202752 204799 2048 1M 83 Linux

Parted starts to crash...

Revision history for this message
V字龍(Vdragon) (vdragon) wrote :

BTW,
Number Start End Size Type File system Flags
 1 1s 204799s 204799s extended lba
 6 3s 202751s 202749s logical
 5 202752s 204799s 2048s logical

is actually entirely produced built by Parted.

Revision history for this message
JEMYZHANG (jemy-zhang) wrote :

I was encounter with this problem after I fix disk order with fdisk.

**before fix:**
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xee678789

设备 启动 Start 末尾 扇区 Size Id 类型
/dev/sda1 * 2048 62916607 62914560 30G 83 Linux
/dev/sda3 62916608 976773119 913856512 435.8G f W95 扩展 (LBA)
/dev/sda5 79720448 976773119 897052672 427.8G 83 Linux
/dev/sda6 62918656 79720447 16801792 8G 82 Linux 交换 / Solaris

Partition table entries are not in disk order.

**after fix:**
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xee678789

设备 启动 Start 末尾 扇区 Size Id 类型
/dev/sda1 * 2048 62916607 62914560 30G 83 Linux
/dev/sda3 62916608 976773119 913856512 435.8G f W95 扩展 (LBA)
/dev/sda5 62918656 79720447 16801792 8G 82 Linux 交换 / Solaris
/dev/sda6 79720448 976773119 897052672 427.8G 83 Linux

**backtrace of gparted**
======================
libparted : 3.2
======================
Backtrace has 15 calls on stack:
  15: /lib/x86_64-linux-gnu/libparted.so.2(ped_assert+0x44) [0x7fa92ca88ea4]
  14: /lib/x86_64-linux-gnu/libparted.so.2(+0x1e45f) [0x7fa92ca9c45f]
  13: /lib/x86_64-linux-gnu/libparted.so.2(+0xf8ba) [0x7fa92ca8d8ba]
  12: /lib/x86_64-linux-gnu/libparted.so.2(ped_disk_add_partition+0x25f) [0x7fa92ca8e1af]
  11: /lib/x86_64-linux-gnu/libparted.so.2(+0x1dd4f) [0x7fa92ca9bd4f]
  10: /lib/x86_64-linux-gnu/libparted.so.2(+0x1dde0) [0x7fa92ca9bde0]
  9: /lib/x86_64-linux-gnu/libparted.so.2(+0x1dd89) [0x7fa92ca9bd89]
  8: /lib/x86_64-linux-gnu/libparted.so.2(+0x1ed75) [0x7fa92ca9cd75]
  7: /lib/x86_64-linux-gnu/libparted.so.2(ped_disk_new+0x48) [0x7fa92ca8ddd8]
  6: /usr/sbin/gpartedbin() [0x466c0e]
  5: /usr/sbin/gpartedbin() [0x47555e]
  4: /usr/lib/x86_64-linux-gnu/libglibmm-2.4.so.1(+0x4e67d) [0x7fa92df9967d]
  3: /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x70bc5) [0x7fa92cf51bc5]
  2: /lib/x86_64-linux-gnu/libpthread.so.0(+0x76fa) [0x7fa92bdc26fa]
  1: /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7fa92baf8b5d]
Assertion (metadata_length > 0) at ../../../libparted/labels/dos.c:2313 in function add_logical_part_metadata() failed.
Aborted (core dumped)

Revision history for this message
Roberto Pogliani (roberto321) wrote :

I tested a workaround that seems to be good till when this bug will officially fixed
I am installing Ubuntu 16.04.1
When mooving a partition with gparted I got the same bug:
metadata_length > 0, add_logical_part_metadata() failed
After reading your comments, I edited the partition and put a small unallocated space after partition, just 2MB
In this way partition has been moved and resized correctly without errors

Changed in parted (Debian):
status: Unknown → New
Revision history for this message
anatoly techtonik (techtonik) wrote :

I am facing this bug as well. =(

Device Boot Start End Sectors Size Id Type
/dev/loop22p1 2048 3074047 3072000 1.5G 27 Hidden NTFS WinRE
/dev/loop22p2 3074088 55119014 52044927 24.8G 7 HPFS/NTFS/exFAT
/dev/loop22p3 55119015 488392064 433273050 206.6G 5 Extended
/dev/loop22p5 * 55119078 56179304 1060227 517.7M 83 Linux
/dev/loop22p6 56179368 76437269 20257902 9.7G 83 Linux
/dev/loop22p7 97755588 102253724 4498137 2.1G 82 Linux swap / Solaris
/dev/loop22p8 102253788 488392064 386138277 184.1G 83 Linux
/dev/loop22p9 76437271 97754901 21317631 10.2G 8e Linux LVM

Partition table entries are not in disk order.
techtonik@SONiC:/etc$ sudo parted /dev/sda unit s print
Backtrace has 15 calls on stack:
  15: /lib/x86_64-linux-gnu/libparted.so.2(ped_assert+0x45) [0x7f91f89d36e5]
  14: /lib/x86_64-linux-gnu/libparted.so.2(+0x2216b) [0x7f91f89ea16b]
  13: /lib/x86_64-linux-gnu/libparted.so.2(+0x101ea) [0x7f91f89d81ea]
  12: /lib/x86_64-linux-gnu/libparted.so.2(ped_disk_add_partition+0x2d3) [0x7f91f89d8b53]
  11: /lib/x86_64-linux-gnu/libparted.so.2(+0x219f8) [0x7f91f89e99f8]
  10: /lib/x86_64-linux-gnu/libparted.so.2(+0x21b60) [0x7f91f89e9b60]
  9: /lib/x86_64-linux-gnu/libparted.so.2(+0x21b60) [0x7f91f89e9b60]
  8: /lib/x86_64-linux-gnu/libparted.so.2(+0x21bf9) [0x7f91f89e9bf9]
  7: /lib/x86_64-linux-gnu/libparted.so.2(+0x22a35) [0x7f91f89eaa35]
  6: /lib/x86_64-linux-gnu/libparted.so.2(ped_disk_new+0x46) [0x7f91f89d86f6]
  5: parted(+0x7794) [0x5636dc478794]
  4: parted(non_interactive_mode+0xa2) [0x5636dc47e532]
  3: parted(main+0x121e) [0x5636dc4772be]
  2: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f91f8171b97]
  1: parted(_start+0x2a) [0x5636dc47748a]

Revision history for this message
anatoly techtonik (techtonik) wrote :

Oops. This is the correct `sudo fdisk -l -u` table for /dev/sda

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2000895 1998848 976M 83 Linux
/dev/sda2 2002942 392624127 390621186 186.3G 5 Extended
/dev/sda3 1759543296 3907026943 2147483648 1T 83 Linux
/dev/sda5 2002944 163719167 161716224 77.1G 83 Linux
/dev/sda6 163721216 197314559 33593344 16G 82 Linux swap / Solaris
/dev/sda7 197314560 392624127 195309568 93.1G 83 Linux

Partition table entries are not in disk order.

Revision history for this message
Joe le Kiffeur (joelekiffeur) wrote :

I confirmed on Ubuntu 19.10.
Also, I can't use GParted in as Clonezilla live ISO.

Changed in parted (Ubuntu):
status: Triaged → Confirmed
assignee: nobody → Joe le Kiffeur (joelekiffeur)
assignee: Joe le Kiffeur (joelekiffeur) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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