Problem launching balenaCam

Hi, so I successfully pushed the code for balenaCam to my Rpi4. I followed all the instructions on the GitHub page and It seems that my Rpi4 is stuck in a loop of trying and ultimately failing to initiate the bcm2835-v4l2 driver. It ultimately exits the service and tries to boot it again but to no avail. I looked on the forums and I edited the source code at line 168 to say “if not os.path.exists(’/dev/video1’)” instead of “if not os.path.exists(’/dev/video0’)” as per instructions in a previous forum post about a person that encountered the same issue. I pushed that updated code to my device and im still having the same issue. When I click the public link, it says that “tunneling socket could not be established: 500”. Can anyone help me out with this issue?

Hi

  • About the public link: If the service isn’t online, and the device is restarting, it’s expected that the tunneling part won’t work. So that’s just an effect of the first problem.
  • Can you share the device logs that you see?

Here is a screenshot of the log for the device.

Hi @thomas.cullen,

Have you enabled the various gpu_mem variables per the balenaCam README? Also, in the HostOS, are you seeing your /dev/video1 (or similar)? I noticed, too, that the balenaCam repo has line 31 (#RUN printf "bcm2835-v4l2\n" >> /etc/modules) commented out. If that’s true in your version, the module likely isn’t getting loaded. Can you confirm that line is uncommented in your Dockerfile.template?

John

1.) So I uncommented line 31 in the Dockerfile.template and I reuploaded it to my device…nothing changed and the logs are still saying that there is an issue.
2.) How do I go about checking in the hostOS terminal session that I am seeing /dev/video1?
3.) I have attached what i set as the gpu_mem variables for the device.

Hey, to check if /dev/video1 exists, you can do ls /dev | grep video and please paste the output here, it should give us more information to diagnose this.

root@7499973:~# ls /dev | grep video
video10
video11
video12

This is what I see as a result of running that command in terminal of the Host OS.

Hi Thomas, well, that seems strange that they are being enumerated as video10 through 12, but I suppose it is now worth trying to go back to the information in your first post, where you mention line 168 needing to be updated, and giving it a try with these values instead. Out of curiosity, this Pi 4 that you are using, how much memory does it have? Is it a 2gb RAM model?

These values are after editing line 168 and reuploading the image to the Rpi. And yes, my Rpi 4 has 2gb of RAM.

Hi, can you mention the link to the forum post that you used to make the edit to the source code. Thanks!


It was a post previously made in this thread.

Hi @thomas.cullen – thanks for the additional details. Just to make sure we’re on the same page, let me see if I understand correctly:

  • Your Pi4 has video devices /dev/video10, /dev/video11 and /dev/video12
  • You’ve made a couple changes to your local copy of the balenaCam source code:
  • You’ve changed line 168 of app/server.py to look for /dev/video10
  • You’ve uncommented this line of Dockerfile.template, so that the kernel module for the camera will be loaded when the containe starts
  • After pushing all of that to your device, you are still having the same problem where the container restarts in a loop, and the logs say Video device is not ready / Trying to load bcm2835-vl42 over and over again

Can you confirm that I’ve got that right?

Assuming for the moment that I do:

  • As we mentioned before, it looks as though the device is coming up with a different name than the balenaCam source code expects (video10 instead of video0). This expectation is built into the software right now, but there is an issue to address this. You can log into Github to watch that issue, and you’ll get notified when it’s addressed.
  • Are you able to run the ls /dev | grep video command from within the balena-cam container, and at the same time do it in the Host OS as well? It would be good to confirm that both have the same view of things – if the container, for some reason, can’t see the devices that the Host OS can, then it would definitely cause problems.
  • Can you run vcgencmd get_camera in the Host OS and post the output, to see if the camera is being detected?

All the best,

Hugh

You’ve got that all right, except for the fact that I changed line 168 of the app/server.py to look for /dev/video1 but not /dev/video10.

Thank you for the suggestions, ill give them a try and get back to you.

When I try to run ls /dev | grep video in the balenacam container, I get a repeating error that says…

Error response from daemon: Container 857d2710264fc5ab51957866596291c39ebb23bcba8f21c3e590831b85334dad is restarting, wait until the container is running
Error response from daemon: Container 857d2710264fc5ab51957866596291c39ebb23bcba8f21c3e590831b85334dad is restarting, wait until the container is running
SSH session disconnected
SSH reconnecting…
Spawning shell…

In terms of what I get when I run vcgencmd get_camera in the host os, I get this response…

root@7499973:~# vcgencmd get_camera
supported=1 detected=0

Hi @thomas.cullen,

The error shows that the container is not able to restart. Perhaps a change you made is preventing a start. Can you share the device service logs?

Thanks,
John


this is a snapshot of the log that is repeating.

Hi,

Have you tried running a modprobe bcm2835-v4l2 in a Dockerfile.template CMD? You could try this from the command line, too, and then rerun your vcgencmd get_camera. If the result is good, then you can add the modprobe before the server.py script.

John