# [solved] modprobe goes for older version modules

## MiXi-IL

Hi,

I was trying to install iptables. But first, seeing that there's a new version of 2.6.20 (r8, I have r7), I emerged gentoo-sources. Then, I copied the .config from my old /usr/src/linux-<olderversion> to the new one, changed configuration and I did make modules && make modules_install && update-modules.

But, when I try to load the ip_tables module, I get:

```

flux91 linux # modprobe ip_tables

WARNING: Error inserting x_tables (/lib/modules/2.6.20-gentoo-r7/kernel/net/netfilter/x_tables.ko): Invalid module format

FATAL: Error inserting ip_tables (/lib/modules/2.6.20-gentoo-r7/kernel/net/ipv4/netfilter/ip_tables.ko): Invalid module format

```

Then, to find what was the reason I did:

```

flux91 linux # modprobe -l  

/lib/modules/2.6.20-gentoo-r7/misc/kqemu.ko

/lib/modules/2.6.20-gentoo-r7/kernel/sound/core/snd-timer.ko

/lib/modules/2.6.20-gentoo-r7/kernel/sound/core/snd-pcm.ko

/lib/modules/2.6.20-gentoo-r7/kernel/sound/core/snd.ko

/lib/modules/2.6.20-gentoo-r7/kernel/sound/core/snd-page-alloc.ko

/lib/modules/2.6.20-gentoo-r7/kernel/sound/pci/hda/snd-hda-codec.ko

/lib/modules/2.6.20-gentoo-r7/kernel/sound/pci/hda/snd-hda-intel.ko

/lib/modules/2.6.20-gentoo-r7/kernel/fs/fuse/fuse.ko

/lib/modules/2.6.20-gentoo-r7/kernel/fs/quota_v1.ko

/lib/modules/2.6.20-gentoo-r7/kernel/fs/quota_v2.ko

/lib/modules/2.6.20-gentoo-r7/kernel/drivers/kvm/kvm.ko

/lib/modules/2.6.20-gentoo-r7/kernel/drivers/kvm/kvm-intel.ko

/lib/modules/2.6.20-gentoo-r7/kernel/drivers/ata/pata_jmicron.ko

/lib/modules/2.6.20-gentoo-r7/kernel/drivers/ide/pci/jmicron.ko

/lib/modules/2.6.20-gentoo-r7/kernel/net/ipv4/netfilter/iptable_filter.ko

/lib/modules/2.6.20-gentoo-r7/kernel/net/ipv4/netfilter/nf_conntrack_ipv4.ko

/lib/modules/2.6.20-gentoo-r7/kernel/net/ipv4/netfilter/ip_tables.ko

/lib/modules/2.6.20-gentoo-r7/kernel/net/netfilter/nf_conntrack.ko

/lib/modules/2.6.20-gentoo-r7/kernel/net/netfilter/xt_state.ko

/lib/modules/2.6.20-gentoo-r7/kernel/net/netfilter/x_tables.ko

/lib/modules/2.6.20-gentoo-r7/kernel/net/netfilter/xt_tcpudp.ko

```

Unfortunately, my attempts to compile the r7 version of ip_tables don't succeed:

