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
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
(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
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)
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.
*** Bug 1282732 has been marked as a duplicate of this bug. ***
Another avenue for fixing this would be to change the debian and ubuntu templates to not use extended partitions, no?
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.
libguestfs-1.30.5-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-da3879aa60
libguestfs-1.30.5-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-d73e2fad1e
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
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
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.
> 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?
I opened another bug about the data loss issue: https://bugzilla.redhat.com/show_bug.cgi?id=1285847
libguestfs-1.30.5-2.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-943e9fb63b
libguestfs-1.30.5-2.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-1bf4cbf156
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
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
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.
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.