Raspberry Pi 4 32bit support

Hi all,

I’m trying to run platerecognizer/alpr-raspberry-pi on balenaos (only aarch64 for rpi4).

Their image is linux/arm. They don’t support aarch64 yet but will add support aarch64 in the future. They proposed to use the default 32bit rpi4 image.

On startup, it shows this warning and then it crashes without output.

WARNING: The requested image’s platform (linux/arm) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

Is there a way to run this linux/arm image on balenaos?

PS: their image is using tensorflow and probably contains lots of optimizations

Hello, I seemed to get it running on a Pi 4 with balenaOS using the following docker-compose.yml file. However, I don’t have a license file/token to test with. Perhaps you can use this as a starting point:

version: "2.1"
volumes:
    license:
services:
  alpr:
    image: platerecognizer/alpr-raspberry-pi:latest
    restart: always
    privileged: true
    volumes:
        - 'license:/license'
    environment:
      TOKEN: XXX

Hello alanb128,

What output do you get when running this?

I deployed your compose file without apply any changes.
It first had a warning about the TOKEN.

After adding the TOKEN and LICENSE_KEY as device variable, it went to continuous restarting without any output from the container.

08.04.22 09:18:54 (+0200) Service exited 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:19:20 (+0200) Restarting service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:19:20 (+0200)  alpr  Environment variable TOKEN is missing or invalid. It is a 40 characters long string.
08.04.22 09:19:21 (+0200) Service exited 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:20:14 (+0200) Restarting service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:20:14 (+0200)  alpr  Environment variable TOKEN is missing or invalid. It is a 40 characters long string.
08.04.22 09:20:15 (+0200) Service exited 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:16 (+0200) Restarting service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:16 (+0200)  alpr  Environment variable TOKEN is missing or invalid. It is a 40 characters long string.
08.04.22 09:21:17 (+0200) Service exited 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:34 (+0200) Killing service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:34 (+0200) Killed service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:34 (+0200) Installing service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:35 (+0200) Installed service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:35 (+0200) Starting service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:37 (+0200) Started service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:40 (+0200) Service exited 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:42 (+0200) Restarting service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:46 (+0200) Service exited 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:46 (+0200) Restarting service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:46 (+0200) Killing service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:49 (+0200) Service exited 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:49 (+0200) Killed service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'
08.04.22 09:21:50 (+0200) Installing service 'alpr sha256:ac24f15c000f3a2be4ae3304dbaa99dd027cf8e9d942a74a8d3499642be4fe58'

@maartenc mine had a warning about a license file, which is why I moved license from a variable to a volume. Since I did not have a license file, it just kept warning about that: alpr License file not found. Request failed with code 404.

Hello @maartenc were you able to successfully run platerecognizer? Let us know if we can help you more!

I didn’t succeed.
I’m waiting for platerecognizer to release a aarch64 version.

Not sure if there is another approach like emulating 32bit on the 64bit BalenaOS?

What error do you get now @maartenc ?

@maartenc the various license/token error messages appear to be coming from within the container, so it seems to be running under the 64 bit OS. Have you been able to provide a valid license/token to get past those messages and more towards ones that can provide additional insight about any compatibility issue between 32/64 bit?

After setting the token and license, there container just stops (crash?) without output.

On other platforms, it prints a message about the license consumption and it prints that the workers are started. And it keeps running.

@maartenc could you please confirm the device type of the fleet that you created?

Actually if you create a fleet for Raspberry Pi 3 (32 bits), deploy the code there and then add your Raspberry Pi 4? It will run a 32 bit container on the Raspberry Pi 4 (with 64 bit OS).

Reading the thread i’m not sure if you are running under these conditions or not. Could you please clarify? Thanks

Hello mpous,

I wasn’t aware that a aarch64 RPi4 could run inside a armv7hf fleet.
I’ve create a new fleet and moved the RPi4 into it.

I tried to run PlateRecognizer and uninstall the license on both fleets.
For comparison, I also added the output of the same commands on a working NUC device.

