Bug 1265078

Summary: virt-builder resize of ubuntu-14.04 fails
Product: [Fedora] Fedora Reporter: maarten <madebr>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: mbooth, ptoscano, rjones, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-22 07:59:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Output of virt-builder -v -x ubuntu-14.04 --size 20G none

Description maarten 2015-09-22 05:36:22 UTC
Created attachment 1075641 [details]
Output of virt-builder -v -x ubuntu-14.04 --size 20G

Description of problem:
When resizing a new guest Ubuntu-14 guest VM,
the builder fails due to a sfdisk error.
"Extended partition already exists.
sfdisk: /dev/sdb: partition 2: failed to set partition type"

Version-Release number of selected component (if applicable):
1.30.0

How reproducible:
100%

Steps to Reproduce:
$ virt-builder ubuntu-14.04 --size 20G

Actual results:
[   1.2] Downloading: http://libguestfs.org/download/builder/ubuntu-14.04.xz
[   1.7] Planning how to build this image
[   1.7] Uncompressing
[   6.7] Resizing (using virt-resize) to expand the disk to 20.0G
virt-resize: error: libguestfs error: part_set_mbr_id: sfdisk --part-type: 
Extended partition already exists.
sfdisk: /dev/sdb: partition 2: failed to set partition type

If reporting bugs, run virt-resize with debugging enabled and include the 
complete output:

  virt-resize -v -x [...]

Expected results:
Same behavior as Fedora 22:
$ virt-builder fedora-22 --size 20G
[   1.2] Downloading: http://libguestfs.org/download/builder/fedora-22.xz
[   1.8] Planning how to build this image
[   1.8] Uncompressing
[   8.1] Resizing (using virt-resize) to expand the disk to 20.0G
[  20.4] Opening the new disk
[  32.1] Setting a random seed
[  32.1] Setting passwords
virt-builder: Setting random password of root to sEIz4Vaf2WykUvQN
[  33.1] Finishing off
                   Output file: fedora-22.img
                   Output size: 20.0G
                 Output format: raw
            Total usable space: 5.4G
                    Free space: 4.6G (86%)

Additional info:
Output of
virt-builder -v -x ubuntu-14.04 --size 20G
attached.

Comment 1 Richard W.M. Jones 2015-09-22 07:59:04 UTC
This is a bug in sfdisk.  See the reproducer here:

https://bugzilla.redhat.com/show_bug.cgi?id=1248115#c5
https://bugzilla.redhat.com/show_bug.cgi?id=1248115#c6

You need to add sfdisk commit df15fb3d053716d03055df755911d66814054b4b
to your host copy of sfdisk to fix it.

If your host is Debian/Ubuntu then see also:
https://bugzilla.redhat.com/show_bug.cgi?id=1222231

*** This bug has been marked as a duplicate of bug 1248115 ***