Building for arm64 fails

Dear VyOS community,
I have search in this forum for a similar error, that have been a few reports on similar error, however the issue has rised again it seams.
Following the build steps in the official docs but no matter what I do, it seams to fail hard, and the log yields nothing of the error.

Note that I try to change between arm64.
I am running the docker container on Ubuntu 24.04 noble, Kernel: x86_64 Linux 6.8.0-49-generic

EDIT:
I tried to fix the script, but i am unable to resolve the problem.
But I have identified the problem to be in the python script scripts/image-build/build-vyos-image.
I just hope someone more experienced then me could solve this issue.

EDIT:
I removed the workaround, because it did not work as expected.

# Line 670
cmd("lb build 2>&1")

Steps to reproduce:

# Clone the repo
$ git clone -b current --single-branch https://github.com/vyos/vyos-build && cd vyos-build
# For VyOS 1.5 (circinus,current)
$ sudo make clean
$ sudo ./build-vyos-image generic --architecture amd64 --build-by "[email protected]"
$ docker pull vyos/vyos-build:current  # For VyOS 1.5 rolling release
$ docker build -t vyos/vyos-build:current docker        # For VyOS 1.5 rolling release

Running the build using the docker by enter interactive mode:

$ sudo docker run --rm -it --privileged -v $(pwd):/vyos -w /vyos vyos/vyos-build:current bash

And trying to start the build:

$ sudo ./build-vyos-image generic --architecture arm64 --build-by "[email protected]"

Error:

W: Failure trying to run: chroot "/vyos/build/chroot" /bin/true
W: See /vyos/build/chroot/debootstrap/debootstrap.log for details
E: An unexpected failure occurred, exiting...
Traceback (most recent call last):
  File "/vyos/./build-vyos-image", line 670, in <module>
    cmd("lb build 2>&1")
  File "/vyos/scripts/image-build/utils.py", line 84, in cmd
    raise OSError(f"Command '{command}' failed")
OSError: Command 'lb build 2>&1' failed
vyos_bld@b20b413bfea0:/vyos$

From the log file:

# build/chroot/debootstrap/debootstrap.log
chroot: failed to run command ‘/bin/true’: Exec format error

Source:
https://docs.vyos.io/en/latest/contributing/build-vyos.html

Probably expected an ARM64 binary of /bin/true but got an AMD64 one.

There is no official support for ARM64 AFAIK. And there’s an arm64 docker image on docker hub and it looks like you would have to compile the arm64 on an arm64-based computer since the AMD64 docker image does not contain cross-compile binaries.

First of all, thank you for taking your time answer my question @patient0 .
But it is not a problem building for either arm64 nor amd64; if i execute lb build 2>&1 after the error.

But there is a however a problem it can not execute the command from the python script. It works just fine if I run the command sudo lb build 2>&1 using sudo right after the error occurred.

The same problem is if I run the following command:

sudo ./build-vyos-image generic --architecture amd64 --build-by "[email protected]"

So I do not think this is arm-based problem.

But please let me know if you have any other suggestions how I can build this using docker.
My current kernel is 64-bit:
Kernel: x86_64 Linux 6.8.0-49-generic

EDIT:
But of course, now it works to build the amd64 when I tried once again. :innocent:
Might be sad but true that the /bin/true is not arm-based then.

Edit: I see, it does work for you, too now. Good.

I see, works well for me on a i5-1200 running Debian. What are the specs on your amd64 host machine, CPU, RAM, OS/version and Docker version?

When copy-paste your commands, see below:

Specifically I run in an empty directory:

$ git clone -b current --single-branch https://github.com/vyos/vyos-build && cd vyos-build
# latest commit is 64737049995158b708289a08aff282d53bfc1a43
$ docker pull vyos/vyos-build:current
$ docker build -t vyos/vyos-build:current docker
# now we got the build vyos docker images, the "3 minutes ago" one
$ docker images | fgrep vyos-build
vyos/vyos-build               current    cbe832d12f80   3 minutes ago   3.16GB
vyos/vyos-build               <none>     dd487a91569f   3 days ago      3.13GB
$ sudo docker run --rm -it --privileged -v $(pwd):/vyos -w /vyos vyos/vyos-build:current bash
Current UID/GID: 1000/1000
vyos_bld@154e15787a07:/vyos$
# now inside the container
$ sudo ./build-vyos-image generic --architecture amd64 --build-by "[email protected]"
## ... and some time later
[2024-12-14 12:01:07] lb source
P: Source stage disabled, skipping
P: Build completed successfully

What do you use for the ARM64 compile, QEMU? Docker images must be of the same architecture as the host (the Docker container use the hosts kernel).

Well, except on the ARM Mac’s it seems. Just tried and I can run both, uses probably Rosetta in the background to emulate x86_64.```

I understand, you might be on to something, I will try to build this on my arm computer next week when I am home. At the moment I am running on my server with the following spec:

  • OS: Ubuntu 24.04 noble
  • Kernel: x86_64 Linux 6.8.0-49-generic
  • Shell: bash 5.2.21
  • CPU: Intel Xeon E5-2667 v2 @ 8x 3.3GHz
  • GPU: Device 1234:1111 (rev 02)
  • RAM: 2479MiB / 7444MiB

Currently I am not running any virtualization. But that would a room for improvement if VyOS could be built using Qemu or some other support in the future. :innocent:
Otherwise, I will need to invest in an Apple computer. :wink:

But I have an Nvidia Jeston Orin back home, so I will get back to this thread when I try to build on that computer instead.

So if it is what you say, that the /bin/true is not an arm, I need to build on an arm architecture. This is somewhat new to me.

But once again @patient0 thank you for pointing this out to me. :slight_smile:

Hi
I remember you will need to install qemu-aarch64-static in the system, and use vyos/vyos-build:current-arm64 image to build the system.

You can refer this to find the correct docker command.

1 Like

Thank you @tjjh89017 I will look into this tomorrow. :slight_smile:

Dear @tjjh89017 I tried your build scripts, however I could not get them to work right out of the box. I will however look more into them further, to see if I can modify them to build VyOS on my arm based computer.
I am using an NVIDIA Jetson Orin to build the image.