[Solved] vboxdrv.ko): Invalid module format

Discussions related to using VirtualBox on Linux hosts.
Wayne Sallee
Posts: 14
Joined: 30. May 2009, 20:50
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Win 3.1, Win 8, and many more
Location: Florida
Contact:

[Solved] vboxdrv.ko): Invalid module format

Post by Wayne Sallee »

I can't get Virtualbox to work on any built kernels from kernel.org.

I get error statement telling me to /etc/init.d/vboxdrv setup
I run it and get error from DKMS stating that an error occurs when running modprobe vboxdrv.

So I run modprobe vboxdrv
and get FATAL: Error inserting vboxdrv (/lib/modules/3.2.7/misc/vboxdrv.ko): Invalid module format

What am I missing?

Wayne Sallee
Wayne@WayneSallee.com
Last edited by Wayne Sallee on 24. Feb 2012, 01:48, edited 1 time in total.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: vboxdrv.ko): Invalid module format

Post by Perryg »

Without some real information all that anyone can do is guess. Do you have the appropriate headers, and other required packages to be able to install and run VirtualBox?
Wayne Sallee
Posts: 14
Joined: 30. May 2009, 20:50
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Win 3.1, Win 8, and many more
Location: Florida
Contact:

Re: vboxdrv.ko): Invalid module format

Post by Wayne Sallee »

Perryg wrote:Without some real information all that anyone can do is guess. Do you have the appropriate headers, and other required packages to be able to install and run VirtualBox?
I think I do have the headers, but how can I make sure that I do have the headers?

Here's the method I use to build the kernel:
and yes I use root(considered dangerous); no comments needed on that.
Compiling A Linux Kernel

use make -j4 for dual core to speed it up; use a number that's 2 times the numer of cores.

extract kernel tar file
copy extracted kernel to /usr/src

su -
# cd /usr/src
# chown -R root:root linux-2.6.39.99
# cd linux-2.6.39.99
# make mrproper,,,,, while this is running ,,,,,
copy the .config file of the previouse kernel from /boot into /usr/src/linux-2.6.39.99 and rename it to .config or don't bother if you want to start with the new kernel's defaults.

# make menuconfig
This will automaticaly load up the .config file you copied over and will update new options, and allow you to make changes.

# make v=2 2>&1 | tee log.build.log
or # make -j4 v=2 2>&1 | tee log.build.log
This will take about 1.5 hours or so; without the -j4.

# make modules_install 2>&1 | tee log.install_modules.log
or # make -j4 modules_install 2>&1 | tee log.install_modules.log

# make v=2 install 2>&1 | tee log.install.log
This will also add it to /boot/grub/menu.lst , but if you want it to default to boot, edit menulist to set default boot.
Where it says "default " "default 0" boots the first one on the list, and "default 13" boots the 14th one on the list.
Wayne Sallee
Wayne@WayneSallee.com
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: vboxdrv.ko): Invalid module format

Post by Perryg »

Code: Select all

dpkg -l | grep linux-headers
And they match your running kernel.
But this is just the beginning. You need to make sure that you have the additional packages to build external modules like VirtualBox.
Wayne Sallee
Posts: 14
Joined: 30. May 2009, 20:50
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Win 3.1, Win 8, and many more
Location: Florida
Contact:

Re: vboxdrv.ko): Invalid module format

Post by Wayne Sallee »

.
.
Edit: My distro uses rpms, not deb packages so this code won't work for my distro. That's why the following won't work.

.
Perryg wrote:

Code: Select all

dpkg -l | grep linux-headers
Well this is interesting:

Code: Select all

