We are trying the takeover tool to install balena OS on an Ubuntu installed Raspberry Pi 4. We are facing some issue while compiling the takeover tool for our architecture. We dependencies are installed fine as we followed the cross repo. Please check the error once.
ubuntu@ubuntu:~/takeover$ cross test -vv --release --target "aarch64-unknown-linux-gnu"
+ cargo metadata --format-version 1 --filter-platform aarch64-unknown-linux-gnu
+ rustc --print sysroot
+ /usr/bin/docker
+ /usr/bin/docker version -f '{{ .Server.Os }},,,{{ .Server.Arch }}'
+ rustup toolchain list
+ rustup target list --toolchain stable-x86_64-unknown-linux-gnu
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu
+ /usr/bin/docker run --userns host --platform linux/amd64 -e 'PKG_CONFIG_ALLOW_CROSS=1' -e 'XARGO_HOME=/home/ubuntu/.xargo' -e 'CARGO_HOME=/home/ubuntu/.cargo' -e 'CARGO_TARGET_DIR=/target' -e 'CROSS_RUNNER=' -e TERM -e 'USER=ubuntu' --rm --user 1000:1000 -v /home/ubuntu/.xargo:/home/ubuntu/.xargo:z -v /home/ubuntu/.cargo:/home/ubuntu/.cargo:z -v /home/ubuntu/.cargo/bin -v /home/ubuntu/takeover:/home/ubuntu/takeover:z -v /home/ubuntu/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:/home/ubuntu/.rustup/toolchains/stable-x86_64-unknown-linux-gnu:z,ro -v /home/ubuntu/takeover/target:/target:z -w /home/ubuntu/takeover -i -t ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main sh -c 'PATH="$PATH":"/home/ubuntu/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin" cargo test -vv --release --target aarch64-unknown-linux-gnu'
exec /usr/bin/sh: exec format error
The exec format error points to a wrong architecture used.
Could be that there is some mixup - whatever is executed there - it is not in the correct format.
I don’t know if the ubuntu@ubuntu machine you use is an x64 machine (I guess so) and you’re trying to cross compile something to work on an RPi 4 with ARM64 architecture, but it looks like the Docker Engine does not really want that target / cannot execute within the choosen context. I think your best guess would be to ask at this takeover tool supporters on how to use it to prepare something for AARCH64 architecture on an x64 machine.
… and if you’re executing this on an RPi4, then the error is obvious that there is trying to execute something in amd64 platform context, which will not work on an AARCH64 environment without special tools.
Thats probably because you use the “cross” option. Thats for cross compilation, designed to run on e.g. an x64 machine and building an image for another system. You first have to compile it on an x64 computer to be able to use the tool afterwards (at the end of GitHub - balena-os/takeover: Migrate arbitrary devices to balena)
@curlinfosec did you manage to compile the takeover tool?
Nico is right. if you are trying to compile the tool directly on ubuntu aarch64 version, you would simply need to install rust and then run cargo build
let us know if that works.
i will also check if we can provide prebuilt binaries for the utility going forward.
We weren’t able to port the devices with Ubuntu OS to Balena OS. We have ubuntu on RPi4 and tried the migration with the following command. Also, we are trying this virtually over ssh as we wont’ have direct access to the servers where balena needs to be installed. However, we couldn’t find any logs after the command execution for debugging. We tried the command with various flags and none of them were working. As of now, we paused this balena research on our project.
We’ll check the link posted above and see if it helps us in some way. Thanks.
Hi, could you please confirm whether the takeover app fails it no --image is provided?
And, when providing an image, does it apparently work but on reboot it boots into the old OS? If so, please try to provide a gzipped (.img.gz) file instead.