# certain modules aren't being loaded [Solved]

## admasnd

What began with following the power management guide, ended up with some of my modules not loading. Upon modifying my kernel for lm_sensors and running its detection program and restarting my laptop, my sound stop working and eventually Xorg stop working too. 

Everytime Xorg tries to load, I get the following error: 

```

(EE) NVIDIA(0): Failed to load the NVIDIA kernel module!

```

When I try 

```

modprobe nvidia

```

I get the following error:

```

FATAL: Error inserting nvidia (/lib/modules/2.6.27-gentoo-r8/video/nvidia.ko): Invalid module format

```

Also, nothing is shown when I use lsmod. Some modules are loading up, like acpi and NetworkManager. Because of this situation, I cannot use Gnome, and must use Windows Vista to post this so giving direct outputs of code will be difficult. Any help would be greatly appreciated.Last edited by admasnd on Sat May 16, 2009 11:54 pm; edited 1 time in total

----------

## d2_racing

Hi, can you post this :

```

# emerge --info

# cd /usr/src && ls -la

```

----------

## admasnd

 *d2_racing wrote:*   

> Hi, can you post this :
> 
> ```
> 
> # emerge --info
> ...

 

I had to use a ubuntu livecd and chroot into my gentoo install, but I got the info: 

```

(chroot) ubuntu / # emerge --info

Portage 2.1.6.11 (default/linux/x86/2008.0, gcc-4.1.2, glibc-2.8_p20080602-r1, 2.6.27-7-generic i686)

=================================================================

System uname: Linux-2.6.27-7-generic-i686-Intel-R-_Core-TM-2_Duo_CPU_T7250_@_2.00GHz-with-glibc2.0

Timestamp of tree: Thu, 14 May 2009 21:00:01 +0000

app-shells/bash:     3.2_p39

dev-java/java-config: 2.1.7

dev-lang/python:     2.4.4-r13, 2.5.4-r2

dev-python/pycrypto: 2.0.1-r6

sys-apps/baselayout: 1.12.11.1

sys-apps/sandbox:    1.6-r2

sys-devel/autoconf:  2.13, 2.63

sys-devel/automake:  1.4_p6, 1.5, 1.9.6-r2, 1.10.2

sys-devel/binutils:  2.18-r3

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   1.5.26

virtual/os-headers:  2.6.27-r2

ACCEPT_KEYWORDS="x86"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -march=i686 -pipe"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"

CXXFLAGS="-O2 -march=i686 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"

GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"

LANG="en_US.UTF-8"

LDFLAGS="-Wl,-O1"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="X acl acpi alsa apm avahi berkdb bzip2 cairo cli cracklib crypt cups dbus dri fortran gdbm gif gnome gpm gtk hal iconv ipv6 isdnlog lm_sensors midi mudflap ncurses nforce2 nls nptl nptlonly nsplugin nvidia openmp pam pcre perl pmu png pppd python readline reflection session spl ssl sysfs tcpd unicode x86 xorg zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="nvidia"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

```

```

(chroot) ubuntu / # cd /usr/src && ls -la

total 20

drwxr-xr-x  5 root root 4096 2009-04-25 00:53 .

drwxr-xr-x 14 root root 4096 2009-04-13 03:10 ..

-rw-r--r--  1 root root    0 2008-06-11 13:44 .keep

lrwxrwxrwx  1 root root   22 2009-04-11 23:17 linux -> linux-2.6.27-gentoo-r8

drwxr-xr-x 17 root root 4096 2009-04-24 23:19 linux-2.6.27-gentoo-r10

drwxr-xr-x 23 root root 4096 2009-05-15 03:19 linux-2.6.27-gentoo-r8

drwxr-xr-x 22 root root 4096 2009-05-14 22:03 linux-2.6.28-gentoo-r5

```

Thanks for taking the time out to help me.

----------

## krinn

and what give you ?

```
file /lib/modules/2.6.27-gentoo-r8/video/nvidia.ko
```

----------

## admasnd

 *krinn wrote:*   

> and what give you ?
> 
> ```
> file /lib/modules/2.6.27-gentoo-r8/video/nvidia.ko
> ```
> ...

 

```

(chroot) ubuntu src # file /lib/modules/2.6.27-gentoo-r8/video/nvidia.ko 

/lib/modules/2.6.27-gentoo-r8/video/nvidia.ko: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV)

```

----------

## krinn

and you did re-emerge the nvidia drivers AFTER you've rebuild that new kernel?

as build kernel, boot the kernel, emerge nvidia-drivers again with the new kernel

----------

## admasnd

 *krinn wrote:*   

> and you did re-emerge the nvidia drivers AFTER you've rebuild that new kernel?
> 
> as build kernel, boot the kernel, emerge nvidia-drivers again with the new kernel

 

yes I did the following: 

```

