# [SOLVED]chost, march, cpu type and "external" kernel modules

## ingenious

Hey folks,

I've got a bit of situation here... I've got a Dual Core AMD Opteron 175 and the following setup in /etc/make.conf and CPU type in the kernel .config:

```
CHOST="i686-pc-linux-gnu"

CFLAGS="-O2 -march=opteron -msse3 -pipe -fomit-frame-pointer"

CONFIG_MK8=y
```

I've been running this configuration for quite some time and never had any problems up until now. A little while ago I tried emerging virtualbox and when I wanted to modprobe vboxdrv I got the following:

```
FATAL: Error inserting vboxdrv (/lib/modules/2.6.39-gentoo-r1/misc/vboxdrv.ko): Invalid module format
```

and dmesg: 

```
[89752.232301] vboxdrv: version magic '2.6.39-gentoo-r1 SMP mod_unload 686 ' should be '2.6.39-gentoo-r1 SMP mod_unload K8 '
```

I've tried both virtualbox-bin and the ose version - same errors.

I can see what's causing the mess up (more or less) and I just wanted to ask if there is any workarround for that? Will I lose any functionality if I change the processor family in the kernel to M686?Last edited by ingenious on Fri Jun 24, 2011 9:28 pm; edited 1 time in total

----------

## Jaglover

Are you sure the linux symlink is pointing to the sources of running kernel.

----------

## ingenious

 *Jaglover wrote:*   

> Are you sure the linux symlink is pointing to the sources of running kernel.

 

Yes, it was one of the first things I checked:

```
17:53 imladris linux # uname -a

Linux imladris 2.6.39-gentoo-r1 #1 SMP Tue Jun 21 12:01:20 CEST 2011 i686 Dual Core AMD Opteron(tm) Processor 175 AuthenticAMD GNU/Linux

17:54 imladris linux # eselect kernel list

Available kernel symlink targets:

...

  [8]   linux-2.6.39-gentoo-r1 *

```

----------

## Jaglover

It's still possible you are not running the kernel you think you are. Not mounting the /boot while copying over the kernel can happen to anyone. Could you please make sure the kernel image is correct, then build virtualbox modules again. The error you are getting implies there is a mismatch between kernel build and module build.

----------

## ingenious

 *Jaglover wrote:*   

> It's still possible you are not running the kernel you think you are. Not mounting the /boot while copying over the kernel can happen to anyone. Could you please make sure the kernel image is correct, then build virtualbox modules again. The error you are getting implies there is a mismatch between kernel build and module build.

 

My /boot is mounted all the time, and I thought uname was pretty sure to point which kernel I'm running, but if that's not enough:

```
 # zcat /proc/config.gz | head

#

# Automatically generated make config: don't edit

# Linux/i386 2.6.39-gentoo-r1 Kernel Configuration

# Tue Jun 21 11:36:55 2011

```

----------

## cach0rr0

possible the virtualbox module was built with a different version of GCC than what was used to build your kernel?

----------

## ingenious

 *cach0rr0 wrote:*   

> possible the virtualbox module was built with a different version of GCC than what was used to build your kernel?

 

Nope, same version of gcc. Both the kernel and virtualbox were built one after the other.

----------

## spikyatlinux

Hey perhaps you need to fully recompile your kernel.,

you can try the following:

```
cd /usr/src/linux

make clean && make mrproper

zcat /proc/config.gz > .config

make

make modules_install

make install
```

Dont forget to update your bootloader "e.g. grub"

----------

## Jaglover

spikyatlinux,

I have experienced modules failing to load even if the kernel version is the same but is reconfigured and rebuilt. Thus I recommended making sure the kernel image is correct and rebuilding the modules. 

However, ingenious never responded to this. This makes me think his/her issue is not serious.

----------

## ingenious

 *Jaglover wrote:*   

> 
> 
> I have experienced modules failing to load even if the kernel version is the same but is reconfigured and rebuilt. Thus I recommended making sure the kernel image is correct and rebuilding the modules. 
> 
> However, ingenious never responded to this. This makes me think his/her issue is not serious.

 

Maybe I wasn't clear enough in previous posting,  but I tried that already due to no effect.

I'm quite sure the problem arises from what was in the first entry of the topic: CHOST="i686-pc-linux-gnu" and hence my vboxdrv is M686. vboxdrv is provided by app-emulation/virtualbox-modules, and is not built with the kernel, i.e. make modules_install won't affect it. At the other hand, my kernel is MK8 and hence the other part of the dmesg error.

I'm still searching for any workarounds for this confusion.

Spikyatlinux, haven't tried a clean rebuilt yet, but I don't see how it may help. Nevertheless I will try it later on today and will report back.

----------

## ingenious

well.. a clean rebuild solved the problem, thank you all.

----------

## spikyatlinux

 *ingenious wrote:*   

> 
> 
> ... haven't tried a clean rebuilt yet, but I don't see how it may help. Nevertheless I will try it later on today and will report back.

 

Thanks for your report @ingenious...

@Jaglover

have you tried 

```
emerge -av sys-kernel/module-rebuild
```

 and then,

```
module-rebuild populate; module-rebuild rebuild
```

Good luck...  :Wink: 

----------

## cach0rr0

 *ingenious wrote:*   

> well.. a clean rebuild solved the problem, thank you all.

 

unless you do a make clean, all of those object files that get bundled into the final bzImage are still left over (e.g. foobar.o, epicdriver.o)

so a basic 'make' will not do. 

if that makes sense

----------

