Using virt-builder to create image

codingfreak asked:

I’m trying to automatically create cloud images using virt-builder.

I am using the following command in Centos 7 and it keeps failing. Any idea behind the issue ?

# virt-builder debian-9 -o /var/lib/libvirt/images/DB9-20G.qcow2 --format qcow2 --hostname --update --root-password password:root123 --firstboot-command 'dhclient ens3' --size 20G

This is the output:

[   2.3] Downloading:
[   3.3] Planning how to build this image
[   3.3] Uncompressing
[   6.2] Resizing (using virt-resize) to expand the disk to 20.0G
virt-resize: error: libguestfs error: resize2fs: e2fsck 1.42.9 
/dev/sda1 has unsupported feature(s): metadata_csum
e2fsck: Get a newer version of e2fsck!

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

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

Seems e2fsprogs in Centos 7 is quite old to handle this issue. Is there any alternative way to better handle creating of cloud images on fly from command line ?

My answer:

e2fsprogs as shipped with CentOS 7 is slightly too old to understand the ext4 filesystem feature metadata_csum with which that disk image was built. Userland support appeared in 1.43 (as the way outdated wiki suggested it might).

The wiki also states that old tools which don’t understand the feature aren’t safe to use with it.

Thus, you were advised to: “Get a newer version of e2fsck!”

In my ideal world Red Hat would backport this bit into e2fsprogs, or just rebase it, but I wouldn’t count on that.

Since you’re building newer operating system images, you should consider using a more modern operating system as the workstation. I use Fedora (currently 27, occasionally betas) for similar purposes.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.