RPi-Distro / pi-gen

Tool used to create the official Raspberry Pi OS images
BSD 3-Clause "New" or "Revised" License
2.52k stars 1.58k forks source link

./build-docker.sh error "setarch: failed to set personality to linux32: Invalid argument" #764

Open naturaverl opened 3 months ago

naturaverl commented 3 months ago

Hi, first time pi-gen user here. I'm on a M1 mac, trying to use pi-gen to build a standard image (nothing's been added in by me, yet)

I'm trying to follow the README to learn how to use pi-gen, and understand that I can use Docker for pi-gen to have a debian environment to run from. On my Mac mini M1 system, I've simply cloned from pi-gen master branch, am using the build-docker.sh script, and the simplest of uses is failing for me. [EDIT] I've checked out the arm64 branch and that works better for me. The README didn't specifically mention needing to run the arm64 branch if your host is arm64.

studio-2:pi-gen jay$ echo IMG_NAME=\'raspios\' > config
studio-2:pi-gen jay$ ./build-docker.sh 
[+] Building 0.4s (8/8) FINISHED                                                                                                         docker:desktop-linux
 => [internal] load .dockerignore                                                                                                                        0.0s
 => => transferring context: 92B                                                                                                                         0.0s
 => [internal] load build definition from Dockerfile                                                                                                     0.0s
 => => transferring dockerfile: 542B                                                                                                                     0.0s
 => [internal] load metadata for docker.io/library/debian:bullseye                                                                                       0.3s
 => [1/3] FROM docker.io/library/debian:bullseye@sha256:26d72b71f88865377988af6f54da9aaa5bed201f39bcee13eb55737016660df2                                 0.0s
 => [internal] load build context                                                                                                                        0.0s
 => => transferring context: 10.87kB                                                                                                                     0.0s
 => CACHED [2/3] RUN apt-get -y update &&     apt-get -y install --no-install-recommends         git vim parted         quilt coreutils qemu-user-stati  0.0s
 => [3/3] COPY . /pi-gen/                                                                                                                                0.0s
 => exporting to image                                                                                                                                   0.0s
 => => exporting layers                                                                                                                                  0.0s
 => => writing image sha256:aba1ee87141ac3c050a7c4395f1af93dcd31d77d8a90321bd14dd2c7c0596b08                                                             0.0s
 => => naming to docker.io/library/pi-gen                                                                                                                0.0s

What's Next?
  1. Sign in to your Docker account → docker login
  2. View a summary of image vulnerabilities and recommendations → docker scout quickview
[19:51:53] Begin /pi-gen
[19:51:53] Begin /pi-gen/stage0
[19:51:53] Begin /pi-gen/stage0/prerun.sh
setarch: failed to set personality to linux32: Invalid argument
[19:51:53] End /pi-gen/stage0/prerun.sh
[19:51:53] Begin /pi-gen/stage0/00-configure-apt
[19:51:53] Begin /pi-gen/stage0/00-configure-apt/00-run.sh
install: target '/pi-gen/work/raspios/stage0/rootfs/etc/apt/' is not a directory: No such file or directory
XECDesign commented 3 months ago

first time pi-gen user here

Sorry it didn't all go as smoothly as it should've. I'm not familiar with Macs at all, so I'm not sure I'll be of much help here.

Do you need to build armhf images or arm64 images? If you don't need armhf images, you could try building from the 'arm64' branch and see if you have better luck.

Otherwise, do M1 macs support arm32 instructions natively or only aarch64? If it's only aarch64, then there's not much of a chance that this will work.