Error with resize2fs when building SD image from prebuilt image

I’m using a Virtual Machine with Ubuntu v18.04.4, and Vitis & Petalinux versions 2020.1. I’m trying to build an image for PYNQ-Z1 v2.6.0 using the prebuilt image I got from the website. I make it to the script, but on the “sudo chroot / resize2fs $rootdev ${new_size}K” line, it crashes because the loop device on has so many blocks, which is less than ${new_size}.

If I add a “-f” in the script and force the loop device to be that new size, the next line, “sudo chroot / zerofree $rootdev” crashes and is only able to read 99.7% of the loop device before throwing the error “failed to read loop device.”

Does anyone know why this error is happening or how to get around it to build the SD card image?

Here is the end of the build log:
resize2fs error.txt (11.8 KB)