partprobe reports 64 partitions on empty (loop) device

Bug #1759661 reported by TJ
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
parted (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

$ adduser $USER disk

# log-out/log-in

$ fallocate -l 1G test.img
$ fallocate -d test.img

$ ls -l /dev/loop?
brw-rw---- 1 root root 7, 0 Mar 28 20:20 /dev/loop0
brw-rw---- 1 root disk 7, 1 Mar 28 20:21 /dev/loop1
brw-rw---- 1 root disk 7, 2 Mar 15 13:23 /dev/loop2
brw-rw---- 1 root disk 7, 3 Mar 15 13:23 /dev/loop3
brw-rw---- 1 root disk 7, 4 Mar 15 13:23 /dev/loop4
brw-rw---- 1 root disk 7, 5 Mar 15 13:23 /dev/loop5
brw-rw---- 1 root disk 7, 6 Mar 15 13:23 /dev/loop6
brw-rw---- 1 root disk 7, 7 Mar 15 13:23 /dev/loop7

$ sudo losetup /dev/loop1 test.img

$ gdisk -l /dev/loop1
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.
Disk /dev/loop0: 2097152 sectors, 1024.0 MiB
Logical sector size: 512 bytes
Disk identifier (GUID): 697B7066-0381-4C4F-B2D1-46AECCF7C16F
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 2097118
Partitions will be aligned on 2048-sector boundaries
Total free space is 2097085 sectors (1024.0 MiB)

Number Start (sector) End (sector) Size Code Name

$ partprobe /dev/loop1
Error: Partition(s) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64 on /dev/loop0 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.

64 because libparted/arch/linux.c declares

#define MAX_NUM_PARTS 64

But in _disk_sync_part_table() this should reset lpn (largest partition number) to zero:

        if (strcmp (disk->type->name, "loop") == 0)
                  lpn = 0;

which should cause bad_part_list to be NULL rather than a list of bad partitions which are then reported to the user.

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

I'm not able to reproduce this on 16.04, what release are you using?

Changed in parted (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for parted (Ubuntu) because there has been no activity for 60 days.]

Changed in parted (Ubuntu):
status: Incomplete → Expired
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.