Running cec-client on RPi

Hi, I try for hours to get the cec-client working in a Node Docker Container.

FROM balenalib/%%RESIN_MACHINE_NAME%%-node:build as build
COPY package.json package.json
RUN npm install --only=production

# The run time container that will go to devices
FROM balenalib/%%RESIN_MACHINE_NAME%%-node:run

# install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends cec-utils

# Grab our node modules for the build step
COPY --from=build ./node_modules ./node_modules
COPY eis-api.js eis-api.js

CMD ["node", "eis-api.js"]

But I when I try to connect to the CEC Device I get the following error:

root@f2c57ff5760c:/# cec-client
No device type given. Using 'recording device'
CEC Parser created - libCEC version 4.0.4
no serial port given. trying autodetect: FAILED

The running container is running in priviliged mode and also has the device /dev/vchiq and /dev/ttyACM0 mounted. Do you have an idea how to get the cec-client working in a BalenaOS Docker Container?


Hi @holg,

I am not familiar with the project you are trying to build, though I searched for the error and I found this can you try running tvservice -m CEC ? And see if the monitor is supporting CEC. Also can you explain to me a bit about the project?


Hi @mbalamat,

it seems that there is no package for tvservice on the balenaOS Raspberry Image. Is it possible that I need the cec-utils Package explicity for raspberry or from raspbian deb source?

I don’t know if the problem is the docker container running on raspberry. In some documents I find that cec-client is using device “RPI” to communicate with the cec Controller. But that is not an normal device like /dev/vchiq or anything else. So it seems that there is another connection and perhaps I do need a special cec-client Version for raspberry.


hey @holg

Can you try to use the raspbian base image instead?
You should change it to FROM balenalib/rpi-raspbian

You might have to install nodejs in the base image.

You can install packages using our install_packages utility. tvservice is already included in the base image and you can install cec utility using RUN install_packages cec-utils

We have colleagues who have been successful in using both cec-utils and tvservice.
Hope this helps

I now tried to use the raspberry image but the qemu seems not to support arm1176 on my machine.

[Build]   eis-api      Step 3/8 : RUN ["/tmp/qemu-execve","-execve","/bin/sh","-c","install_packages nodejs cec-utils"]
[Build]   eis-api       ---> Running in 22cf5f561530
[Build]   eis-api      unable to find CPU model 'arm1176'

What else should I have to install?

hello, can you please share more details regarding your device? which Raspberry Pi is it?

To make sure that we talk about the same: I try to build the Application on an Ubuntu VM with emulated Command: “balena deploy eis-rpi4-beta --source ./ --emulated --build --logs”
That fails now. The target machine is a RPi 4.

My Dockerfile lookl now like this:

FROM balenalib/rpi-raspbian

# install dependencies
RUN install_packages nodejs cec-utils

COPY package.json package.json
RUN npm install --only=production

COPY eis-api.js eis-api.js

CMD ["/bin/sh", ""]

Hi there, I’ve tested this on macOS and the step RUN install_packages nodejs cec-utils appears to build fine for both balena build --deviceType raspberrypi4-64 --arch aarch64 and --deviceType raspberrypi4-64 --arch armv7l.

Are you able to try the build natively without using a VM and/or git push directly to our builders, which have native ARM support?

I tried a few things now an i’m really desperated. Beacause it didn’t worked on my Azure VM I now try to build the Image directly on my RPi 4 in Local Mode. My Dockerfile looks like that:

FROM balenalib/rpi-raspbian


# install dependencies
RUN install_packages tar cec-utils
RUN uname -a
RUN curl -skL | sudo -E bash - 
RUN apt-get install -y nodejs 
RUN node -v
RUN npm -v
COPY package.json package.json
RUN npm install --only=production

COPY eis-api.js eis-api.js

CMD ["/bin/sh", ""]

But now I can’t install node beacuse the compiled releases doesn’t exist for the aarc64 architecture.

This is the output of the uname -a command:
Linux 0355e9428ea6 4.19.75 #1 SMP PREEMPT Mon Mar 23 11:50:49 UTC 2020 aarch64 GNU/Linux

Can you explain to me which architecture is used von RPI 3B+ and RPi 4 (my Target systems). My RPi 4 (Raspberry Pi 4 Model B Rev 1.1) with original Raspbian has an armv71 Architecture, the one with balena OS Image has aarch64. It’s confusing me. I think thats the reason why pre-build Packages like cec-client or now NodeJS for RPi doesnt work on balenaOS?!?
My Application (a simple Kiosk Browser) work until I setup another service which should provide a node Server to switch the TV on and off by using the cec-client. This failes now.

Can you give me another hint?


  • To answer your question - we have a 64 bit variant of the balenaOS. You can find more about it here. Are you trying to use that?
  • If you take a look at our devices page, you will find what BALENA_ARCH is used for each device type. See here. You can find that RPi3 has armv7hf as well as aarch64.
  • Can you share your error log?

Ok I got some more information. When I try to build the container without node on my RPi 4 in Local mode. The build succeeds and i can use cec-client. But when I build this on my Azure VM with emulated flag and --arch aarch64 the build failes with following message:

[Build]   eis-api      Step 4/8 : RUN ["/tmp/qemu-execve","-execve","/bin/sh","-c","install_packages tar cec-utils"]
[Build]   eis-api       ---> Running in 5378ad26427c
[Build]   eis-api      unable to find CPU model 'arm1176'

Where does the CPU model ‘arm1176’ comes from? Why does the architecture changes for this command or image?BalenaDeployErrorLog.log (6.7 KB)

So it seems that the rpi-raspbian Image is only for RPi3? But with this Image cec-client works but a) I’m not able to install node and b) I can build this Image only on my Raspberry. Not with qemu emulation.

When I use an aarch64 Image the cec-client doesn’t work and can’t communicate with the attached TV.

Does anybody has an idea how to setup a Container which use the aarch64 Architecture and has a running cec-client for raspberry in it?

Hi @holg, I see what’s you mean, if the balenalib/rpi-raspbian works for you regarding the ceclib and you want a specific node version that it is not pre-built for you, you can compile it from the source code here .

Tell us if that works for you!