ambi-tv icon indicating copy to clipboard operation
ambi-tv copied to clipboard

Invalid Module Format

Open SchruteRampage opened this issue 11 years ago • 115 comments

Hello, I seem to have everything running a built correctly except I am getting one error that I can't figure out.

When I run the 'sudo insmod usbtv.ko' command when I am located in the usbtv folder, I get the error: could not insert module usbtv.ko: invalid module format.

Any ideas?

SchruteRampage avatar Aug 17 '13 21:08 SchruteRampage

"invalid module format" is usually the error message you get if you build a module for a different kernel (e.g. with different kernel headers and/or symbol file) than for the kernel you want to insert it into. make sure that the kernel headers/sources that you are using the build the module match the version of the kernel you are running.

the script I put in the "misc" folder works for me, but be aware that I just pulled this off a "gist" on github. If it doesn't install the right kernel headers for you, you can still pull them from the raspberry pi repository (they also keep the Module.symvers files for all their builds there).

gkaindl avatar Aug 18 '13 21:08 gkaindl

So I am at the point where I will send you $10 bucks to your paypal if you just take a few minutes and talk me through getting this setup. I'm not a linux guru and I can't figure out the usbtv driver. I spend a lot of money on the LED strips and the other parts, so I would really like this to get running. The script in the misc folder you were talking about was the get-kernel-source right? So does that script download the necessary files with your PAL alterations and it just happens that his script downloads the wrong headers/sources, which don't match the kernel running on my pi which is 3.6.11+?? Please let me know if you have time to just help me out until I get it working.

SchruteRampage avatar Aug 20 '13 01:08 SchruteRampage

I too am having this problem. Looking at dmesg and it is as you say, a version mismatch. I'm just not sure how.

andyclarke avatar Aug 20 '13 22:08 andyclarke

He said it has something to do with the file in the misc folder called "get-kernel-source", but the actual code inside this script pulls the newest version or the kernel's headers and source files or something like that, but it refuses to match with the 3.6.11+ kernel version running on the pi. I've worked on it for days and have not been able to figure it out lol

SchruteRampage avatar Aug 20 '13 23:08 SchruteRampage

Are you guys still having this issue? I remember hitting this as well, and I can look through my notes and post maybe more verbose steps to run the script and insert the proper modules in the proper order.

mjseid avatar Aug 22 '13 17:08 mjseid

Yeah still having the issue. And yes, your help would be awesome.

SchruteRampage avatar Aug 22 '13 18:08 SchruteRampage

Yes, I'm still having issues as well. I've tried several times running updates at different times. It seems to compile it against 3.6.11 and not 3.6.11+ Any help most appreciated.

andyclarke avatar Aug 22 '13 18:08 andyclarke

I am running the 3.6.11+ kernel and using his script it does pull down and compile the right versions for me. The script gets the current kernel version from uname so it knows which one to pull down.

Here's what I did to get it going: cd /abmi-tv/misc/ chmod 755 get-kernel-source.sh ./get-kernel-source.sh

You can verify the version of kernel your running with "uname -r" and you can verify the source the script pulled down by the following command "more /lib/modules/3.6.11+/build/arch/arm/kernel/asm-offsets.s | grep 3.6".

Now make the usbtv driver: cd usbtv-driver/ make && make install

_not sure if these are necessary, I was trying to get things working so might not be required_* apt-get install v4l-utils ffmpeg libcunit1-dev v4l2loopback-dkms v4l2loopback-source v4l2loopback-utils dov4l

Now you're ready to load the modules: * make sure you load these kernel modules, in order, they are required for the usbtv module to load** modprobe spi-bcm2708 modprobe videobuf2-vmalloc modprobe videobuf2-core insmod usbtv.ko

That should be enough to get it working. I want to load the modules automatically at boot so I also did the following: **** copy the usbtv driver ot the current kernel module path and rebuild module map cd /lib/modules/3.6.11+/kernel/drivers/media/video/ cp /ambi-tv/misc/usbtv-driver/usbtv.ko . depmod -a

and add the following lines to the end of /etc/modules so they are loaded automatically on boot: spi-bcm2708 videobuf2-vmalloc videobuf2-core usbtv