mount /dev/sda2 /boot

cd /usr/src/linux

make && make modules_install

cp arch/i386/boot/bzImage /boot

reboot

emerge nvidia-drivers

su twan 

startx 

```

and I still get the following error:

```

(EE) NVIDIA(0): Failed to load the NVIDIA kernel module!

```

I think my problem has something to do with the multiple kernels. I was not even aware that I had the two other kernels on my laptop. How do you check to see if the modules are installed with the kernel you are using?

I know from doing eselect kernel list that the kernel I am using is linux-2.6.27-gentoo-r8.

Also, I think the very last thing I did before Xorg stopped working was clearing out my /lib/modules/2.6.27-gentoo-r8/

by doing 

```

rm -r /lib/modules/2.6.27-gentoo-r8/

```

Since then it has been repopulated with files, but I wonder if the deletion of this folder has something to do with the problem.

----------

## admasnd

I don't know if this helps or not but when I check dmesg

I see the following message for the nvidia module, but messages involving the other modules look similar to the following:

```

[43.848180] nvidia: version magic '2.6.27-gentoo-r8 mod_unload CORE2' should be '2.6.27-gentoo-r8 SMP mod_unload CORE2'

```

----------

## Nerevar

Is it possible that the CFLAG march setting of i686 doesn't allow for SMP? Did you recently turn on SMP in your kernel? You certainly want SMP on a core2, but that march setting is way off. See here for the list of safe flags: http://en.gentoo-wiki.com/wiki/Safe_Cflags

EDIT: More likely... the kernel you're running is 2.6.27-7-generic (in the emerge --info), but the modules you're using are 2.6.27-gentoo-r8. Looks like your new kernel isn't loading. I still think you need to fix that march setting though.  :Smile: 

----------

## admasnd

 *Nerevar wrote:*   

> Is it possible that the CFLAG march setting of i686 doesn't allow for SMP? Did you recently turn on SMP in your kernel? You certainly want SMP on a core2, but that march setting is way off. See here for the list of safe flags: http://en.gentoo-wiki.com/wiki/Safe_Cflags
> 
> EDIT: More likely... the kernel you're running is 2.6.27-7-generic (in the emerge --info), but the modules you're using are 2.6.27-gentoo-r8. Looks like your new kernel isn't loading. I still think you need to fix that march setting though. 

 

I turned off SMP in my kernel as a troubleshooting step for the power management guide.

----------

## Nerevar

You need to first get a kernel booting with matching modules. Then reinstall the nvidia drivers.

----------

## admasnd

 *Nerevar wrote:*   

> You need to first get a kernel booting with matching modules. Then reinstall the nvidia drivers.

 

How do I do that? The methods I have been using to install the kernel haven't been doing the trick.

----------

## Nerevar

I'm guessing you're using grub. I'm an old school lilo user. So, see if this helps: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10

If it doesn't, post your grub.conf and I'm sure a grub user will be along to help.

----------

## admasnd

 *Nerevar wrote:*   

> I'm guessing you're using grub. I'm an old school lilo die-hard. So, see if this helps: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10

 

The thing is that I don't understand what to do differently than before. My grub loads up the r8 kernel and the kernel image that is in /boot is the r8 version. So if the modules are being created with the r8 kernel, how do I find out what kernel they are being created as?

----------

## desultory

 *admasnd wrote:*   

> My grub loads up the r8 kernel and the kernel image that is in /boot is the r8 version.

 The emerge --info output you posted indicates otherwise. Do you use a separate partition for /boot/?

----------

## admasnd

 *desultory wrote:*   

>  *admasnd wrote:*   My grub loads up the r8 kernel and the kernel image that is in /boot is the r8 version. The emerge --info output you posted indicates otherwise. Do you use a separate partition for /boot/?

 

yes I use a separate partition for /boot. I make sure that I mount it as well before I copy the bzImage, so I wonder what's going on. 

Edit: I just ran uname -r and it says that i'm running the r8 kernel.

----------

## Nerevar

So, does reinstalling the nvidia drivers fix the problem now?

Another grub page with instructions for a separate /boot partition:

http://www.redhat.com/docs/manuals/linux/RHL-7.3-Manual/custom-guide/s1-custom-kernel-bootloader.html

----------

## admasnd

 *Nerevar wrote:*   

> So, does reinstalling the nvidia drivers fix the problem now?
> 
> Another grub page with instructions for a separate /boot partition:
> 
> http://www.redhat.com/docs/manuals/linux/RHL-7.3-Manual/custom-guide/s1-custom-kernel-bootloader.html

 

My grub is configured properly. As for re-emerging nvidia-drivers, it made this worse.

After I ran 

```