You can see that there is no PlateRecognizer output on the RPi4 beside the arch warning.
If we run the same PlateRecognizer image on RPi 32bit OS, it has the similar output as on the NUC.

RPi4 aarch64 on armv7hf fleet (moved from aarch64 fleet)

Run:

root@dbbe08e:~# balena run --rm -v 1926481_license:/license -e LICENSE_KEY=*** -e TOKEN=*** ac24f15c000f
WARNING: The requested image's platform (linux/arm) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

Uninstall license:

root@dbbe08e:~# balena run --rm -v 1926481_license:/license -e UNINSTALL=1 -e TOKEN=*** ac24f15c000f
WARNING: The requested image's platform (linux/arm) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

RPi4 aarch64 on aarch64 fleet (moved from armv7hf fleet)

Run:

root@dbbe08e:~# balena run --rm -v 1919856_license:/license -e LICENSE_KEY=*** -e TOKEN=*** ac24f15c000f
WARNING: The requested image's platform (linux/arm) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

Uninstall license:

root@dbbe08e:~# balena run --rm -v 1919856_license:/license -e UNINSTALL=1 -e TOKEN=*** ac24f15c000f
WARNING: The requested image's platform (linux/arm) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

NUC amd64 on amd64 fleet

Run:

root@f9e69c0:~# balena run --rm -e LICENSE_KEY=*** -v 1919848_platerecognizerLicense:/license -e TOKEN=***  b2e8fc363fff
PlateRecognizer v1.29.0
Starting online registration
You have used 8/20 license(s).
License Key: ***
Usage since 2022-03-27: 279/2500 calls.
Loading...
Loading detection zones.
[worker-0] Ready!
Closing Down...

Uninstall license:

root@f9e69c0:~# balena run --rm -e UNINSTALL=1 -v 1919848_platerecognizerLicense:/license -e TOKEN=***  b2e8fc363fff
PlateRecognizer v1.29.0
Successfully uninstalled SDK. You may now install it on another machine.

mmmm can you confirm that the base image that you use is 32 bits!

is it running on amd64 on balena @maartenc ?

Hello @maartenc after speaking with some colleagues about your error, did you try to run this on the Pi 4?

balena run --platform linux/arm --rm -v 1926481_license:/license -e LICENSE_KEY=*** -e TOKEN=*** ac24f15c000f

looks like it goes to the default platform instead of forcing to the linux/arm.

Let us know if this works!

Hello,

The base image platerecognizer/alpr-raspberry-pi is only available as 32bit.
If I inspect the image, it print arm for architecture.

It’s running fine on amd64 with image platerecognizer/alpr

I tried with the platform argument.
Now, it doesn’t print anything. Also the image platform warning log isn’t printed anymore.
So, I assume the platform is now 32bit.
But for some reason, the platerecognizer still doens’t start.

Do you see any logs now or just nothing?

Just nothing.

I tried running this on a 32 bit balenaOS on a Pi 3B+, but without a valid license file I just get “Environment variable TOKEN is missing or invalid. It is a 40 characters long string.” so it’s difficult to know if that works. Are you able to try on such a device to see if that makes a difference?

Hello @alanb128,

I tried it on a 3B+ with BalenaOS 32bit.
That works fine.

The output:

root@43390be:~# balena run --rm -v license:/license -e LICENSE_KEY=*** -e TOKEN=*** platerecognizer/alpr-raspberry-pi
PlateRecognizer v1.30.0
License Key: jZDNZjx44e
Usage since 2022-05-02: 0/2500 calls.
Loading...
Loading detection zones.
Closing Down...

Anything else I could try?

Hello @maartenc Alan asked internally to the balena team why is this not working. We will keep researching why it’s not working and we will let you know.

Thanks

Hello @maartenc we have been discussing internally and what is happening here is very strange. We do have other fleets running 32 bit containers on 64 bit OS. However in your case, this is not working.

Do you think you can contact with the PlateRecognizer company to understand what is happening inside the pre-built container? Thank you!