I'm having problems with Motion's live stream going grey and saying unable to open video device.

I can get my live stream working by rebooting my PI and, following a reboot, entering the command sudo modprobe bcm2835-v4l2 (only with the command removed from the RC.local file).

But when I try and place it in the RC.local file to load the driver at boot, it doesn't work.

How can I make it work from boot?

This is where I've put the command in my RC.local file

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.      

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"

sudo modprobe bcm2835-v4l2

exit 0

3 Answers 3


I seem to have got it working by placing sudo modprobe bcm2835-v4l2 in the start section of /etc/init.d/motion and commenting out #export LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so

see the below code:

    if check_daemon_enabled ; then
        if ! [ -d /var/run/motion ]; then
                mkdir /var/run/motion
        chown motion:motion /var/run/motion

        #export LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so
        sudo modprobe bcm2835-v4l2

        chmod 777 /var/run/motion
        # this is the fix we've added to allow the network share to be connected first before we try to start motion:#

        sleep 30

        log_daemon_msg "Starting $DESC" "$NAME" 
        if start-stop-daemon --start --oknodo --exec $DAEMON -b --chuid motion ; then
            log_end_msg 0
            log_end_msg 1

I tried the answer mentioned and it didn't quite work for me. I did find that appending

# load camera driver

to /etc/modules worked like a charm. Obviously the commented out part is not necessary, but I always like having context when I need to go over something again.

  • What does the grave character do?
    – Elliott B
    Commented Jun 19, 2018 at 2:46

If the camera worked fine previously but then suddenly stopped working and shows a gray screen (e.g. in motion) then one possible reason might be that you used raspi-config and under Advanced Options > Memory Split have set a value lower than 128MB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.