0

I would like to emulate the exact copy of the Rasp berry Pi OS on a virtual machine that can run on my jetson nano. I've found this tutorial and I tried to replicate it :

Building a Virtual machine with the .img file of the raspberry pi stretch

this is what happened :

root@zi-desktop:~/Desktop/Desktop_zi/Work/I9/Arm32# udisksctl loop-setup --file ./raspios/2021-03-04-raspios-buster-armhf-full.img --read-only

Mapped file ./raspios/2021-03-04-raspios-buster-armhf-full.img as /dev/loop1.

root@zi-desktop:~/Desktop/Desktop_zi/Work/I9/Arm32# lsblk -o name,label /dev/loop1

NAME LABEL

loop1

??loop1p1 boot

??loop1p2 rootfs

root@zi-desktop:~/Desktop/Desktop_zi/Work/I9/Arm32# sudo mount -o ro /dev/loop1p2 /media/zi/rootfs

root@zi-desktop:~/Desktop/Desktop_zi/Work/I9/Arm32# sudo tar c -C /media/zi/rootfs . | docker image import - raspios-full:buster

sha256 : 55d475ae76144b9ac360a457b2b3966fe7a3214755d605f10bb07fdee2618cfc

root@zi-desktop:~/Desktop/Desktop_zi/Work/I9/Arm32# docker image ls -aREPOSITORY TAG IMAGE ID CREATED SIZE

raspios-full buster 55d475ae7614 33 minutes ago 6.54GB

hello-world latest a29f45ccde2a 15 months ago 9.14kB

At this point the tutorial says to do this :

4. Allow your computer to emulate and run ARM binaries

docker run --rm --privileged docker/binfmt:820fdd95a9972a5308930a2bdfb8573dd4447ad3

ok,but where can I get that code ? because I tried :

docker run --rm --privileged docker/binfmt: 55d475ae76144b9ac360a457b2b3966fe7a3214755d605f10bb07fdee2618cfc

and :

docker run --rm --privileged docker/binfmt: 55d475ae7614

but :

root@zi-desktop:~/Desktop/Desktop_zi/Work/I9/Arm32# docker run --rm --privileged docker/binfmt:55d475ae7614

Unable to find image 'docker/binfmt:55d475ae7614' locally

docker: Error response from daemon: manifest for docker/binfmt:55d475ae7614 not found: manifest unknown: manifest unknown.

See 'docker run --help'.

root@zi-desktop:~/Desktop/Desktop_zi/Work/I9/Arm32# docker run --rm --privileged docker/binfmt:55d475ae76144b9ac360a457b2b3966fe7a3214755d605f10bb07fdee2618cfc

Unable to find image 'docker/binfmt:55d475ae76144b9ac360a457b2b3966fe7a3214755d605f10bb07fdee2618cfc' locally

docker: Error response from daemon: manifest for docker/binfmt:55d475ae76144b9ac360a457b2b3966fe7a3214755d605f10bb07fdee2618cfc not found: manifest unknown: manifest unknown.

See 'docker run --help'

Marietto
  • 101
  • 1
  • 1
  • 5

1 Answers1

1

You shouldn't replace the tag by the hash of your own image. The binfmt image is independent from your RPi OS image, the tag has nothing to do with your image hash.

You can get the tag of the latest binfmt version here: https://hub.docker.com/r/docker/binfmt/tags?page=1&ordering=last_updated

tttapa
  • 986
  • 5
  • 7
  • I've looked there. There are only amd64 images. I need one arm32 debian image. – Marietto Apr 23 '21 at 19:40
  • @Marietto the instructions you followed are for emulating ARM on an x86 (AMD64) system. If you're already using an ARM system you don't need an emulator to run ARM containers. – tttapa Apr 24 '21 at 01:12
  • I'm running arm64 / jetson nano but I want emulate arm32 / raspberry. – Marietto Apr 24 '21 at 08:37
  • @Marietto you don't need to emulate anything. The Jetson has an ARMv8 CPU which supports both AArch64 and ARMhf (32-bit mode). You might need a 32-bit version of Docker, but definitely not an emulator. – tttapa Apr 24 '21 at 08:42
  • Im not sure that it will work. the armhf sometimes does not work good here on the jetson nano. I tried to run some applications like teamviewer and anydesk but they failed. the first one says that the cpu is not supported. the second one looks for some raspberry libraries and it can't find them. in addition,the repo that I tried to install on the emulated bullseye for arm32 looks for the kernel headers of the raspberry and it can't find them. anyway,I can try. can u point me to a valid tutorial to try to do what u suggest ? – Marietto Apr 24 '21 at 10:33
  • can u give a look at this scenario ? https://raspberrypi.stackexchange.com/questions/124239/the-following-signatures-couldnt-be-verified-because-the-public-key-is-not-avai – Marietto Apr 24 '21 at 10:43
  • @Marietto if you want to run 32-bit applications, you need to install the necessary 32-bit libraries on your system, these are not preinstalled on 64-bit distributions. For 32-bit Docker on ARM, see https://thegeeklab.de/posts/run-arm32-docker-daemon-on-arm64-servers/ – tttapa Apr 24 '21 at 10:43
  • I will try. can u suggest also a tutorial to learn how to prepare a docker image with the raspberry 4 os that will have all the necessary files to skip the errors that I get here ? https://raspberrypi.stackexchange.com/questions/124239/the-following-signatures-couldnt-be-verified-because-the-public-key-is-not-avai ? thanks. – Marietto Apr 24 '21 at 11:43
  • this solution probably will break my system. read what it wants to do : The following packages will be REMOVED: apparmor containerd docker.io nvidia-docker2 pigz runc snapd. At this point I think that emulate armhf using qemu / kvm is a less risky and more clean operation. – Marietto Apr 24 '21 at 13:20