I'm attempting to create a virtual video device on raspberry pi 2 using v4l2loopback and prior installation of the v4l2loopback on their website in the Dependencies section they say that the kernel headers must be the same as the kernel where you want to use the module but on raspberry 2 it's not the same. The kernel installed is 4.1.17-v7+ and there are no headers with the same version e available on the repository so I need to get it by myself. I came across this thread but I don't know how to get the linux headers 4.1.17-v7 from //github.com/raspberrypi/linux/ to follow shig instructions and see what happens. Could you show me how to install linux headers 4.1.17-v7 on raspberry 2?

PS: Doing the following commands, I can install the v4l2loopback-dkms but when I do the modprobe command it says that the module v4l2loopback wasn't found.

sudo apt-get install v4l2loopback-dkms
sudo modprobe v4l2loopback

2 Answers 2


Update: You can also search for the headers here. Raspberry Pi 2's kernel header will have "-v7" in it. Download the appropriate version and run sudo dpkg -i [package]

  1. You could pull the kernel source code for 4.1.17-v7, cd into it, then run make_headers

  2. You could:

    # Get rpi-source
    sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source
    # Make it executable
    sudo chmod +x /usr/bin/rpi-source
    # Tell the update mechanism that this is the latest version of the script
    /usr/bin/rpi-source -q --tag-update
    # Get the kernel files thingies.

    If rpi-source throws a GCC error (something about a version mismatch), it's okay as long as your current GCC version is higher. Run rpi-source --skip-gcc instead of rpi-source

    The above instruction installs the whole kernel source code, not just the headers. After your current project, you could build a kernel with a custom splash screen maybe?



The following should install all needed to compile linux modules:

sudo apt-get install build-essential linux-headers-`uname -r` dkms

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.