0

I followed this instruction to enable 64 bit kernel.

https://www.raspberrypi.org/forums/viewtopic.php?t=250730

And I am pretty sure now my kernel is 64 bit.

$ uname -a
Linux RPi4 5.4.51-v8+ #1327 SMP PREEMPT Thu Jul 23 11:11:34 BST 2020 aarch64 GNU/Linux

But I can't run any 64bit binaries on it.

$ chmod 755 *
$ file ./busybox
./busybox: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, stripped
$ ./busybox
Failed to execute process './busybox'. Reason:
The file './busybox' does not exist or could not be executed.
$ ld ./busybox
./busybox: file not recognized: file format not recognized
$ ldd ./busybox
        not a dynamic executable

binary source: busybox


Is there any way to run arbitrary aarch64 binaries on my PRi4?


I tried install docker on my RPi4, too. But the docker engine also be 32 bit, and I can only pull armhf images...


2020/07/29 Another try:

force docker to pull arm64 version of Ubuntu image

$ docker manifest inspect ubuntu
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
   "manifests": [
##########<ignore useless output>##########
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 1152,
         "digest": "sha256:8351cb483b295a97ee3cc15150285a58ccf0669e422d4730a9a608988bd5e902",
         "platform": {
            "architecture": "arm64",
            "os": "linux",
            "variant": "v8"
         }
      },
##########<ignore useless output>##########
   ]
}
$ docker pull ubuntu@sha256:8351cb483b295a97ee3cc15150285a58ccf0669e422d4730a9a608988bd5e902
$ docker tag acd9dae93dea ubuntu

Run the image

$ docker run -it ubuntu bash
#Nothing happen, no error message, no tty spawn. 

docker container ls -a
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS                            PORTS               NAMES
b098badc2c00        ubuntu              "bash"                   8 seconds ago        Exited (159) 6 seconds ago                            hopeful_bhabha

The only thing I known is it exit with code 159.

Anyone knows the reason? The docker image is for aarch64, all binary should be aarch64, and my kernel is aarch64.

Why I can't run it?

2
  • I don't know if this helps, but I use 64-bit Ubuntu 20.04 on my RPi 3B+, and it seems to run any 64- or 32-bit program without any issues, including 64-bit Docker. – tttapa Jul 27 '20 at 19:35
  • You are missing the dynamic linker used, "interpreter /system/bin/linker64", the path and linker do look a bit strange, where is the busybox binary from ? – onion Aug 24 '20 at 11:30
1

The problem is this:

/busybox: ELF 64-bit [...] dynamically linked
                           ^^^^^^^^^^^^^^^^^^

This is totally normal -- I suspect you have some idea of what this refers to, since you tried ldd on it -- but of course what it was linked to when compiled were 64-bit userland libraries that you do not have.

There are two things you can try:

  1. Install those libraries too. Finding out what are they may take some work as obviously ldd on the Pi isn't saying, but I'd guess the list for busybox is not too hefty (ldd on a stock version somewhere should give some clues). Remember, you have to check those .so files for their own dependencies and include those.

  2. Compile a statically linked busybox. This requires you have an aarch64 system or cross-compiler to do it with. I'd guess this commonly enough done when busybox is used on embedded systems as the entire userland.1

In case you don't understand the static vs. dynamic linking issue, this is a pretty succinct explanation. I would try installing an aarch64 OS on a card temporarily, something Debian derived/related such as Ubuntu, and see if #1 will work, then #2.

I also thought of trying to add an aarch64 repo to /etc/apt/sources.list:

      deb [arch=arm64]  http://deb.debian.org/debian/ buster main contrib

But I tried this quickly and in the end I don't think apt will cooperate. This would also cause a problem if you have the normal busybox installed.


  1. In fact, I notice there's a busybox-static package, and I did try downloading the aarch64 one to a Raspbian Pi: http://ftp.debian.org/debian/pool/main/b/busybox/busybox-static_1.30.1-4_arm64.deb but this also fails with Exec format error, which leads me to believe this is simply not possible.
3
  • Thank your explanation. Because I want to run arbitrary aarch64 binaries on my PRi4.. Is there any to install all those libraries? – JK-Hu Jul 27 '20 at 15:50
  • That's another question ;) but I would not bother asking: I think you are out of luck, I made some changes above, start with the footnote. – goldilocks Jul 27 '20 at 16:51
  • I tried to chroot a 64bit os tree, succeed. The problem is my OS lack of 64 bit dynamic libraries. – JK-Hu Aug 29 '20 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.