mjseid avatar Aug 22 '13 20:08 mjseid

Thank you for taking the time to post that. It is pretty much what I have done.

The problem is still with trying to load the usbtv.ko module. pi@raspberrypi ~/ambi-tv/misc/usbtv-driver $ sudo insmod usbtv.ko Error: could not insert module usbtv.ko: Invalid module format And dmesg shows: usbtv: disagrees about version of symbol module_layout

I have tried both before and after running rpi-update (with complete fresh installs inbetween and running the included script to get the shouce).

The only thing you appear to have done which is different to what I did, is when building the module I just typed build and you say you typed make && make install.

Trying that I get this other error:

pi@raspberrypi ~/ambi-tv/misc/usbtv-driver $ make && make install
make -C /lib/modules/3.6.11+/build  M=/home/pi/ambi-tv/misc/usbtv-driver modules
make[1]: Entering directory `/usr/src/linux-source-3.6.11+'
  CC [M]  /home/pi/ambi-tv/misc/usbtv-driver/usbtv.o
/home/pi/ambi-tv/misc/usbtv-driver/usbtv.c:561:8: warning: initialization from incompatible pointer type [enabled by default]
/home/pi/ambi-tv/misc/usbtv-driver/usbtv.c:561:8: warning: (near initialization for âusbtv_ioctl_ops.vidioc_s_stdâ) [enabled by default]
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/pi/ambi-tv/misc/usbtv-driver/usbtv.mod.o
  LD [M]  /home/pi/ambi-tv/misc/usbtv-driver/usbtv.ko
make[1]: Leaving directory `/usr/src/linux-source-3.6.11+'
make -C /lib/modules/3.6.11+/build  M=/home/pi/ambi-tv/misc/usbtv-driver modules_install
make[1]: Entering directory `/usr/src/linux-source-3.6.11+'
mkdir: cannot create directory `/lib/modules/3.6.11': Permission denied
make[1]: *** [_emodinst_] Error 1
make[1]: Leaving directory `/usr/src/linux-source-3.6.11+'
make: *** [install] Error 2

Where it still looks like it is looking for a 3.6.11 directory not 3.6.11+, but I could be wrong.

Thanks again.

andyclarke avatar Aug 22 '13 20:08 andyclarke

I'm not sure why, but the "make install" part the script dumps the .ko file into the 3.6.11 branch instead of the 3.6.11+ branch. That's why you have to manually insmod the file instead of just calling modprobe, b/c the install is not putting it into the right path for modprobe to find.

It should still result in a working module though. The errors you saw are b/c you were not using sudo...I have a bad habit of always doing things as root :)

Here's an example of what I see: root@raspberrypi:/ambi-tv/misc/usbtv-driver_temp# make clean make -C /lib/modules/3.6.11+/build M=/ambi-tv/misc/usbtv-driver_temp clean make[1]: Entering directory /usr/src/linux-source-3.6.11+' CLEAN /ambi-tv/misc/usbtv-driver_temp/.tmp_versions CLEAN /ambi-tv/misc/usbtv-driver_temp/Module.symvers make[1]: Leaving directory/usr/src/linux-source-3.6.11+' root@raspberrypi:/ambi-tv/misc/usbtv-driver_temp# ls Makefile Makefile.orig usbtv.c usbtv.c.orig root@raspberrypi:/ambi-tv/misc/usbtv-driver_temp# make && make install make -C /lib/modules/3.6.11+/build M=/ambi-tv/misc/usbtv-driver_temp modules make[1]: Entering directory /usr/src/linux-source-3.6.11+' CC [M] /ambi-tv/misc/usbtv-driver_temp/usbtv.o /ambi-tv/misc/usbtv-driver_temp/usbtv.c:561:8: warning: initialization from incompatible pointer type [enabled by default] /ambi-tv/misc/usbtv-driver_temp/usbtv.c:561:8: warning: (near initialization for ‘usbtv_ioctl_ops.vidioc_s_std’) [enabled by default] Building modules, stage 2. MODPOST 1 modules CC /ambi-tv/misc/usbtv-driver_temp/usbtv.mod.o LD [M] /ambi-tv/misc/usbtv-driver_temp/usbtv.ko make[1]: Leaving directory/usr/src/linux-source-3.6.11+' make -C /lib/modules/3.6.11+/build M=/ambi-tv/misc/usbtv-driver_temp modules_install make[1]: Entering directory /usr/src/linux-source-3.6.11+' INSTALL /ambi-tv/misc/usbtv-driver_temp/usbtv.ko DEPMOD 3.6.11 make[1]: Leaving directory/usr/src/linux-source-3.6.11+'

root@raspberrypi:/ambi-tv/misc/usbtv-driver_temp# ls /lib/modules/3.6.11/extra/ usbtv.ko v4l2loopback.ko root@raspberrypi:/ambi-tv/misc/usbtv-driver_temp#

mjseid avatar Aug 22 '13 21:08 mjseid

Thanks. Still no joy though.

For completeness, here are my versions. What does modinfo, vermagic say for you?

pi@raspberrypi ~/ambi-tv/misc/usbtv-driver $ modinfo usbtv.ko
filename:       /home/pi/ambi-tv/misc/usbtv-driver/usbtv.ko
license:        Dual BSD/GPL
description:    Fushicai USBTV007 Video Grabber Driver
author:         Lubomir Rintel
srcversion:     80355D8F592C82839914844
alias:          usb:v1B71p3002d*dc*dsc*dp*ic*isc*ip*in*
depends:        videobuf2-core,videodev,videobuf2-vmalloc
vermagic:       3.6.11 preempt mod_unload modversions ARMv6
pi@raspberrypi ~/ambi-tv/misc/usbtv-driver $ uname -r
3.6.11+
pi@raspberrypi ~/ambi-tv/misc/usbtv-driver $ more /lib/modules/3.6.11+/build/arch/arm/kernel/asm-offsets.s | grep 3.6
@ -I /usr/src/linux-source-3.6.11+/arch/arm/include
@ -include /usr/src/linux-source-3.6.11+/include/linux/kconfig.h

If I try running sudo make then it appears to try and compile the base source code??!

pi@raspberrypi ~/ambi-tv/misc/usbtv-driver $ sudo make
make -C /lib/modules/3.6.11+/build  M= modules
make[1]: Entering directory `/usr/src/linux-source-3.6.11+'
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[2]: `include/generated/mach-types.h' is up to date.
  CALL    scripts/checksyscalls.sh
  CC [M]  fs/9p/vfs_inode.o
  CC [M]  fs/9p/vfs_inode_dotl.o
  CC [M]  fs/9p/vfs_addr.o
  CC [M]  fs/9p/vfs_file.o
  CC [M]  fs/9p/vfs_dir.o
  CC [M]  fs/9p/vfs_dentry.o
  CC [M]  fs/9p/v9fs.o
  CC [M]  fs/9p/fid.o
  CC [M]  fs/9p/xattr.o
  CC [M]  fs/9p/xattr_user.o
  CC [M]  fs/9p/acl.o
  LD [M]  fs/9p/9p.o
  CC [M]  fs/btrfs/super.o
  CC [M]  fs/btrfs/ctree.o
^Cmake[3]: *** [fs/btrfs/ctree.o] Interrupt
make[2]: *** [fs/btrfs] Interrupt
make[1]: *** [fs] Interrupt
make: *** [all] Interrupt

All a bit odd. I'm sure it's something simple but it's beyond me at the moment!

andyclarke avatar Aug 22 '13 22:08 andyclarke

the instructions posted by @mjseid above is also what I do, except that I now realize that that yes, make install will put it into 3.6.11, rather than 3.6.11+ – unfortunately, that's a problem with the kernel headers package, not the Makefile (which just relies on the module build environment). so yes, you could copy the resulting .ko into your modules directory (somewhere, doesn't really matter) and run sudo depmod 3.6.11+

Also, there is not just "one" 3.6.11+ kernel, there are lots of sub-releases: As an example, the output of uname -rv currently returns 3.6.11+ #494 PREEMPT Fri Jul 5 15:30:31 BST 2013 (note the #494).

For everyone struggling with this, I'd recommend to open a root shell via sudo -s, then delete the currently installed kernel headers rm -rf /usr/src/linux-source-3.6.11+, remove the modules build link rm /lib/modules/3.6.11+/build, then run the downloader script again bash get-kernel-source.sh. Then try building and inserting the module again.

If there's anything more to it than just having the wrong kernel headers, I'd really like to figure this out, so that I can fix this for future users. I'm pretty sure it's just a version mismatch, though. Anyway, I'm re-opening this for now, even if the solution might just be an additional "warning" line in the docs ;-)

gkaindl avatar Aug 22 '13 23:08 gkaindl

So after removing the files and running the downloader script again, do we then build the usbtv make file and then use sudo depmod 3.6.11+ ? What directory do we have to be in to run that depmod command? I'm still getting the v4l2-grab failed to stat '/dev/video0' no such file or directory.

SchruteRampage avatar Aug 22 '13 23:08 SchruteRampage

I got the insmod usbtv.ko to work without any errors. But when I go to run the command bin/ambi-tv -f sample.conf, I still am getting the v4l2-grab: failed to stat ' /dev/video0' : 2 (no such file or directory). Which means the /dev/video0 directory is not getting made correct? What command should make the /dev/video0 folder? And does the easycap device need to be plugged in during any of this? I am wondering because I need my keyboard and mouse plugged in for installation purposes, but then I have to unplug one or the other to plug in the easycap dongel.

SchruteRampage avatar Aug 23 '13 02:08 SchruteRampage

@gkaindl Thanks for the reply. Your idea does sound like it should work but I gave it a quick try this morning before work and I still seemed to have the same problem. I will try again tonight. Talking about version numbers and mine is 3.6.11+ #528 after running rpi-update. Why is it so much newer than yours? Or have you not run update for a while. Could this be part of the problem? I did try before updating but will try again from fresh.

@SchruteRampage I'm pretty sure you will need it plugged in for it to load the video0 device. You don't need the mouse so you can use that port.

andyclarke avatar Aug 23 '13 07:08 andyclarke

I've tried a fresh install tonight. Flashed the SD Card and it reported 3.6.11+ #474 I did an apt-get update/upgrade. Ran rpi-update which took it up to #528

When running the get-kernel-source script it says: Installing kernel source for revision a0c98fa6bc0f... Not sure if that is the right version, I don't know how to search the github repo for commit revisions.

Tried to make the usbtv driver and still getting the same problem :(

modinfo vermagic always says 3.6.11. I would have thought this should be 3.6.11+

root@raspberrypi:/home/pi/ambi-tv/misc/usbtv-driver# modinfo usbtv.ko
filename:       /home/pi/ambi-tv/misc/usbtv-driver/usbtv.ko
license:        Dual BSD/GPL
description:    Fushicai USBTV007 Video Grabber Driver
author:         Lubomir Rintel
srcversion:     80355D8F592C82839914844
alias:          usb:v1B71p3002d*dc*dsc*dp*ic*isc*ip*in*
depends:        videobuf2-core,videodev,videobuf2-vmalloc
vermagic:       3.6.11 preempt mod_unload modversions ARMv6

dmesg says: usbtv: disagrees about version of symbol module_layout

Any further suggestions most appreciated.

andyclarke avatar Aug 23 '13 19:08 andyclarke

I had the same problems …

  • make sure, that if you do a 'lsusb', you see a device in the list, with ID 1b71:3002 ...

This is what worked form me:

  • Started with a fresh Debian Wheezy f(2013-07-26 edition)
  • I did NOT do the update/upgrade thingy
  • from within the /home/pi folder, I did: wget https://github.com/gkaindl/ambi-tv/archive/master.zip
  • next step, I unzipped master.zip
  • I did go into the misc folder, and did: sudo bash get-kernel-source.sh
  • when this finished, I did go into the usbtv-driver folder and did: make
  • next I created a folder "extra" within /lib/modules/3.6.11+ and copied the usbtv.ko into this new folder
  • next: sudo depmod 3.6.11+
  • sudo modprobe videobuf2_core
  • sudo modprobe videobuf2_vmalloc
  • sudo modprobe usbtv
  • You should now have a "video0" in the /dev
  • If this is OK, then you can add the following lines to /etc/modules videobuf2_core videobuf2_vmalloc usbtv
  • Reboot RPI, eeh voila, ambi-tv should work fine :-)
  • After this, I did the update/upgrade thingy …

I have 260 LEDs up-and-running, didn't need to overclock my RPI. (I'm using a REV. A model for my ambi-tv)

good luck, Kris

-=(http://www.digitalplayground.be)=- Where fun meets technology

Op 23-aug.-2013, om 21:47 heeft Andy [email protected] het volgende geschreven:

I've tried a fresh install tonight. Flashed the SD Card and it reported 3.6.11+ #474 I did an apt-get update/upgrade. Ran rpi-update which took it up to #528

When running the get-kernel-source script it says: Installing kernel source for revision a0c98fa6bc0f... Not sure if that is the right version, I don't know how to search the github repo for commit revisions.

Tried to make the usbtv driver and still getting the same problem :(

modinfo vermagic always says 3.6.11. I would have thought this should be 3.6.11+

root@raspberrypi:/home/pi/ambi-tv/misc/usbtv-driver# modinfo usbtv.ko filename: /home/pi/ambi-tv/misc/usbtv-driver/usbtv.ko license: Dual BSD/GPL description: Fushicai USBTV007 Video Grabber Driver author: Lubomir Rintel srcversion: 80355D8F592C82839914844 alias: usb:v1B71p3002d_dc_dsc_dp_ic_isc_ip_in_ depends: videobuf2-core,videodev,videobuf2-vmalloc vermagic: 3.6.11 preempt mod_unload modversions ARMv6 Any further suggestions most appreciated.

— Reply to this email directly or view it on GitHub.

sn00zerman avatar Aug 23 '13 20:08 sn00zerman

Thanks Kris. I have no idea what was different but I followed your instructions and it now seems to have worked! Maybe it was not doing the apt-get update/upgrade, not sure. But it has now loaded. Awesome! :)

andyclarke avatar Aug 23 '13 22:08 andyclarke

@sn00zerman , So I followed your directions exactly, but after doing sudo modprobe usbtv, there is no "video0" in the /dev directory. Also when did you run the make file inside the ambi-tv-master folder? Did you run it right after unzipping the master.zip archive ?? This is really getting on my nerves that the stupid video0 thing won't show up in my dev folder. And does the LED on your easycap dongle light up when its working? And do you have your white HDMI2AV box plugged into a laptop usb for power?

SchruteRampage avatar Aug 23 '13 22:08 SchruteRampage

@SchruteRampage It doesn't really matter when you build the main program.

If you haven't already, add these lines to the end of /etc/modules

spi-bcm2708
videobuf2-vmalloc
videobuf2-core
usbtv

Then reboot with your EasyCap connected. If you still have problems please post the output from lsmod and also the last few lines from dmesg.

andyclarke avatar Aug 23 '13 23:08 andyclarke

I added the lines to /etc/modules and the video0 is still not there.

Here is the lsmod output

module size used by usbtv 6366 0 videobuf2_core 26995 1 usbtv videodev 104342 2 usbtv,videobuf2_core media 13424 1 videodev videobuf2_vmalloc 2425 1 usbtv videobuf2_memops 2584 1 videobuf2_vmalloc spidev 5224 0 spi_bcm2708 4816 0 snd_bcm2835 16304 0 snd_pcm 77560 1 snd_bcm2835 snd_page_alloc 5145 1 snd_pcm snd_seq 53329 0 snd_seq_device 6438 1 snd_seq snd_timer 19998 2 snd_pcm,snd_seq snd 58447 5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device evdev 9426 2 leds_gpio 2235 0 led_class 3562 1 leds_gpio

And then the last few lines from dmesg

Linux media interface: v0.10 Linux video capture interface v2.00 usbcore: registered new interface driver usbtv smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1 bcm2835-cpufreq: switching to governor ondemand bcm2835-cpufreq: switching to governor ondemand Adding 102396k swap on /var/swap. Priority:-1 xtends:2 across:507900k SS

SchruteRampage avatar Aug 23 '13 23:08 SchruteRampage

Could you do a lsusb as well please.

andyclarke avatar Aug 23 '13 23:08 andyclarke

It's almost 2 a.m. Here. Can you post your output of lsusb?

Verzonden van op mijn Acer Iconia Android tablet

SchruteRampage [email protected]:

I added the lines to /etc/modules and the video0 is still not there.

Here is the lsmod output

module size used by usbtv 6366 0 videobuf2_core 26995 1 usbtv videodev 104342 2 usbtv,videobuf2_core media 13424 1 videodev videobuf2_vmalloc 2425 1 usbtv videobuf2_memops 2584 1 videobuf2_vmalloc spidev 5224 0 spi_bcm2708 4816 0 snd_bcm2835 16304 0 snd_pcm 77560 1 snd_bcm2835 snd_page_alloc 5145 1 snd_pcm snd_seq 53329 0 snd_seq_device 6438 1 snd_seq snd_timer 19998 2 snd_pcm,snd_seq snd 58447 5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device evdev 9426 2 leds_gpio 2235 0 led_class 3562 1 leds_gpio

And then the last few lines from dmesg

Linux media interface: v0.10 Linux video capture interface v2.00 usbcore: registered new interface driver usbtv smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1 bcm2835-cpufreq: switching to governor ondemand bcm2835-cpufreq: switching to governor ondemand Adding 102396k swap on /var/swap. Priority:-1 xtends:2 across:507900k SS


Reply to this email directly or view it on GitHub: https://github.com/gkaindl/ambi-tv/issues/7#issuecomment-23197755

sn00zerman avatar Aug 23 '13 23:08 sn00zerman

Output of lsusb

Device 002: ID 0424:9512 Standard microsystems corp Device 001: ID 1d6b:0002 Linux foundation 2.0 root hub Device 003: ID 0424:ec00 Standard irosystems corp Device 004: ID 04d9:1603 Holtek semiconductor, inc. keyboard

SchruteRampage avatar Aug 23 '13 23:08 SchruteRampage

From that, to me, it doesn't look like your EasyCap is plugged in. Is it? If it is, are you using an extension cable or hub?

andyclarke avatar Aug 23 '13 23:08 andyclarke

Its plugged in, but its using the extender usb cable that came with it....that shouldn't matter should it?

Well it must of, I just plugged it directly in and the light is on now. I'm going to reboot and hopefully it should work now

SchruteRampage avatar Aug 23 '13 23:08 SchruteRampage

It was causing problems for someone else. Can you try with out it? Or through a powered USB hub?

andyclarke avatar Aug 23 '13 23:08 andyclarke

Ok, the program is now running and there is a "video0" ....So what commands do I have to run if the pi gets rebooted? Do I just need to run the ambi-tv program?

SchruteRampage avatar Aug 24 '13 00:08 SchruteRampage

I'm still not getting any output from the LED's, but the program seems to be running fine. And just so I'm correct, only the video cable needs to be plugged into the HDMI2AV box correct? The red and white audio cables are not utilized right? If the program says its running, then does that mean I might have a wiring issues? Also, on the LED strip it says the two inner traces are the DI and CI...those stand for dat and clock correct?

And I also have 3 full meters of LED strip plugged in, so would I have to change anything in the sample.conf file to get the test to work? Or should the number of LED's not matter if it's only for testing ?

SchruteRampage avatar Aug 24 '13 00:08 SchruteRampage

After a reboot you should just need to run the ambi-tvi program.

You are correct in that you only need the yellow video cable.

If the program is running and everything has power then I would guess it is a wiring problem. You could also try selecting the mood-light program (by pressing spacebar when ambi-tv is running to cycle through the different modes) to test your lights are working regardless of the video input.

You will need to change the configuration file to tell it how your lights are arranged. See the main docs for details on how the numbering system works.

andyclarke avatar Aug 24 '13 10:08 andyclarke