dpkg -l | grep linux-headers
dpkg-query: failed to open package info file `/var/lib/dpkg/status' for reading: No such file or directory
I was surprised to see that response, now to figure out why I get that response.

Checking the file system I see that
"/var/lib/dpkg/"
is there, but "status" is not in that directory.

Wayne Sallee
Wayne@WayneSallee.com
Wayne Sallee
Posts: 14
Joined: 30. May 2009, 20:50
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Win 3.1, Win 8, and many more
Location: Florida
Contact:

Re: vboxdrv.ko): Invalid module format

Post by Wayne Sallee »

Looks like the equvilency is

Code: Select all

rpm -qa | grep kernel | grep devel

Code: Select all

rpm -qa | grep kernel | grep devel
kernel-desktop586-devel-2.6.33.7-2mnb-1-1mnb2
kernel-server-devel-2.6.36.2-2mnb-1-1mnb2
kernel-desktop586-devel-2.6.31.12-3mnb-1-1mnb2
kernel-server-devel-latest-2.6.33.7-2mnb2
kernel-desktop586-devel-2.6.31.13-1mnb-1-1mnb2
kernel-desktop586-devel-2.6.33.7-1mnb-1-1mnb2
kernel-server-devel-2.6.38.7-1mnb2-1-1
kernel-desktop586-devel-2.6.33.5-2mnb-1-1mnb2
kernel-desktop-devel-2.6.33.7-2mnb-1-1mnb2
kernel-desktop-devel-2.6.31.13-1mnb-1-1mnb2
kernel-desktop-devel-2.6.31.12-3mnb-1-1mnb2
kernel-desktop-devel-2.6.38.7-1mnb2-1-1
kernel-server-devel-2.6.33.7-2mnb-1-1mnb2
kernel-desktop-devel-latest-2.6.33.7-2mnb2
kernel-desktop-devel-2.6.33.7-1mnb-1-1mnb2
kernel-server-devel-2.6.33.5-2mnb-1-1mnb2
kernel-desktop-devel-2.6.33.5-2mnb-1-1mnb2
kernel-desktop-devel-2.6.36.2-2mnb-1-1mnb2
kernel-desktop586-devel-latest-2.6.33.7-2mnb2
kernel-linus-devel-3.0.0-3mdv-1-1mdv2010.2
But since I'm referring to a kernel built from kernel.org, and not a packaged kernel this is not the right direction.

Wayne Sallee
Wayne@WayneSallee.com
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: vboxdrv.ko): Invalid module format

Post by Perryg »

Of course if you are using an rpm base it will be different. Since you did not state that fact before it is up to you to determine which command to run.
Now for what direction you need to take, and since you don't think that you need the proper headers to match you *running* kernel and additional packages to install VirtualBox I don't know what else I can tell you.
Wayne Sallee
Posts: 14
Joined: 30. May 2009, 20:50
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Win 3.1, Win 8, and many more
Location: Florida
Contact:

Re: vboxdrv.ko): Invalid module format

Post by Wayne Sallee »

Perryg wrote:Of course if you are using an rpm base it will be different. Since you did not state that fact before it is up to you to determine which command to run.
Yes, rpm is different from deb, and I came up with the equivalent, but none of this is of any value anyway, since I'm building the kernel from kernel.org, not using a package.
Perryg wrote: Now for what direction you need to take, and since you don't think that you need the proper headers to match you *running* kernel and additional packages to install VirtualBox I don't know what else I can tell you.
That's ridiculous. I never said any such thing.

Wayne Sallee
Wayne@WayneSallee.com
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: vboxdrv.ko): Invalid module format

Post by Perryg »

Maybe I did not understand your quote
But since I'm referring to a kernel built from kernel.org, and not a packaged kernel this is not the right direction.
So I am back to my original statement. The headers must match the kernel and the proper packages for your build must be installed in order to install VirtualBox.
I am not talking about how you build the kernel that does not matter to me at all. I am talking about the error you are getting which I assume is from trying to install VirtualBox.
Wayne Sallee
Posts: 14
Joined: 30. May 2009, 20:50
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Win 3.1, Win 8, and many more
Location: Florida
Contact:

Re: vboxdrv.ko): Invalid module format

Post by Wayne Sallee »

Perryg wrote:Maybe I did not understand your quote
But since I'm referring to a kernel built from kernel.org, and not a packaged kernel this is not the right direction.
So I am back to my original statement. The headers must match the kernel and the proper packages for your build must be installed in order to install VirtualBox.
I am not talking about how you build the kernel that does not matter to me at all. I am talking about the error you are getting which I assume is from trying to install VirtualBox.
Which brings me back to my previous question :-) , "I think I do have the headers, but how can I make sure that I do have the headers?"

Wayne Sallee
Wayne@WayneSallee.com
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: vboxdrv.ko): Invalid module format

Post by Perryg »

while running and in a terminal run uname -r to see the running kernel and then look at the list you posted.
If you have the headers you will still need the devel package to match the kernel in an rpm based distro plus a few other packages that match your running kernel.


dkms binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel (64-bit)

Or

dkms binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-pae-devel (32-bit)
Wayne Sallee
Posts: 14
Joined: 30. May 2009, 20:50
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Win 3.1, Win 8, and many more
Location: Florida
Contact:

Re: vboxdrv.ko): Invalid module format

Post by Wayne Sallee »

Code: Select all

uname -r
3.2.7
The list I posted are rpms. Rpm devel packages are not available for the kernels I'm building. I'm assuming that the build process of the kernel.org kernels is building headers too, but they won't show up in any rpm list. So how can I tell if the headers are properly built?

dkms I have.
binutils I have.
gcc I have.
make I have.
patch I have.
libgomp I have.
glibc-headers not showing as available, probably in some other package.
glibc-devel I have.
kernel-headers We are already discussing this.
kernel-pae-devel Irrelevant

So how can I check to make sure that I do have the headers?

Wayne Sallee
Wayne@WayneSallee.com
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: vboxdrv.ko): Invalid module format

Post by Perryg »

see what uname -a tells you then
Wayne Sallee
Posts: 14
Joined: 30. May 2009, 20:50
Primary OS: Linux other
VBox Version: OSE other
Guest OSses: Win 3.1, Win 8, and many more
Location: Florida
Contact:

Re: vboxdrv.ko): Invalid module format

Post by Wayne Sallee »

Perryg wrote:see what uname -a tells you then

Code: Select all

uname -a
Linux waynesalleecom 3.2.7 #1 SMP Tue Feb 21 18:25:21 EST 2012 i686 i686 i386 GNU/Linux
Wayne Sallee
Wayne@WayneSallee.com
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: vboxdrv.ko): Invalid module format

Post by Perryg »

Now looking at your list above, do you see anything that resembles this in the form of a header?
Post Reply