Error: Failed to create partitions

Hi
When i want to build centos from existing rootfs for uefi bootable image encounter with below error in the end of build:
Error: Failed to create partitions

/snap/bin/distrobuilder pack-lxd ./centos.yaml /mnt2   -o targets.lxd.vm.size=60   --disable-overlay --debug

113 files removed
INFO[2022-08-31T08:42:08+04:30] Running hookstriggerpost-packages            
INFO[2022-08-31T08:42:08+04:30] Running generator                             generator=hostname
INFO[2022-08-31T08:42:08+04:30] Running generator                             generator=hosts
INFO[2022-08-31T08:42:08+04:30] Running generator                             generator=dump
INFO[2022-08-31T08:42:08+04:30] Running generator                             generator=dump
INFO[2022-08-31T08:42:08+04:30] Running generator                             generator=remove
INFO[2022-08-31T08:42:08+04:30] Running generator                             generator=dump
INFO[2022-08-31T08:42:08+04:30] Running generator                             generator=fstab
INFO[2022-08-31T08:42:08+04:30] Running generator                             generator=dump
INFO[2022-08-31T08:42:08+04:30] Running generator                             generator=template
INFO[2022-08-31T08:42:08+04:30] Running generator                             generator=lxd-agent
Warning: File size is not a multiple of 512 bytes! Misbehavior is likely!
Warning: File size is not a multiple of 512 bytes! Misbehavior is likely!
Warning: File size is not a multiple of 512 bytes! Misbehavior is likely!
Warning! Read error 25; strange behavior now likely!
Warning! Read error 25; strange behavior now likely!
Creating new GPT entries in memory.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.
Creating new GPT entries in memory.
Could not create partition 1 from 0 to 204799
Could not change partition 1's type code to EF00!
Error encountered; not saving changes.
Error: Failed to create partitions: Failed to create partitions: exit status 4

Any ideas @monstermunchkin ?

1 Like

You are creating an empty disk image of 60 bytes. The EFI partition distrobuilder creates is 100 MB. That’s the reason it’s failing. Just drop targets.lxd.vm.size and it should work.

2 Likes

Great
Thank you @monstermunchkin @tomp

If the partition is always 100MB could we add validation to that option to give a more meaningful error if its specified too small @monstermunchkin ?

Yeah, we shouldn’t allow anything smaller than 100MB. Or better: We should require a minimum size of e.g. 150 MB as the root partition shouldn’t be empty either.

1 Like

Now error is changed:

mkfs.fat 4.1 (2017-01-24)
rsync: rsync_xal_set: lsetxattr("/var/cache/distrobuilder.2410706773/vm/boot/efi","security.selinux") failed: Operation not supported (95)
rsync: rsync_xal_set: lsetxattr("/var/cache/distrobuilder.2410706773/vm/boot/efi/EFI","security.selinux") failed: Operation not supported (95)
rsync: rsync_xal_set: lsetxattr("/var/cache/distrobuilder.2410706773/vm/boot/efi/EFI/almalinux","security.selinux") failed: Operation not supported (95)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1207) [sender=3.1.3]
Error: Failed to copy rootfs: Failed to copy "/var/cache/distrobuilder.2410706773/overlay/" to "/var/cache/distrobuilder.2410706773/vm": exit status 23


What are the exact commands you are running?

distrobuilder pack-lxd ./centos.yaml /mnt --vm -o targets.lxd.vm.size=60000000000    --debug

without targets.lxd.vm.size i got below error:

rsync: write failed on "/var/cache/distrobuilder.3460242996/vm/home/xxxxxxxx": No space left on device (28)

That doesn’t make any sense as distrobuilder uses a default value of 4294967296 bytes which is less than 60000000000. The error message suggests that your disk is full.

At the start this warning is shown:

WARN[2022-08-31T14:38:39Z] Failed to create overlay                      err="overlay not supported on xfs"

You should use --disable-overlay then.

I could build the rootfs for using in lxd vm with

-o targets.lxd.vm.size=60000000000

I think distrobuilder is a powerful image maker but the document and troubleshoot is not sufficient.

Thank you