emerge nvidia-drivers

eselect opengl set

```

none of the modules load like usual and Xorg doesn't load, but this time there is no errors in the xorg log and worst of all, the computer freezes.

The only way to avoid the computer freeze is to use interactive mode and make sure nothing related to Xorg tries to load up like xdm.

----------

## Nerevar

 *admasnd wrote:*   

> My grub is configured properly.

 

Why do you think this? What did you change to boot the right kernel? Are you still booting the right kernel or has it reverted again? Did you ever get the modules to load?

As for X hanging, did you try CTRL-ALT-BACKSPACE or CTRL-ALT-F1?

Sorry for the 20 questions, but my guessing at the answers is not working.  :Smile: 

----------

## admasnd

 *Nerevar wrote:*   

>  *admasnd wrote:*   My grub is configured properly. 
> 
> Why do you think this? What did you change to boot the right kernel? Are you still booting the right kernel or has it reverted again? Did you ever get the modules to load?
> 
> As for X hanging, did you try CTRL-ALT-BACKSPACE or CTRL-ALT-F1?
> ...

 

It's cool man. I'm just glad you giving me some of your time. As for your questions,

grub is loading the r8 kernel. as for the root setting for grub, it's (hd0,1) to represent /dev/sda2, which is my /boot partition. 

I unmerged nvidia-drivers and got the following error:

```

!!! Error: Failed to create //usr//lib/libGL.so

/var/tmp/binpkgs/X11-drivers/nvidia-drivers-180.29/temp/environment: line 3346:

4536 Killed   eselect opengl set --use-old Xorg-X11

```

I don't know if that error is significant.

I then re-emerged nvidia-drivers, did eselect opengl set nvidia, did modprobe -r nvidia.

I then did modprobe nvidia and there was no error. startx did not work, however. the laptop froze.

Unfortunately, CTRL-ALT-BACKSPACE does not stop Xorg. It's a complete freeze.

----------

## Nerevar

That sounds like you're getting closer. At least the modules are now loading properly. Check your xorg log again for warnings/errors (egrep "WW|EE" /var/log/Xorg.0.log) and post your /etc/X11/xorg.conf.

----------

## admasnd

 *Nerevar wrote:*   

> That sounds like you're getting closer. At least the modules are now loading properly. Check your xorg log again for warnings/errors (egrep "WW|EE" /var/log/Xorg.0.log) and post your /etc/X11/xorg.conf.

 

```

(chroot) ubuntu / # egrep "WW|EE" /var/log/Xorg.0.log

   (WW) warning, (EE) error, (NI) not implemented, (??) unknown.

(WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/misc/".

(WW) The directory "/usr/share/fonts/TTF/" does not exist.

(WW) The directory "/usr/share/fonts/OTF" does not exist.

(WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/misc/".

(WW) The directory "/usr/share/fonts/TTF/" does not exist.

(WW) The directory "/usr/share/fonts/OTF" does not exist.

(WW) AllowEmptyInput is on, devices using drivers 'kbd' or 'mouse' will be disabled.

(WW) Disabling Mouse0

(WW) Disabling Keyboard0

(II) Loading extension MIT-SCREEN-SAVER

```

```

(chroot) ubuntu / # cat /etc/X11/xorg.conf

# nvidia-xconfig: X configuration file generated by nvidia-xconfig

# nvidia-xconfig:  version 1.0  (buildmeister@builder63)  Thu Feb  5 00:18:17 PST 2009

Section "ServerLayout"

    Identifier     "X.org Configured"

    Screen      0  "Screen0" 0 0

    InputDevice    "Mouse0" "CorePointer"

    InputDevice    "Keyboard0" "CoreKeyboard"

EndSection

Section "Files"

    ModulePath      "/usr/lib/xorg/modules"

    FontPath        "/usr/share/fonts/misc/"

    FontPath        "/usr/share/fonts/TTF/"

    FontPath        "/usr/share/fonts/OTF"

    FontPath        "/usr/share/fonts/Type1/"

    FontPath        "/usr/share/fonts/100dpi/"

    FontPath        "/usr/share/fonts/75dpi/"

EndSection

Section "InputDevice"

    Identifier     "Keyboard0"

    Driver         "kbd"

EndSection

Section "InputDevice"

    Identifier     "Mouse0"

    Driver         "mouse"

    Option         "Protocol" "auto"

    Option         "Device" "/dev/input/mice"

    Option         "ZAxisMapping" "4 5 6 7"

EndSection

Section "Monitor"

    Identifier     "Monitor0"

    VendorName     "Monitor Vendor"

    ModelName      "Monitor Model"

EndSection

Section "Device"

    Identifier     "Card0"

    Driver         "nvidia"

    VendorName     "nVidia Corporation"

    BoardName      "GeForce 8600M GT"

EndSection

Section "Screen"

    Identifier     "Screen0"

    Device         "Card0"

    Monitor        "Monitor0"

    SubSection     "Display"

        Viewport    0 0

    EndSubSection

    SubSection     "Display"

        Viewport    0 0

        Depth       4

    EndSubSection

    SubSection     "Display"

        Viewport    0 0

        Depth       8

    EndSubSection

    SubSection     "Display"

        Viewport    0 0

        Depth       15

    EndSubSection

    SubSection     "Display"

        Viewport    0 0

        Depth       16

    EndSubSection

    SubSection     "Display"

        Viewport    0 0

        Depth       24

    EndSubSection

EndSection

```

Just to clarify, the nvidia module succeeded modprobe, not the other modules.

----------

## Nerevar

I don't see any problems with those. I guess I'd look at the dmesg output and the system log to try and see if there are any hardware related issues (due to kernel misconfig or something else). So, which modules aren't loading now? Are they modules provided by the kernel or 3rd party? Obviously the latter will take rebuilding.

----------

## admasnd

 *Nerevar wrote:*   

> I don't see any problems with those. I guess I'd look at the dmesg output and the system log to try and see if there are any hardware related issues (due to kernel misconfig or something else). So, which modules aren't loading now? Are they modules provided by the kernel or 3rd party? Obviously the latter will take rebuilding.

 

The following are the modules that aren't loading:

```

snd-hda-intel

snd-pcm-oss

snd-mixer-oss

snd-seq-oss

snd-seq

```

These are kernel modules. 

I tried the following:

```

emerge --unmerge xorg-x11

emerge xorg-x11

env-update

source /etc/profile

```

It still freezes when xdm is run (specifically gdm for gnome).

```

emerge --unmerge alsa-utils

emerge alsa-utils

modprobe snd-hda-intel

```

and the following error occurs:

```

FATAL: Error inserting snd_hda_intel (/lib/modules/2.6.27-gentoo-r8/kernel/sound/pci/hda/snd-hda-intel.ko): Invalid module format

```

dmesg shows the same thing it showed for the nvidia module earlier for the other modules. 

```

[43.848180] nvidia: version magic '2.6.27-gentoo-r8 mod_unload CORE2' should be '2.6.27-gentoo-r8 SMP mod_unload CORE2'

```

except the module name  is different then this code.

----------

## Nerevar

If you umount your /boot partition, does anything exist in /boot?

----------

## krinn

lookout if 

```

cat /usr/src/linux/.config | grep LOCALVERSION

CONFIG_LOCALVERSION=""

# CONFIG_LOCALVERSION_AUTO is not set

```

and

```
cat /usr/src/linux/.config | grep MODVERSION

# CONFIG_MODVERSIONS is not set

```

this add some unuseful version to kernel and module that could mistake some tools that try to find your module or kernel.

and you should do make mrproper before rebuilding your kernel, and if you use grub, you can just make install as

```
mount /boot

cd /usr/src/linux

cp .config .. (backup your config because mrproper will remove it)

make mrproper

cp ../.config . (restoring config)

make && make modules && make modules_install && make install

reboot

```

----------

## admasnd

 *Nerevar wrote:*   

> If you umount your /boot partition, does anything exist in /boot?

 

when the /boot partition is unmounted, there is nothing in /boot.

----------

## admasnd

 *krinn wrote:*   

> lookout if 
> 
> ```
> 
> cat /usr/src/linux/.config | grep LOCALVERSION
> ...

 

I received the is not set message for the first two commands like you have. As for doing the re-installation. After I rebooted, I receive the following messages:

```

udevd-event[1037]: run-program: '/sbin/modprobe' abnormal exit

[6.932460] nvidia: module license 'NVIDIA' taints kernel.

```

and it reboots on its own. This happens each time I try to load the kernel. Even interactive mode won't work.

----------

## admasnd

I got things back up and running. All of the modules load and i'm back in gnome. 

This is what I did:

```

eselect kernel set 3 

```

(changing from linux-2.6.27-gentoo-r8 to linux-2.6.28-gentoo-r5)

```

cd /usr/src/linux

```

had a backup of .config in /usr/src

```

make distclean

cp ../.config .

make && make modules && make modules_install

cp arch/i386/boot/bzImage /boot/linux-2.6.28-gentoo-r5

emerge nvidia-drivers

eselect opengl set

```

I installed module-rebuild and tried to run it, but i got an error trying to re-install media-video/linux-uvc-0.1.0_pre250

so I just emerged nvidia-drivers on my own. Everything else works fine. I'm now going back to doing the power management guide. Thanks everyone for your help. You didn't have to volunteer your time and effort and I definitely appreciate it.

----------

