growpart mishandles image filenames that end in a number
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-utils |
Fix Released
|
High
|
Unassigned | ||
cloud-utils (Ubuntu) |
Fix Released
|
Low
|
Scott Moser | ||
Disco |
Fix Released
|
Low
|
Rafael David Tinoco |
Bug Description
[Impact]
* DEP8 race condition for ppc64el (LP: #1836593): intermittent migration regressions.
* growpart: fix bug when file image ends in a digit (LP: #1835124): image files can't end in ".ext4", for example, orelse growpart doesn't work.
* fix spelling error in ec2metadata (LP: #1810857): no impact.
[Test Case]
(k)inaddy@
(m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-262143, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-262143, default 262143): +100mb
Created a new partition 1 of type 'Linux' and of size 95 MiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.
(k)inaddy@
FAILED: failed to get start and end for /fakedisk.ext41 in /fakedisk.ext4
[Regression Potential]
* Fix tries to recognize if volume is a block device or not. Same code exists for block devices, which reduces probability of issues.
* Fix was done by pkg maintainer and it is already upstreamed.
[Other Info]
* Related Bugs:
* bug 1842682: regression in test-growpart results in test fail device or resource busy
* Original description:
When growpart attempts to determine the partition to resize, it uses this logic:
$ sed -n '266,275p' $(which growpart)
if [ -b "${DISK}p${PART}" -a "${DISK%[0-9]}" != "${DISK}" ]; then
# for block devices that end in a number (/dev/nbd0)
# the partition is "<name>
elif [ "${DISK#
# for /dev/loop devices, sfdisk output will be <name>p<number>
# format also, even though there is not a device there.
fi
If the disk is an image, and the image filename ends with a number, the partition will be "${DISK}p${PART}"; however, "${DISK}p${PART}" will not be a block device. Thus, the partition is improperly identified as just "${DISK}${PART}".
This gives us a failure like:
+ growpart -v -v -v disk-uefi.ext4 1
update-partition set to true
resizing 1 on disk-uefi.ext4 using resize_sfdisk_gpt
running[
6291456 sectors of 512. total size=3221225472 bytes
running[
## sfdisk --unit=S --dump disk-uefi.ext4
label: gpt
label-id: A9F73A73-
device: disk-uefi.ext4
unit: sectors
first-lba: 34
last-lba: 6291422
disk-uefi.ext4p1 : start= 227328, size= 4384735, type=0FC63DAF-
disk-uefi.ext4p14 : start= 2048, size= 8192, type=21686148-
disk-uefi.ext4p15 : start= 10240, size= 217088, type=C12A7328-
FAILED: failed to get start and end for disk-uefi.ext41 in disk-uefi.ext4
Related branches
- Scott Moser (community): Approve
- Canonical Server: Pending requested
-
Diff: 200 lines (+168/-0)5 files modifieddebian/changelog (+8/-0)
debian/patches/lp1810857-fix-spelling-error-in-ec2metadata-reservation-id.patch (+33/-0)
debian/patches/lp1835124-growpart-fix-bug-when-file-image-ends-in-a-digit.patch (+53/-0)
debian/patches/lp1836593-fix-race-condition-in-test-growpart.patch (+71/-0)
debian/patches/series (+3/-0)
Changed in cloud-utils: | |
status: | New → Triaged |
importance: | Undecided → High |
tags: | added: server-next |
Changed in cloud-utils (Ubuntu): | |
status: | New → Confirmed |
status: | Confirmed → Triaged |
Changed in cloud-utils: | |
status: | Triaged → Confirmed |
Changed in cloud-utils: | |
status: | Confirmed → Fix Committed |
Changed in cloud-utils (Ubuntu): | |
assignee: | Scott Moser (smoser) → nobody |
Changed in cloud-utils (Ubuntu Disco): | |
status: | New → In Progress |
assignee: | nobody → Rafael David Tinoco (rafaeldtinoco) |
importance: | Undecided → Low |
tags: | removed: server-next |
Changed in cloud-utils: | |
status: | Fix Committed → Fix Released |
cloud-utils growpart script uses either sgdisk or sfdisk as a resizer... unfortunately it does not expect disk formats other than:
resize_sfdisk_gpt() {
resize_sfdisk gpt
}
resize_sfdisk_dos() {
resize_sfdisk dos
}
where $1 is the type of the disk format.
that is why you're getting this error. I'll flag this as "Triaged" and "Wishlist", and put in server team queue for further analysis.
Thanks for reporting this!