`vcgencmd` not available in balenalib/raspberrypi4-64-node:10-stretch-run ?

I have a node.js app where I need to run the vcgencmd.

In this forum I could see that others had luck with getting node.js using balenalib/raspberrypi3-node:10-stretch-run image in Dockerfile

I’m actually using a Dockerfile.template like this:

FROM balenalib/%%BALENA_MACHINE_NAME%%-node:10-stretch-run

This works great for me on my RPi3.

However, when I create an app that has RPi4 as device type, and push to that app, it will pull the image
balenalib/raspberrypi4-64-node:10-stretch-run and for some reason, running vcgencmd inside that container will give us a command not found error.

How can it be that the same image behaves differently for RPi 3 and 4?

Also, I discovered, that if I simply hardcode FROM balenalib/raspberrypi3-node:10-stretch-run image in my Dockerfile instead of using a template, it works! I can run vcgencmd on both the RPi 3 and 4, using the RPi3 image.

How can that be?

For now, I could just hardcode the RPi 3 image for both device types, and cross my finger that it will keep working, but I don’t want to rely on “hacks” in my production environment, unless I understand the issue and the reason for the hack makes sense.

Hello, the images that you refer to above are not exactly the same, the raspberrypi4-64 one is a 64bit image and it doesn’t have the vcgencmd command. By hardcoding the image to balenalib/raspberrypi3-node:10-stretch-run you basically say that you want to run a 32bit container which has the vcgencmd which is a 32bit binary. For the support of such binaries as vcgencmd there is an issue in raspberrypi/firmware https://github.com/raspberrypi/firmware/issues/1118 that might provide you with more context.

In general even in some of our projects that might use videocore and 32bit specific binaries we do the same trick, see here https://github.com/balenalabs/balena-cam/tree/master/balena-cam the structure of the repo, we have a Dockerfile.template and a Dockerfile.aarch64 which is essentially the same as the template one but it uses a specific RPi3 image and is targeting Pi4s.

OK thanks for your response.

So it should be OK to use rpi3 images on an rpi4? I don’t care about 32/64 bits if it just works.

However, I found out that this project does not work if I try to run the rpi3 version on rpi4 hardware

So it should be OK to use rpi3 images on an rpi4? I don’t care about 32/64 bits if it just works.

If your app requires a specific binary and the binary is there and it works, then yes no problem at all.

About the browser project, from briefly checking it, I think it uses a 32bit container and it should work. If you think you’ve found an issue feel free to create a github issue on the project with your findings.