Bug 1222231

Summary: virt-builder --size fails on debian-7/8 because of updated sfdisk in util-linux 2.62.2
Product: [Community] Virtualization Tools Reporter: ed.shornock
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: ed.shornock, lantw44, ptoscano, rbalakri
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-08-25 10:27:29 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
debugging output
none
resize.txt none

Description ed.shornock 2015-05-16 18:49:11 UTC
Created attachment 1026269 [details]
debugging output

Description of problem:
virt-builder fails if the --size parameter is given


Version-Release number of selected component (if applicable):
Debian package 1:1.29.40-1

How reproducible:

Consistently

Steps to Reproduce:
1. virt-builder $distro --size 8G
2.
3.

Actual results:

You cannot change a partition into an extended one or vice versa. Delete it first.
sfdisk: /dev/sdb: partition 2: failed to set partition type
[   19.396359]  sdb: sdb1 sdb2 < sdb5 >
guestfsd: error: sfdisk --part-type: You cannot change a partition into an extended one or vice versa. Delete it first.
sfdisk: /dev/sdb: partition 2: failed to set partition type
guestfsd: mainvirt-resize: error: libguestfs error: part_set_mbr_id: sfdisk --part-type: 
You cannot change a partition into an extended one or vice versa. Delete it 
first.
sfdisk: /dev/sdb: partition 2: failed to set partition type


Expected results:

This operation completing as it did with a previous version.


Additional info:

Comment 1 ed.shornock 2015-05-16 18:55:02 UTC
Note: /mnt (as seen in the logs) is a scratch space with 32GB free.

Comment 2 Richard W.M. Jones 2015-05-16 20:06:10 UTC
The key to this puzzle is what is $distro?

Anyhow this happens because virt-resize cannot resize logical partitions:
http://libguestfs.org/virt-resize.1.html#logical-partitions
so if you point the 'expand' setting at one it isn't going to work.

There is ongoing work upstream to try to support logical
partitions in virt-resize -- see upstream mailing list passim ad nauseam.

Comment 3 ed.shornock 2015-05-16 20:30:01 UTC
In this case $distro was both debian-7 and debian-8.

I found that the culprit is util-linux 2.26.2-3 from Sid. It works with util-linux 2.25.2-6 from Jessie & Stretch.

Comment 4 Richard W.M. Jones 2015-05-21 13:12:17 UTC
Created attachment 1028171 [details]
resize.txt

I think this is because of the upstream rewrite of sfdisk.
See also: https://www.redhat.com/archives/libguestfs/2015-May/msg00080.html

I can reproduce this with util-linux-2.26.2-1.fc23.x86_64

Full log is attached.

Comment 5 Pino Toscano 2015-08-25 10:27:29 UTC
This is a known regression in util-linux 2.26.x, see also 
https://bugzilla.redhat.com/show_bug.cgi?id=1248115#c7

Regarding Debian, either you ask the Debian maintainer of util-linux to backport the upstream commit to the 2.26.2 currently in testing & unstable, or simply wait for util-linux 2.27 to be released and packaged in Debian unstable.

Comment 6 ed.shornock 2015-08-25 12:52:44 UTC
OK. I'm still having the problem with 2.27-rc2 which is available in Debian experimental but I'll try hunting down the commit for 2.26.

Thanks.