lxc/distrobuilder

lxc with apple m3 pro chip

0xElmalky opened this issue · 5 comments

sudo $HOME/go/bin/distrobuilder build-lxd alpine.yaml -o image.release=3.18 -o image.architecture=x86_64  
INFO   [2024-05-10T18:07:44-04:00] Downloading source                           
INFO   [2024-05-10T18:07:45-04:00] Unpacking image                               file=/tmp/distrobuilder/alpinelinux-3.18-x86_64/alpine-minirootfs-3.18.6-x86_64.tar.gz
INFO   [2024-05-10T18:07:46-04:00] Managing repositories                        
INFO   [2024-05-10T18:07:46-04:00] Running hooks                                 trigger=post-unpack
INFO   [2024-05-10T18:07:46-04:00] Managing packages                            
Error: Failed to manage packages: Failed to refresh: fork/exec /sbin/apk: exec format error
ERROR  [2024-05-10T18:07:46-04:00] Failed running distrobuilder                  err="Failed to manage packages: Failed to refresh: fork/exec /sbin/apk: exec format error"
INFO   [2024-05-10T18:07:46-04:00] Removing cache directory 

what should I do with this error

You're on an arm64 machine (M3) so you can't go and build x86_64 images, using image.architecture=aarch64 should work fine though.

I want to make it with this arch as if I made it with aarm
It is not going to work in the target server

distrobuilder doesn't do cross architecture builds, you must run it on the target architecture.

No do you know the lxc / lxd privilege scenario I am trying to do it

To be clear, if you want to build an image to run on an x86_64 server, distrobuilder must be run on an x86_64 system. If you want to build an image to run on an aarch64 server, distrobuilder must be run on an aarch64 system.

All our own images are built in that way, we use Intel/AMD servers to build the x86_64 images, we use ARM 64bit servers to build aarch64 and we use ARM 32bit servers to build armhf.