# Camera not working on Zero2 + Balena-Cam

**URL:** <https://forums.balena.io/t/camera-not-working-on-zero2-balena-cam/353569>\
**Category:** balenaOS\
**Created:** [March 4, 2022, 8:00pm UTC](https://forums.balena.io/t/camera-not-working-on-zero2-balena-cam/353569 "2022-03-04T20:00:05Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![leon22](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@leon22](https://forums.balena.io/u/leon22)\
**Post date:** [March 4, 2022, 8:00pm UTC](https://forums.balena.io/t/camera-not-working-on-zero2-balena-cam/353569/1 "2022-03-04T20:00:05Z")

</div>

Output from the logs of my running Zero2 device with balena-cam:

```auto
04.03.22 20:54:09 (+0100) balena-cam from cryptography.hazmat.backends import default_backend
04.03.22 20:54:10 (+0100) balena-cam Video device is not ready
04.03.22 20:54:10 (+0100) balena-cam Trying to load bcm2835-v4l2 driver...
04.03.22 20:54:13 (+0100) Service exited 'balena-cam sha256:75027ec2c1867aa4c2f66e41ee2a4a2c5ad058ff6418258cac0a0b7977e35f10'

```

Same Camera was working with the old Raspberry Pi Zero.

**dmesg:**

```auto
root@602b67b:~# dmesg | grep bcm2835
[0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 video=Composite-1:720x480@60i smsc95xx.macaddr=B8:27:EB:6A:AA:0F vc_mem.mem_base=0x1fa00000 vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0 rootwait vt.global_cursor_default=0 console=null cgroup_enable=memory root=UUID=4933a0f6-0826-4423-996e-85631a5e9d12 rootwait
[0.143163] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[0.196754] bcm2835-dma 3f007000.dma: DMA legacy API manager, dmachans=0x1
[2.172906] bcm2835-rng 3f104000.rng: hwrng registered
[2.175391] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[2.717644] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[2.722417] mmc-bcm2835 3f300000.mmcnr: could not get clk, deferring probe
[2.724105] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe
[2.760945] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[2.763668] mmc-bcm2835 3f300000.mmcnr: mmc_debug:0 mmc_debug2:0
[2.763687] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated
[2.840123] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[17.989290] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[17.996597] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[17.999872] bcm2835_audio bcm2835_audio: there is not valid maps for state default
[18.107274] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[18.110853] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[18.200048] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[18.208927] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[18.211168] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[18.263545] bcm2835_mmal_vchiq: Failed to open VCHI service connection (status=-1)
[18.263772] bcm2835_mmal_vchiq: Failed to open VCHI service connection (status=-1)
[18.274586] bcm2835_mmal_vchiq: Failed to open VCHI service connection (status=-1)
[192.372559] bcm2835_dma_create_cb_chain+0x70/0x350
[192.372567] bcm2835_dma_prep_slave_sg+0x124/0x350
[192.372578] bcm2835_sdhost_request+0x3d8/0x670
[1078.433215] WARNING: CPU: 3 PID: 1783 at drivers/mmc/host/bcm2835-mmc.c:495 bcm2835_mmc_transfer_dma+0x210/0x238
[1078.433221] Modules linked in: ip6t_REJECT nf_reject_ipv6 ip6table_filter xt_state ipt_REJECT nf_reject_ipv4 ip6_tables xt_MASQUERADE nf_conntrack_netlink nfnetlink br_netfilter cmac algif_hash aes_arm64 algif_skcipher af_alg bnep hci_uart btbcm bluetooth ecdh_generic ecc xt_owner i2c_dev brcmfmac brcmutil sha256_generic bcm2835_isp(C) bcm2835_codec(C) bcm2835_v4l2(C) cfg80211 v4l2_mem2mem bcm2835_mmal_vchiq(C) videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops rfkill videobuf2_v4l2 videobuf2_common raspberrypi_hwmon videodev sdhci_iproc mc spi_bcm2835 snd_bcm2835(C) vc_sm_cma(C) uio_pdrv_genirq uio sch_fq_codel
[1078.433529] pc : bcm2835_mmc_transfer_dma+0x210/0x238
[1078.433537] lr : bcm2835_mmc_request+0xa4/0xc0
[1078.433746] bcm2835_mmc_transfer_dma+0x210/0x238
[1078.433754] bcm2835_mmc_request+0xa4/0xc0

```

Fleet custom configurations: (working values with Zero 1)

```auto
BALENA_HOST_CONFIG_gpu_mem_1024 448
BALENA_HOST_CONFIG_gpu_mem_256 192
BALENA_HOST_CONFIG_gpu_mem_512 256

```

Any idea why balena-cam is not running on my Raspberry Pi Zero2?

---

<div class="post-metadata">

**Author:** ![richard.galvez](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@richard.galvez](https://forums.balena.io/u/richard.galvez)\
**Post date:** [March 6, 2022, 4:10pm UTC](https://forums.balena.io/t/camera-not-working-on-zero2-balena-cam/353569/2 "2022-03-06T16:10:56Z")

</div>

Hi @leon22,

Are you building this as a multicontainer app (using docker-compose.yml) or is this a single Dockerfile build?

If it is docker-compose, do you mind sharing your docker-compose.yml file?

---

<div class="post-metadata">

**Author:** ![leon22](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@leon22](https://forums.balena.io/u/leon22)\
**Post date:** [March 6, 2022, 5:56pm UTC](https://forums.balena.io/t/camera-not-working-on-zero2-balena-cam/353569/3 "2022-03-06T17:56:38Z")

</div>

```auto
cat docker-compose.yml
version: '2'
services:
        balena-cam:
                build: ./balena-cam
                privileged: true
                restart: always
                network_mode: "host"
                labels:
                        io.balena.features.kernel-modules: '1'

```

---

<div class="post-metadata">

**Author:** ![fisehara](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/fisehara/32/6290_2.png) [@fisehara](https://forums.balena.io/u/fisehara)\
**Post date:** [March 7, 2022, 1:17pm UTC](https://forums.balena.io/t/camera-not-working-on-zero2-balena-cam/353569/4 "2022-03-07T13:17:55Z")

</div>

Hello,

According to the code that tries to load the camera: [balena-cam/server.py at master · balenalabs/balena-cam · GitHub](https://github.com/balenalabs/balena-cam/blob/master/balena-cam/app/server.py#L167-L175)  
Can you check on container level and on hostOS level if there are any `/dev/videoX` devices loaded and share the results?  
Can you check if you can run the `modprobe bcm2835-v4l2` on the container and on the hostOS level and share the results?

In addition, I’ve found this from RaspberryPi forums: [Pi Zero 2 W camera troubles - Raspberry Pi Forums](https://forums.raspberrypi.com/viewtopic.php?t=323308#p1937346)  
In the meantime, I’ll check if we have faced this issue already and found a solution to it.

Best Regards  
Harald

---

<div class="post-metadata">

**Author:** ![rahul-thakoor](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@rahul-thakoor](https://forums.balena.io/u/rahul-thakoor)\
**Post date:** [March 7, 2022, 3:57pm UTC](https://forums.balena.io/t/camera-not-working-on-zero2-balena-cam/353569/6 "2022-03-07T15:57:26Z")

</div>

Hey there  
Can you confirm if you have set up the required device configurations as described here: [GitHub - balenalabs/balena-cam: Network Camera with Raspberry Pi and WebRTC. Tutorial:](https://github.com/balenalabs/balena-cam#getting-started)

Thanks

---

<div class="post-metadata">

**Author:** ![leon22](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@leon22](https://forums.balena.io/u/leon22)\
**Post date:** [March 17, 2022, 11:34am UTC](https://forums.balena.io/t/camera-not-working-on-zero2-balena-cam/353569/10 "2022-03-17T11:34:50Z")

</div>

Here is the information you asked for:

> root@53e08c8:~# **ls /dev/video** \*  
> ls: cannot access ‘/dev/video\*’: No such file or directory  
> root@53e08c8:~# **modprobe bcm2835-v4l2**  
> root@53e08c8:~# dmesg | grep bcm2835  
> [0.000000] Kernel command line: coherent\_pool=1M 8250.nr\_uarts=1 snd\_bcm2835.enable\_compat\_alsa=0 snd\_bcm2835.enable\_hdmi=1 video=Composite-1:720x480@60i smsc95xx.macaddr=B8:27:EB:6A:AA:0F vc\_mem.mem\_base=0x1fa00000 vc\_mem.mem\_size=0x20000000 dwc\_otg.lpm\_enable=0 rootwait console=tty1 console=ttyS0,115200 cgroup\_enable=memory root=UUID=c0b74979-357f-4102-9485-8270681d7897 rootwait  
> [0.144647] bcm2835-mbox 3f00b880.mailbox: mailbox enabled  
> [0.198229] bcm2835-dma 3f007000.dma: DMA legacy API manager, dmachans=0x1  
> [2.236528] bcm2835-aux-uart 3f215040.serial: there is not valid maps for state default  
> [2.241295] bcm2835-rng 3f104000.rng: hwrng registered  
> [2.250144] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000  
> [2.885999] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer  
> [2.895413] mmc-bcm2835 3f300000.mmcnr: could not get clk, deferring probe  
> [2.898605] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe  
> [2.965648] bcm2835-aux-uart 3f215040.serial: there is not valid maps for state default  
> [4.228080] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver  
> [4.239787] mmc-bcm2835 3f300000.mmcnr: mmc\_debug:0 mmc\_debug2:0  
> [4.247447] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated  
> [4.354870] mmc0: sdhost-bcm2835 loaded - DMA enabled (\>1)  
> [20.164140] bcm2835\_vc\_sm\_cma\_probe: Videocore shared memory driver  
> [20.168243] snd\_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.214976] bcm2835\_audio bcm2835\_audio: there is not valid maps for state default  
> [20.276136] bcm2835\_mmal\_vchiq: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.276151] bcm2835\_mmal\_vchiq: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.281909] bcm2835\_mmal\_vchiq: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.294431] bcm2835\_v4l2: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.297696] bcm2835\_mmal\_vchiq: Failed to open VCHI service connection (status=-1)  
> [20.298018] bcm2835\_codec: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.310100] bcm2835\_isp: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.314674] bcm2835\_mmal\_vchiq: Failed to open VCHI service connection (status=-1)  
> [20.315926] bcm2835\_mmal\_vchiq: Failed to open VCHI service connection (status=-1)  
> root@53e08c8:~# ls /dev/video\*  
> ls: cannot access ‘/dev/video\*’: No such file or directory  
> root@53e08c8:~# modprobe bcm2835-v4l2  
> root@53e08c8:~# dmesg | grep bcm2835-v4l2  
> root@53e08c8:~# dmesg | grep bcm2835  
> [0.000000] Kernel command line: coherent\_pool=1M 8250.nr\_uarts=1 snd\_bcm2835.enable\_compat\_alsa=0 snd\_bcm2835.enable\_hdmi=1 video=Composite-1:720x480@60i smsc95xx.macaddr=B8:27:EB:6A:AA:0F vc\_mem.mem\_base=0x1fa00000 vc\_mem.mem\_size=0x20000000 dwc\_otg.lpm\_enable=0 rootwait console=tty1 console=ttyS0,115200 cgroup\_enable=memory root=UUID=c0b74979-357f-4102-9485-8270681d7897 rootwait  
> [0.144647] bcm2835-mbox 3f00b880.mailbox: mailbox enabled  
> [0.198229] bcm2835-dma 3f007000.dma: DMA legacy API manager, dmachans=0x1  
> [2.236528] bcm2835-aux-uart 3f215040.serial: there is not valid maps for state default  
> [2.241295] bcm2835-rng 3f104000.rng: hwrng registered  
> [2.250144] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000  
> [2.885999] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer  
> [2.895413] mmc-bcm2835 3f300000.mmcnr: could not get clk, deferring probe  
> [2.898605] sdhost-bcm2835 3f202000.mmc: could not get clk, deferring probe  
> [2.965648] bcm2835-aux-uart 3f215040.serial: there is not valid maps for state default  
> [4.228080] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver  
> [4.239787] mmc-bcm2835 3f300000.mmcnr: mmc\_debug:0 mmc\_debug2:0  
> [4.247447] mmc-bcm2835 3f300000.mmcnr: DMA channel allocated  
> [4.354870] mmc0: sdhost-bcm2835 loaded - DMA enabled (\>1)  
> [20.164140] bcm2835\_vc\_sm\_cma\_probe: Videocore shared memory driver  
> [20.168243] snd\_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.214976] bcm2835\_audio bcm2835\_audio: there is not valid maps for state default  
> [20.276136] bcm2835\_mmal\_vchiq: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.276151] bcm2835\_mmal\_vchiq: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.281909] bcm2835\_mmal\_vchiq: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.294431] bcm2835\_v4l2: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.297696] bcm2835\_mmal\_vchiq: Failed to open VCHI service connection (status=-1)  
> [20.298018] bcm2835\_codec: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.310100] bcm2835\_isp: module is from the staging directory, the quality is unknown, you have been warned.  
> [20.314674] bcm2835\_mmal\_vchiq: Failed to open VCHI service connection (status=-1)  
> [20.315926] bcm2835\_mmal\_vchiq: Failed to open VCHI service connection (status=-1)  
> root@53e08c8:~# **lsmod | grep bcm2835**  
> bcm2835\_isp 32768 0  
> bcm2835\_codec 49152 0  
> bcm2835\_v4l2 45056 0  
> v4l2\_mem2mem 40960 1 bcm2835\_codec  
> bcm2835\_mmal\_vchiq 40960 3 bcm2835\_codec,bcm2835\_v4l2,bcm2835\_isp  
> videobuf2\_dma\_contig 24576 2 bcm2835\_codec,bcm2835\_isp  
> videobuf2\_vmalloc 20480 1 bcm2835\_v4l2  
> videobuf2\_v4l2 32768 4 bcm2835\_codec,bcm2835\_v4l2,v4l2\_mem2mem,bcm2835\_isp  
> videobuf2\_common 61440 5 bcm2835\_codec,videobuf2\_v4l2,bcm2835\_v4l2,v4l2\_mem2mem,bcm2835\_isp  
> videodev 315392 6 bcm2835\_codec,videobuf2\_v4l2,bcm2835\_v4l2,videobuf2\_common,v4l2\_mem2mem,bcm2835\_isp  
> snd\_bcm2835 28672 0  
> spi\_bcm2835 24576 0  
> mc 61440 6 videodev,bcm2835\_codec,videobuf2\_v4l2,videobuf2\_common,v4l2\_mem2mem,bcm2835\_isp  
> vc\_sm\_cma 36864 2 bcm2835\_mmal\_vchiq,bcm2835\_isp

I’m not able to connect to the balena-cam service as it is in restarting mode all the time. One side comment: after switching off the power and on again the device is not able to reconnect to the belena servers.

I also tried with the newest balenaOS (v2.94.4) with no success.

The configuration parameters from [GitHub - balena-labs-projects/balena-cam: Network Camera with Raspberry Pi and WebRTC. Tutorial:](https://github.com/balenalabs/balena-cam#getting-started) are also set.

---

<div class="post-metadata">

**Author:** ![leon22](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@leon22](https://forums.balena.io/u/leon22)\
**Post date:** [March 26, 2022, 6:02pm UTC](https://forums.balena.io/t/camera-not-working-on-zero2-balena-cam/353569/11 "2022-03-26T18:02:57Z")

</div>

Any news?

I have not enough space to use a e.g. Raspberry Pi 4, so I depend on the RPZero2.

---

<div class="post-metadata">

**Author:** ![alanb128](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/alanb128/32/2839_2.png) [@alanb128](https://forums.balena.io/u/alanb128)\
**Post date:** [March 30, 2022, 4:49am UTC](https://forums.balena.io/t/camera-not-working-on-zero2-balena-cam/353569/12 "2022-03-30T04:49:18Z")

</div>

Hello, one of our community members recently provided an update to balenaCam that was just merged and it should no longer result in a restart loop. I have it successfully running on a Pi Zero 2W, however, I did have some issues with the memory settings. On a Zero 2W only, I would just set the GPU memory at 64 MB instead of the `BALENA_HOST_CONFIG_gpu_mem_` settings as described. You’ll still need to set `BALENA_HOST_CONFIG_start_x` to 1.

---

<div class="post-metadata">

**Author:** ![leon22](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@leon22](https://forums.balena.io/u/leon22)\
**Post date:** [March 31, 2022, 8:12pm UTC](https://forums.balena.io/t/camera-not-working-on-zero2-balena-cam/353569/14 "2022-03-31T20:12:51Z")

</div>

Thx, but the download process is not successful:

Downloading image ‘[registry2.balena-cloud.com/v2/](http://registry2.balena-cloud.com/v2/)…’ stuck at 58% for 40 minutes.

> 31.03.22 21:30:05 (+0200) Supervisor starting  
> 31.03.22 21:30:31 (+0200) Supervisor starting  
> 31.03.22 21:30:37 (+0200) Applying configuration change {“SUPERVISOR\_POLL\_INTERVAL”:“900000”,“SUPERVISOR\_DELTA”:“1”,“SUPERVISOR\_DELTA\_REQUEST\_TIMEOUT”:“59000”,“SUPERVISOR\_DELTA\_VERSION”:“3”}  
> 31.03.22 21:30:37 (+0200) Applying boot config: {“start\_x”:“1”,“gpu\_mem”:“64”,“avoid\_warnings”:“1”,“disable\_overscan”:“1”,“disable\_splash”:“1”,“dtoverlay”:[“vc4-fkms-v3d”],“dtparam”:[“audio=on”,“i2c\_arm=on”,“spi=on”,“audio=on”]}  
> 31.03.22 21:30:37 (+0200) Applied boot config: {“start\_x”:“1”,“gpu\_mem”:“64”,“avoid\_warnings”:“1”,“disable\_overscan”:“1”,“disable\_splash”:“1”,“dtoverlay”:[“vc4-fkms-v3d”],“dtparam”:[“audio=on”,“i2c\_arm=on”,“spi=on”,“audio=on”]}  
> 31.03.22 21:30:37 (+0200) Applying boot config: {}  
> 31.03.22 21:30:37 (+0200) Applied configuration change {“SUPERVISOR\_POLL\_INTERVAL”:“900000”,“SUPERVISOR\_DELTA”:“1”,“SUPERVISOR\_DELTA\_REQUEST\_TIMEOUT”:“59000”,“SUPERVISOR\_DELTA\_VERSION”:“3”}  
> 31.03.22 21:30:38 (+0200) Applied boot config: {}  
> 31.03.22 21:30:54 (+0200) Supervisor starting  
> 31.03.22 21:30:55 (+0200) Creating network ‘default’  
> 31.03.22 21:30:56 (+0200) Downloading image ‘[registry2.balena-cloud.com/v2/dd4736e127070395db180de1ebdd227d@sha256:c4cebfda0143d0db8aff1c7bd666589c3ad60b8d7684df2f2ee413a4dc1dedb9](http://registry2.balena-cloud.com/v2/dd4736e127070395db180de1ebdd227d@sha256:c4cebfda0143d0db8aff1c7bd666589c3ad60b8d7684df2f2ee413a4dc1dedb9)’  
> 31.03.22 21:31:16 (+0200) Supervisor starting  
> 31.03.22 21:31:17 (+0200) Downloading image ‘[registry2.balena-cloud.com/v2/dd4736e127070395db180de1ebdd227d@sha256:c4cebfda0143d0db8aff1c7bd666589c3ad60b8d7684df2f2ee413a4dc1dedb9](http://registry2.balena-cloud.com/v2/dd4736e127070395db180de1ebdd227d@sha256:c4cebfda0143d0db8aff1c7bd666589c3ad60b8d7684df2f2ee413a4dc1dedb9)’

Any more ideas?

Thx

PS: Very hard to install balena-cam on RPZero2. Had not expected so many problems.

---

<div class="post-metadata">

**Author:** ![alanb128](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/alanb128/32/2839_2.png) [@alanb128](https://forums.balena.io/u/alanb128)\
**Post date:** [April 1, 2022, 1:54am UTC](https://forums.balena.io/t/camera-not-working-on-zero2-balena-cam/353569/15 "2022-04-01T01:54:33Z")

</div>

I had some difficulty with the download as well but I’m not yet sure what the cause is. Eventually mine went through. I also plugged in a USB OTG Ethernet adapter just for the downloading and that worked immediately, which leads me to suspect a WiFi issue of some sort.

---

<div class="post-metadata">

**Author:** ![leon22](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@leon22](https://forums.balena.io/u/leon22)\
**Post date:** [April 2, 2022, 3:32pm UTC](https://forums.balena.io/t/camera-not-working-on-zero2-balena-cam/353569/16 "2022-04-02T15:32:09Z")

</div>

Thx!

Finally it is working. (I also used an USB-Ethernet adapter to successfully download the image)  
That was an odysee 😉
