Bug 1266658 - virt-builder ubuntu-14.04 --size fails: Extended partition already exists.
Summary: virt-builder ubuntu-14.04 --size fails: Extended partition already exists.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
: 1282732 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-09-26 08:39 UTC by Richard W.M. Jones
Modified: 2015-12-16 09:53 UTC (History)
4 users (show)

Fixed In Version: libguestfs-1.30.5-1.fc22 libguestfs-1.30.5-2.fc23 libguestfs-1.30.5-2.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-06 01:22:04 UTC
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2015-09-26 08:39:39 UTC
Description of problem:

$ virt-builder ubuntu-14.04 --size 20G
[   0.9] Downloading: http://libguestfs.org/download/builder/ubuntu-14.04.xz
[   2.9] Planning how to build this image
[   2.9] Uncompressing
[  12.8] 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

It works without the --size parameter.

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

libguestfs-1.31.7-1.fc24.x86_64

Comment 1 Ting-Wei Lan 2015-10-25 06:39:54 UTC
This also happens when building a debian image.

$ virt-builder debian-8 --size 16G 
[   1.4] Downloading: http://libguestfs.org/download/builder/debian-8.xz
[   2.1] Planning how to build this image
[   2.1] Uncompressing
[  14.1] Resizing (using virt-resize) to expand the disk to 16.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


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

libguestfs-1.30.0-1.fc22.x86_64

Comment 2 Richard W.M. Jones 2015-10-27 08:50:24 UTC
(In reply to Ting-Wei Lan from comment #1)
> This also happens when building a debian image.
> 
> $ virt-builder debian-8 --size 16G 
> [   1.4] Downloading: http://libguestfs.org/download/builder/debian-8.xz
> [   2.1] Planning how to build this image
> [   2.1] Uncompressing
> [  14.1] Resizing (using virt-resize) to expand the disk to 16.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
> 
> 
> Version-Release number of selected component (if applicable):
> 
> libguestfs-1.30.0-1.fc22.x86_64

Try a more up to date version such as 1.30.4 available in updates-testing:

https://bodhi.fedoraproject.org/updates/?packages=libguestfs

Comment 3 Ting-Wei Lan 2015-10-30 03:27:47 UTC
I tried libguestfs-1.30.4-1.fc22.x86_64, but it still failed with the same error.

sfdisk --part-type /dev/sdb 2 5
Extended partition already exists.
sfdisk: /dev/sdb: partition 2: failed to set partition type
[   11.282273]  sdb: sdb1 sdb2 < sdb5 >
guestfsd: error: sfdisk --part-type: Extended partition already exists.
sfdisk: /dev/sdb: partition 2: failed to set partition type
guestfsd: main_loop: proc 236 (part_set_mbr_id) took 0.01 seconds
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 [...]
libguestfs: closing guestfs handle 0x2554ac0 (state 2)

Comment 4 Richard W.M. Jones 2015-10-30 09:56:37 UTC
It turns out I was thinking of another bug.  This one is not even
fixed upstream.

I have now fixed this *upstream* by reverting a bunch of changes
we did last year when we hoped to add support for extended
partitions to virt-resize (which we are no longer going to do).

The commits are:

https://github.com/libguestfs/libguestfs/commit/b1a7903fd12f86f64aac8e3829757a2bf949ec6c
https://github.com/libguestfs/libguestfs/commit/8ad069c402a451fb40a9c03fe9045f7ef9cc1e69
https://github.com/libguestfs/libguestfs/commit/3258695162f4fa1bbf8499bf604d8d5e51460d93
https://github.com/libguestfs/libguestfs/commit/db5ebecd8a0a762c73de22b67b63f23572a585e2

These will appear in 1.30.5 / 1.31.21.

Comment 5 Richard W.M. Jones 2015-11-17 09:55:34 UTC
*** Bug 1282732 has been marked as a duplicate of this bug. ***

Comment 6 Marius Vollmer 2015-11-17 10:23:45 UTC
Another avenue for fixing this would be to change the debian and ubuntu templates to not use extended partitions, no?

Comment 7 Richard W.M. Jones 2015-11-17 10:42:20 UTC
Ubuntu's installer at least seems to prefer extended partitions.

In any case this is just a bug in virt-builder and will be fixed in
1.30.5, or by backporting the 4 commits mentioned in the
other BZ to 1.30.4.

Comment 8 Fedora Update System 2015-11-20 08:31:01 UTC
libguestfs-1.30.5-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-da3879aa60

Comment 9 Fedora Update System 2015-11-20 08:31:12 UTC
libguestfs-1.30.5-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-d73e2fad1e

Comment 10 Fedora Update System 2015-11-21 17:52:45 UTC
libguestfs-1.30.5-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update libguestfs'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-d73e2fad1e

Comment 11 Fedora Update System 2015-11-22 14:26:36 UTC
libguestfs-1.30.5-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update libguestfs'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-da3879aa60

Comment 12 Marius Vollmer 2015-11-26 14:57:45 UTC
The resizing of the debian-8 image now works, but the swap partition seems to be removed in the process.  This leads to a 90sec delay during boot and no swap.

Regarding virt-resize, I think it is OK if it just gives up (with a clear error message) when there are setups it can't handle, such as extended partitions.

Regarding virt-builder, I strongly think that it should provide templates that can be resized.  This means avoiding partition setups that virt-resize can't handle.

I am quite surprised that Debian defaults to putting swap into a extended partition.  How odd.  I'll ask around a bit.

Comment 13 Marius Vollmer 2015-11-26 15:19:36 UTC
> I am quite surprised that Debian defaults to putting swap into a extended
> partition.  How odd.  I'll ask around a bit.

Maybe they do this because you can only have four primary partitions.

Would it be acceptable to make new debian-8 images that don't use extended partitions?

Comment 14 Richard W.M. Jones 2015-11-26 16:28:16 UTC
I opened another bug about the data loss issue:
https://bugzilla.redhat.com/show_bug.cgi?id=1285847

Comment 15 Fedora Update System 2015-11-28 07:15:45 UTC
libguestfs-1.30.5-2.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-943e9fb63b

Comment 16 Fedora Update System 2015-11-28 07:15:49 UTC
libguestfs-1.30.5-2.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-1bf4cbf156

Comment 17 Fedora Update System 2015-11-29 00:54:17 UTC
libguestfs-1.30.5-2.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update libguestfs'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-1bf4cbf156

Comment 18 Fedora Update System 2015-11-29 02:22:56 UTC
libguestfs-1.30.5-2.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update libguestfs'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-943e9fb63b

Comment 19 Fedora Update System 2015-12-06 01:21:54 UTC
libguestfs-1.30.5-2.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2015-12-16 09:53:10 UTC
libguestfs-1.30.5-2.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.