```

flux91 linux-2.6.20-gentoo-r7 # make modules

  CHK     include/linux/version.h

  CHK     include/linux/utsrelease.h

  Building modules, stage 2.

  MODPOST 25 modules

WARNING: "ip_ct_attach" [net/netfilter/nf_conntrack.ko] undefined!

WARNING: "nf_log_packet" [net/netfilter/nf_conntrack.ko] undefined!

WARNING: "nf_register_sysctl_table" [net/netfilter/nf_conntrack.ko] undefined!

WARNING: "nf_unregister_sysctl_table" [net/netfilter/nf_conntrack.ko] undefined!

WARNING: "nf_net_netfilter_sysctl_path" [net/netfilter/nf_conntrack.ko] undefined!

WARNING: "nf_net_ipv4_netfilter_sysctl_path" [net/netfilter/nf_conntrack.ko] undefined!

WARNING: "nf_afinfo" [net/netfilter/nf_conntrack.ko] undefined!

WARNING: "nf_ip_checksum" [net/ipv4/netfilter/nf_conntrack_ipv4.ko] undefined!

WARNING: "nf_log_packet" [net/ipv4/netfilter/nf_conntrack_ipv4.ko] undefined!

WARNING: "nf_unregister_hooks" [net/ipv4/netfilter/nf_conntrack_ipv4.ko] undefined!

WARNING: "nf_unregister_sockopt" [net/ipv4/netfilter/nf_conntrack_ipv4.ko] undefined!

WARNING: "nf_net_ipv4_netfilter_sysctl_path" [net/ipv4/netfilter/nf_conntrack_ipv4.ko] undefined!

WARNING: "nf_register_hooks" [net/ipv4/netfilter/nf_conntrack_ipv4.ko] undefined!

WARNING: "nf_register_sockopt" [net/ipv4/netfilter/nf_conntrack_ipv4.ko] undefined!

WARNING: "nf_register_hooks" [net/ipv4/netfilter/iptable_filter.ko] undefined!

WARNING: "nf_unregister_hooks" [net/ipv4/netfilter/iptable_filter.ko] undefined!

WARNING: "nf_log_register" [net/ipv4/netfilter/ipt_LOG.ko] undefined!

WARNING: "nf_log_unregister_logger" [net/ipv4/netfilter/ipt_LOG.ko] undefined!

WARNING: "nf_register_sockopt" [net/ipv4/netfilter/ip_tables.ko] undefined!

WARNING: "nf_unregister_sockopt" [net/ipv4/netfilter/ip_tables.ko] undefined!

make[1]: *** [__modpost] Error 1

make: *** [modules] Error 2

```

How can I overcome this?

Thanks,

Mickey.Last edited by MiXi-IL on Sun Jun 10, 2007 8:29 am; edited 1 time in total

----------

## derverstand

Why not switching back to the old kernel?

/BR

----------

## PaulBredbury

Recompile the kernel and the modules. That way, everything is consistent. Use this make command, to ensure that everything is rebuilt:

```
make clean bzImage modules modules_install
```

----------

## NeddySeagoon

MiXi-IL,

modprobe asks the kernel what version it is with 

```
uname -r
```

then fetches its modules from /lib/modules/`uname -r`/

You are not running your new kernel for some reason.

```
uname -a
```

will show the time and date the running kernel was made.

Does it look right for your most recent kernel build

----------

## eccerr0r

also make sure you don't have hardcoded paths with the path[] statement in your /etc/modules.conf...

----------

## MiXi-IL

Thanks for the replys.

I didn't know it looks for the kernel version by uname -r. This implies that I have to reboot in order to complete the process. Can I avoid reboot and still fix that problem? looking for path in /etc/modules.conf did not give any results.

----------

## NeddySeagoon

MiXi-IL,

You have to reboot to start the new kernel. The new kernel will have a different 

```
uname -r
```

The path to use to find kernel modules is not stored anywhere, modprobe queries the kernel for it.

That way is never loads old modules, it always chooses the correct modules for the kernel.

----------

## MiXi-IL

Oh, and another thing:

Now I have spotted this in the log file:

```

Jun  9 20:25:16 flux91 x_tables: version magic '2.6.20-gentoo-r8 SMP mod_unload CORE2 ' should be '2.6.20-gentoo-r7 SMP mod_unload CORE2 '

Jun  9 20:25:16 flux91 ip_tables: version magic '2.6.20-gentoo-r8 SMP mod_unload CORE2 ' should be '2.6.20-gentoo-r7 SMP mod_unload CORE2 '

```

This was me trying to be clever and copy the compiled .ko files thinking the kernel wouldn't mind. As you can see it did mind. Is there a 'hack' to tell the kernel not to check versions?

----------

## MiXi-IL

I see.

Well, if I won't find any workaround in the next few days I'll reboot the system. I'll be happy to hear if anyone can think of one.

Thanks.

----------

## MiXi-IL

OK, There's a progress. Here is what I got so far:

1. To make modprobe ignore the version mismatch, you could add the -f parameter

2. 'make clean' solved the part where I could not compile the ip_tables modules in the r7 dir.

However I still have the problem of which I cannot load ip_tables modules but this have nothing to do with this thread's topic.

I'll open a new one.

----------

