Resizing FreeBSD QEMU Images: Fixing 'Truncated ELF File' Errors

I’ve been curious about FreeBSD and wanted to try it on QEMU. FreeBSD has instructions for running it. As I’m using an Apple Silicon machine, I paid attention to the HVF acceleration option. I first logged in via Telnet, but once SSH was set up, I ran it in the background with a small script (./run.sh &): #!/bin/sh qemu-system-aarch64 -m 4096M -cpu host -M virt,accel=hvf \ -bios edk2-aarch64-code.fd -display none \ -drive if=virtio,file=FreeBSD-14.3-RELEASE-arm64-aarch64-ufs.qcow2,id=hd0 \ -device virtio-net,netdev=net0 -netdev user,id=net0,hostfwd=tcp::2222-:22 This worked well, but as I installed more packages I eventually hit a weird error: ...

September 14, 2025 · 3 min