Skip to content

TFTP/NFS booted Pi 3 Model B+ locks up when using official V4L2 driver #2963

Closed

Description

@jorisvervuurt

When booting a Raspberry Pi 3 Model B+ via TFTP/NFS (no SD card), there seems to be an issue with the official V4L2 driver. When trying to access /dev/video0, the entire Pi locks up.

I have the following setup:

  • Ubiquiti EdgeRouter X
  • Synology DiskStation DS715
  • Raspberry Pi 3 Model B+ (clean install of the latest Raspbian Stretch Lite image)

I have configured a number of VLANs on the EdgeRouter X:

  • Synology DiskStation DS715 is on the 192.168.10.x subnet (IP 192.168.10.6)
  • Raspberry Pi 3 Model B+ is on the 192.168.40.x subnet (IP 192.168.40.2)

The Synology NAS acts as a TFTP server for the boot files and NFS server for the root filesystem; bootcode.bin is in the TFTP root directory, the rest of the boot files are in the <serial>/ directory. I have configured the Ubiquiti router’s DHCP server to add option 43 and provide the correct IP to the TFTP server. Booting the Pi from the NAS works perfectly fine without any errors. I’ve edited /etc/fstab to mount the <serial>/ boot file directory as /boot (this allows me to edit the boot files from the network-booted Pi).

I have added bcm2835-v4l2 to the /etc/modules file.
After a reboot, /dev/video0 is available so it appears the V4L2 driver has loaded correctly.

I use v4l2rtspserver to serve an RTSP stream of /dev/video0, which works perfectly fine when the Pi is booted from an SD card (both the boot files and the root filesystem). As soon as I switch to full TFTP/NFS boot without an SD card, executing v4l2rtspserver completely locks up the Pi.

I've compiled and installed v4l2rtspserver as follows:

sudo apt-get install git cmake
git clone https://github.com/mpromonet/v4l2rtspserver.git
cd v4l2rtspserver && cmake . && make
sudo cp v4l2rtspserver /usr/local/bin/
cd .. && rm -rf v4l2rtspserver

This is where things become weird, because raspivid seems to work just fine. After running raspivid, the v4l2rtspserver command works just fine as well... I’ve tried running sudo rpi-update (and of course replaced the bootcode.bin file in the TFTP root directory) but unfortunately that didn't fix the issue either.

I then came across these two issues on GitHub:
#2335
#2528

So, I created bcmhi.c with the following content:

#include "bcm_host.h"

int main(int argc, char* argv)
{
  bcm_host_init();
  return 0;
}

I then compiled it using sudo gcc bcmhi.c -I/opt/vc/include -L/opt/vc/lib -lbcm_host -o /usr/local/bin/bcmhi. When I executed bcmhi && v4l2rtspserver, the Pi no longer locked up and everything worked as it should (even after a reboot without running raspivid first).

So, in short, the issue is that bcm_host_init() needs to be called before /dev/video0 is usable. However, the weird thing is that this is only needed when the Pi is booted from TFTP/NFS without an SD card.

Activity

  1. changed the title [-]TFTP/NFS booted Pi 3 Model B+ freezes when using official V4L2 driver[/-] [+]TFTP/NFS booted Pi 3 Model B+ locks up when using official V4L2 driver[/+] on May 11, 2019
  2. 6by9 commented on May 11, 2019

    @6by9
    Contributor

    As requested in the template for issues, please provide your kernel and firmware version.

    System
    Copy and paste the results of the raspinfo command in to this section. Alternatively, copy and paste a pastebin link, or add answers to the following questions:

    • Which model of Raspberry Pi? e.g. Pi3B+, PiZeroW
    • Which OS and version (cat /etc/rpi-issue)?
    • Which firmware version (vcgencmd version)?
    • Which kernel version (uname -a)?

    The fix for #2335 and #2528 was merged May 2018 so I was believing the issue was resolved.

  3. jorisvervuurt commented on May 11, 2019

    @jorisvervuurt
    Author

    Thanks for your reply.
    Here’s the info you requested:

    • Which model of Raspberry Pi?
      Pi3B+

    • Which OS and version (cat /etc/rpi-issue)?
      Raspberry Pi reference 2019-04-08
      Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, e910bf55ac92e27c6e77043e8995bcb5e0a2d742, stage2

    • Which firmware version (vcgencmd version)?
      Mar 27 2019 15:48:59
      Copyright (c) 2012 Broadcom
      version 2e98b31d18547962e564bdf88e57b3df7085c29b (clean) (release) (start_x)

    • Which kernel version (uname -a)?
      Linux rpi-at 4.14.98-v7+ Add FBUNSUPPORTED ioctl for bcm2708_fb #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux

    The issue as mentioned in the other threads indeed seems to be fixed, as loading the module (either via modprobe or via /etc/modules) no longer locks up the Pi. This issue however, seems to be somewhat related to the other two issues (same bcm_host_init() workaround)...

    Thanks again!

  4. vintozver commented on Aug 14, 2019

    @vintozver

    Having the same issue on both 3B and 3B+ (latest raspbian/kernel as of today)

  5. alkisg commented on Jan 19, 2020

    @alkisg

    I too have the same issue on both rpi2 and rpi3b+, but not on rpi4.
    I commented on the "original thread" at #2335 (comment).

  6. JamesH65 commented on Feb 13, 2020

    @JamesH65
    Contributor

    @alkisg Are you using the latest Raspbian Buster?

  7. added
    Waiting for external input
    on Feb 13, 2020
  8. alkisg commented on Feb 13, 2020

    @alkisg

    @JamesH65, I had the latest Raspbian Buster when I commented 25 days ago.

    If I recall correctly, there was a kernel update since then, do you want me to test with that one too?

  9. JamesH65 commented on Feb 13, 2020

    @JamesH65
    Contributor

    So still present with that Buster then, might be worth am apt full-upgrade but suspect it's still broken. Thanks for the report.

  10. alkisg commented on Feb 14, 2020

    @alkisg

    @JamesH65, I just ran apt full-upgrade in my Buster installation and I cannot reproduce this anymore with the latest 4.19.97-v7+ kernel.
    I tested 3 boots on an rpi3b+ and 2 boots on an rpi2. They booted fine over NFS-RW without having to specify modprobe.blacklist=bcm2835_v4l2 in cmdline.txt.

    Thanks a lot, seems like problem solved; hopefully the others will confirm it as well.

  11. JamesH65 commented on Feb 14, 2020

    @JamesH65
    Contributor

    Great, will give it a few days, if nothing bad turns up, will close.

  12. added
    Close within 30 days
    and removed
    Waiting for external input
    on Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Close within 30 days

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions