[Bug 1759661] [NEW] partprobe reports 64 partitions on empty (loop) device

TJ ubuntu at iam.tj
Wed Mar 28 19:29:10 UTC 2018


Public bug reported:

$ 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.

** Affects: parted (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to parted in Ubuntu.
https://bugs.launchpad.net/bugs/1759661

Title:
  partprobe reports 64 partitions on empty (loop) device

Status in parted package in Ubuntu:
  New

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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/parted/+bug/1759661/+subscriptions



More information about the foundations-bugs mailing list