Insmod: Error inserting:-1 invalid module format Solution

Source: Internet
Author: User

This is often the case when LDD programming is initially started. The source code of the downloaded and compiled kernel is different from that of the currently running kernel.

 

Stage 1

Sometimes the kernel version you downloaded is relatively correct, but still cannot be successfully inserted. check:

1. GCC version, comparison:

CAT/proc/version and GCC-V

2. Compare the kernel config. The key options cannot be different.

Current kernel config:

/Lib/modules/'uname-R'/build/. config

 

For example, you can enable PAE: config_x86_pae = y on a large memory machine.

2.6.32-28-generic-pae # 55-ubuntu SMP mon Jan 10 22:34:08

The default kernel source code won't be opened, so insert fails.

PAE depends on config_highmem64g = y

Otherwise, the PAE option is invisible:

High memory support (64 GB) ---> │

-*-PAE (physical address extension) Support

 

At the same time, you can set the version signature to the same:

Config_version_signature = "ubuntu 2.6.32-28.55-generic-PAE 2.6.32.27 + drm33.12"

When there is a check in the running kernel

Config_check_signature = y

 

Dkms needs to be installed:

$ Aptitude show dkms

Package: dkms

State: Not Installed

Version: 2.1.1.2-2ubuntu1

Priority: Optional

Section: Admin

Maintainer: Ubuntu developers <ubuntu-devel-discuss@lists.ubuntu.com>

Uncompressed size: 475 K

Depends: module-init-tools, GCC, make | build-essential | dpkg-Dev, patch

Recommends: fakeroot, LSB-release, menu | sudo, linux-headers-2.6-686 | linux-headers-2.6-amd64 |

Linux-headers-generic | Linux-headers, Linux-Image

Description: Dynamic kernel module Support Framework

Dkms is a framework designed to allow individual kernel modules to be upgraded without changing

Whole kernel. It is also very easy to rebuild modules as you upgrade kernels.

Homepage: http://linux.dell.com/dkms

 

Stage 2

After the basic configuration is correct, the following issues do not match the version and magic:

[1, 12151.939695] H: No symbol version for module_layout

[13544.669533] H: disagrees about version of symbol module_layout

Later is more common.

Config_version_signature settings do not work at all. Use modinfo to view the system Ko and self-compiled Ko:

 

$ Sudo modinfo H. Ko

Filename: H. Ko

License: Dual BSD/GPL

Depends:
Vermagic: BRL. 32.41 + drm33.18 SMP mod_unload modversions 686

System Ko

Vermagic: 2.6.32-28-generic-pae SMP mod_unload modversions 586tsc

Parm: Debug: debug level (0 = none,..., 16 = all) (INT)

Parm: eeprom_bad_csum_allow: allow bad EEPROM checksums (INT)

Parm: use_io: force use of I/O access mode (INT)

It is defined in the MAKEFILE file,

Version = 2

Patchlevel = 6

Sublevel = 32

Extraversion =. 41 + drm33.18

Name = man-eating seals of antiquity

Replace extraversion with-28-generic-pae

Modversions is used to compile the kernel through the Enable option: config_modversions = y

 

While 586tsc is arch, which is generated by configuring config_m586tsc (Pentium-classic), and the compiled kernel is 686 (Pentium-Pro ).

So the solution:

1. Edit the MAKEFILE file to make the previous basic version number the same

2. Enable config_modversions

3. Select the same CPU type

 

Stage 3

After all this is done, you still cannot insert: disagrees about version of symbol module_layout.

This situation is possible, not only the differences in size and version, but you cannot guarantee that:

This indicates you have compiled the module against a different version
Of the kernel than is running. Note that even if the running kernel and
Kernel source have the same numerical value (e.g. Both are
2.6.31-20-server), if the two use different configuration options, you
May see this error. Also check if there are multiple versions of this
Module on the machine and ensure you are loading the correct one.

 

You can only adopt the ultimate solution. compile one from the source, that is:

Apt-Get install linux-source-2.6.32

CP/lib/modules/'uname-R'/build/. config. config or:

CP/boot/config-'uname-R'. config

 

Make-J4

Sudo make install

Make modules

Sudo make modules_install

$ CD/boot & sudo mkinitramfs-k-o initrd. img-2.6.32.41 + drm33.18-PAE 2.6.32.41 + drm33.18-PAE
Working files in/tmp/mkinitramfs_4knpce and overlay in/tmp/mkinitramfs-OL_XRVNGw

 

/Tmp/mkinitramfs_4knpce $ ls

Bin conf etc init lib sbin scripts

Edit grub. cfg to add the newly compiled Kernel

 

-EOF

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.