Package: fdisk Version: 2.33.1-0.1 Severity: important I have created a GPT-partitioned image where the first partition needs to start at block 64. The problem is that fdisk/sfdisk is unable to replicate this partition layout using an sfdisk script, because the generated script doesn't work when it's read back in.
This seems to be a problem with interpreting the "table-length" value. It appears to be multiplied by 4 instead of divided by 4 when checking sector limits. # ls -l /tmp/bmb_root -rw-r--r-- 1 smurf smurf 1170228224 Jun 25 22:16 /tmp/bmb_root # bc bc 1.07.1 Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 1170228224/512-34 2285568 # cat /tmp/lb ### minimum/maximum working LBA values label: gpt label-id: 3C0E3DAC-3069-354E-BA0E-CB74029F5A5C device: /tmp/bmb_root unit: sectors table-length: 8 first-lba: 34 last-lba: 2285568 # sfdisk /tmp/bmb_root </tmp/lb Checking that no-one is using this disk right now ... OK Disk /tmp/bmb_root: 1,1 GiB, 1170228224 bytes, 2285602 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: gpt Disk identifier: 3C0E3DAC-3069-354E-BA0E-CB74029F5A5C Created a new GPT disklabel (GUID: 3C0E3DAC-3069-354E-BA0E-CB74029F5A5C). Partition table length changed from 128 to 8. New situation: Disklabel type: gpt Disk identifier: 3C0E3DAC-3069-354E-BA0E-CB74029F5A5C # sfdisk -d /tmp/bmb_root label: gpt label-id: 3C0E3DAC-3069-354E-BA0E-CB74029F5A5C device: /tmp/bmb_root unit: sectors first-lba: 4 last-lba: 2285598 table-length: 8 # -- System Information: Debian Release: buster/sid APT prefers stable APT policy: (700, 'stable'), (650, 'testing'), (600, 'unstable'), (550, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 4.19.0-2-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) Versions of packages fdisk depends on: ii libc6 2.28-10 ii libfdisk1 2.33.1-0.1 ii libmount1 2.33.1-0.1 ii libncursesw6 6.1+20181013-2 ii libsmartcols1 2.33.1-0.1 ii libtinfo6 6.1+20181013-2 fdisk recommends no packages. fdisk suggests no packages. -- no debconf information

