# Modules fail to load after @world update

## muadib25

Hello,

After a big world update, my system boots but does no longer load modules. I re-compiled and re-installed the kernel and kernel_modules, but in vain, 

'lsmod' reports nothing at all.

Trying 'modprobe' with nvidia or snd-hdsp modules results in 'invalid argument' e.g. 

```
# modprobe nvidia

modprobe: ERROR: could not insert 'nvidia': Invalid argument
```

I don't have a clue as to what to do or where to look for this. I cannot post dmesg either due to lack of net...

UPDATE: I will try to type the output or post pictures, if needed

Any help kindly appreciated!

M.

----------

## russK

Are you booting a kernel that has the nvidia module built?

Often strange errors like this are due to a mismatch of the kernel version and the module.

Maybe try this:

```
$ find /lib/modules/*/ -name nvidia.ko
```

```
$ uname -r
```

It would probably not hurt to rebuiild the nvidia driver:

```
# emerge nvidia-drivers
```

 ... and then retry the modprobe nvidia.

Sorry I'm not familiar with the other module, snd-hdsp.

HTH

----------

## muadib25

Thanks for answering russK,

The nvidia.ko module is where it should be, I guess, in /lib/modules/linux-4.4.6-gentoo/video/.

I have gone to the trouble to compile the kernel and modules twice, as well as changing kernel to a newee version and repeating the whole process. The outcome remains the same, no module can be loaded even with the new kernel.

Snd-hdsp is a module for the RME Hammerfall sound card family.

Anyway, I took the decision yesterday to change distro on my main machine. 

Sorry and thank for your help!

M.

----------

## Hu

I doubt you have the records to answer this, but I will ask anyway: anything interesting in dmesg?

----------

## muadib25

@Hu, 

As a matter of fact, I could retrieve it just now after reading your reply and through yesterday's new linux installation on the system, here it is:

https://pastebin.com/3QtpsZQx

Also, I remembered earlier today that while updating these 340+ atoms, ome or two of them were failing to emerge, my eye catching something mentioning missing /usr/include files. Never had the chance th investigate further.

Thanks!

M.

----------

## russK

muadib25,

I suspect the kernel that was booting was not the one you think it was.  Did you make sure it was copied to /boot and grub menu was updated?

I say this because you said the module was in /lib/modules/linux-4.4.6-gentoo/video/, but the first line of dmesg says version 4.4.6-gentoo (without "linux-").

Did you check the 'uname -r'?

Maybe that was the problem.

Regards

----------

## Hu

Was that dmesg taken from a boot where the module failed to load?  I see no sign of module attempts in it.

----------

## ct85711

From what I noticed, that dmesg cuts off immediately after the drives are mounted.  So of course it didn't try loading any modules from a unmounted drive...  Otherwise I'd agree with russK, in that you may not be booting into the correct kernel.  That is a very common mistake that people do, by forgetting to mount the boot partition before copying the kernel over...

----------

## muadib25

 *russK wrote:*   

> 
> 
> I say this because you said the module was in /lib/modules/linux-4.4.6-gentoo/video/, but the first line of dmesg says version 4.4.6-gentoo (without "linux-").
> 
> Did you check the 'uname -r'?
> ...

 

You 're right about the typo, it was only a typo since I was typing from memory. The dir is, correctly said, '/lib/modules/4.4.6-gentoo/video/.

 *Hu wrote:*   

> 
> 
> Was that dmesg taken from a boot where the module failed to load? I see no sign of module attempts in it.
> 
> 

 

I have noticed it, too. 

I managed just now to reboot to Gentoo and output a new dmesg to a file, as well as /var/log/messages, although I don't know if it is of any use.

dmesg: https://pastebin.com/zRHCffU1

messages: https://pastebin.com/Ty7DqUu2

Here is also the /etc/conf.d/modules file:

```

# Linux users can define a list of modules for a specific kernel version,

# a released kernel version, a main kernel version or all kernel versions.

# The most specific versioned variable will take precedence.

# FreeBSD users can only use the modules="foo bar" setting.

#modules_2_6_23_gentoo_r5="ieee1394 ohci1394"

#modules_2_6_23="tun ieee1394"

#modules_2_6="tun"

#modules_2="ipv6"

#modules="ohci1394"

# Linux users can give modules a different name when they load - the new name

# will also be used to pick arguments below.

# This is not supported on FreeBSD.

#modules="dummy:dummy1"

# Linux users can give the modules some arguments if needed, per version

# if necessary.

# Again, the most specific versioned variable will take precedence.

# This is not supported on FreeBSD.

#module_ieee1394_args="debug"

#module_ieee1394_args_2_6_23_gentoo_r5="debug2"

#module_ieee1394_args_2_6_23="debug3"

#module_ieee1394_args_2_6="debug4"

#module_ieee1394_args_2="debug5"

# You should consult your kernel documentation and configuration

# for a list of modules and their options.

```

Correct me if I'm wrong, but shouldn't there be uncommented lines with module names here?

Regards,

M.

----------

## ct85711

From the outputs that you post, from the messages, I see this error:

 *Quote:*   

> Aug 10 17:32:49 moria /etc/init.d/vsftpd[2950]: ERROR: cannot start vsftpd as net.eth0 would not start

 

This can easily just be an issue of it is looking for eth0, when your network card is really called something else (the joy of presistant naming, to give it a name that no one can read, that still changes anyways).  What you would want to do, is look at the output of ifconfig -a and see what your ethernet card is actually called  (the -a is important as it says to show all devices, even if they are not active/has no IP address).

As far as the dmesg output, it still doesn't really say much, as still ends right after the root drive is remounted to rw at 8.8 secs.  Only difference this time, is there is a since useless message 5 seconds later at 14 seconds.  This is no where near it would end/say if it can't find some firmware, as failing to find the firmware often quits at 20-40 secs or later.

Otherwise it does have these 2 entries,

 *Quote:*   

> [    9.143589] EXT4-fs (sdb1): couldn't mount as ext3 due to feature incompatibilities
> 
> [    9.144685] EXT4-fs (sdb2): VFS: Can't find ext4 filesystem

 

This may or may not be anything, as I've noticed similar issues when the kernel mounts an ext4 drive.  Though the sdb2 drive, you may want to double check what filesystem it should be.  As the seems that it's trying to mount it as ext4, when it should be something else, maybe swap partition?

Going over, the 2 files again, I noticed something else; the first being from dmesg, and the second messages  (beginning from both outputs)...

 *Quote:*   

> [    0.000000] Linux version 4.4.6-gentoo (root@moria) (gcc version 4.9.3 (Gentoo 4.9.3 p1.5, pie-0.6.4) ) #2 SMP PREEMPT Mon Aug 7 17:39:29 CEST 2017

 

 *Quote:*   

> Aug 10 17:32:49 moria syslog-ng[2915]: syslog-ng starting up; version='3.7.3'

 

The key parts is the time.  Dmesg says the system time is Aug 7, but the messages is Aug 10.  So the stuff between the 2 indicates they are from 2 different boot ups.

As far as modules are loaded, they generally are loaded when they are needed.  So in general, the drives get loaded very early, after the drives are remounted to rw,  the framebuffer gets loaded and init starts.  From there, the sound and ethernet modules gets mounted, then after that ends up being video for xorg...

Most times, you don't need to specify some module get loaded, as the kernel will load then as needed.  When you list them, you are telling the kernel loaded them right away ahead of time.  This is more of an importance with VM drivers.  So these typically are not seen to be needed till after the X11 is started, but it often needed so you can start a VM.

----------

## xaviermiller

did you run 

```
emerge @modules-rebuild
```

after the new kernel update (and compile)?

----------

## russK

This is a great analysis but one thing,

 *ct85711 wrote:*   

> [snip]
> 
> Going over, the 2 files again, I noticed something else; the first being from dmesg, and the second messages  (beginning from both outputs)...
> 
>  *Quote:*   [    0.000000] Linux version 4.4.6-gentoo (root@moria) (gcc version 4.9.3 (Gentoo 4.9.3 p1.5, pie-0.6.4) ) #2 SMP PREEMPT Mon Aug 7 17:39:29 CEST 2017 
> ...

 

Typically the date and time in the first line where the kernel announces it's name, rev, etc and date/time ....   I believe the date and time on that first line are from when the kernel was built.

Not sure how that might effect any of the conclusions drawn.

----------

## muadib25

Great analysis indeed!   :Surprised: 

@ct85711, the net.eth0 is the script that starts the network. the network card is an on-board Realtek-something that gets activated by a specific module, r8169.ko.

Regarding the /dev/sdb1 & /dev/sdb2, it complains because I changed the new hard disk with the old one(Gentoo). It's just a matter of correcting the /etc/fstab on this.

Regarding dates, Aug 7 was the last time I booted the system before booting again on Aug 10th. I deleted the Aug 7 entries in /var/log/messages before pasting it on pastebin, but I forgot to do it in dmesg. Sorry for this!

I see... So, /etc/conf.d/modules looks normal. As I understand it, it is 'make modules_install' that gets to tell the kernel which modules to get loaded, or something like that...

So, should /boot partition be mounted BEFORE one gives 'make modules_install' and 'make install'?

@xaviermiller, I guess so, I can't be certain. When I did this process, I followed the steps from the 'https://wiki.gentoo.org/wiki/Kernel/Upgrade' and 'https://wiki.gentoo.org/wiki/Kernel/Configuration#Build'

@russK No mystery there about the times/dates, it was the two last dates I booted Gentoo.   :Smile: 

Should I try rebuilding the modules with making sure /boot is mounted? 

Thanks,

M.

----------

## NeddySeagoon

muadib25,

The kernel loads modules from /lib/modules/`uname -r'/

As its on the root filesystem, make modules_install is fine at any time.

The kernel binary is normally loaded from /boot, which is normally not mounted, so its important that you remember to mount boot before the kernel is copied there.

The directory /boot (without boot mounted) is a normal directory, so installing the kernel there is not an error.

The boot loader won't find it though.

Check your 

```
uname -a
```

 after every kernel update.

The date/time shown is the build time of the running kernel.  Does it look light?

----------

## ct85711

 *Quote:*   

> @ct85711, the net.eth0 is the script that starts the network. the network card is an on-board Realtek-something that gets activated by a specific module, r8169.ko. 

 

Yes, I agree net.eth0 starts the network and gets an ip address.  The potential issue, is specifically the eth0.  When presistant naming came out, it was the idea to make the device name so that network cards get the same name even if you add/remove additional network cards.  So what this means is that, it takes the old naming from the kernel (eth0) and scrambles the name to something like enp1s0f1.

So this means if you don't have internet connection, I'd first check and make sure to see what your network card is called; as eth0 is not enp1s0f1...

----------

## muadib25

 *NeddySeagoon wrote:*   

> muadib25,
> 
> The kernel binary is normally loaded from /boot, which is normally not mounted, so its important that you remember to mount boot before the kernel is copied there.
> 
> The directory /boot (without boot mounted) is a normal directory, so installing the kernel there is not an error.
> ...

 

Ok, I am aware of that and I have checked after mounting /boot that all kernel images are in place. The problem is that my modules stopped loading from the first reboot after a @world update, I hadn't rebuilt the kernel then. 

And even after both rebuilding it and building a newer kernel version, no module ever autoloaded.

Checking uname -a and ifconfig -a, brb...

UPDATE:

Ok, ifconfig -a first:

```
dummy0: flags=130<BROADCAST,NOARP>  mtu 1500

        ether c2:3f:f3:9d:93:94  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        loop  txqueuelen 1  (Local Loopback)

        RX packets 2  bytes 100 (100.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 2  bytes 100 (100.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```

Here is uname -a:

```
Linux moria 4.4.6-gentoo #2 SMP PREEMPT Mon Aug 7 17:39:29 CEST 2017 x86_64 Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz GenuineIntel GNU/Linux
```

And here is /boot partition contents:

```
total 58010

lrwxrwxrwx 1 root root       1 Apr 23  2011 boot -> .

-rw-r--r-- 1 root root   82792 May 30  2015 config-3.18.11-gentoo

-rw-r--r-- 1 root root   82792 Jun 12  2015 config-3.18.12-gentoo

-rw-r--r-- 1 root root   89089 Aug 11 23:18 config-4.4.6-gentoo

-rw-r--r-- 1 root root   89089 Aug  7 20:16 config-4.4.6-gentoo.old

-rw-r--r-- 1 root root   93329 Aug 11 23:13 config-4.9.34-gentoo

-rw-r--r-- 1 root root   93329 Aug  7 20:05 config-4.9.34-gentoo.old

drwxr-xr-x 2 root root    1024 Sep 30  2012 grub

-rw-r--r-- 1 root root 4792752 May 18  2012 kernel-3.2.17-rt28

-rw-r--r-- 1 root root 4819856 May 20  2012 kernel-3.2.1-gentoo-r2-20120518

-rw-r--r-- 1 root root 3518448 Jun 17  2012 kernel-3.4.2-seed

-rw-r--r-- 1 root root 3628736 Dec 22  2012 kernel-3.4.2-seed2

drwx------ 2 root root   12288 Apr 22  2011 lost+found

-rw-r--r-- 1 root root 2079382 May 30  2015 System.map-3.18.11-gentoo

-rw-r--r-- 1 root root 2077823 Jun 12  2015 System.map-3.18.12-gentoo

-rw-r--r-- 1 root root 2333937 Aug 11 23:18 System.map-4.4.6-gentoo

-rw-r--r-- 1 root root 2333937 Aug  7 20:16 System.map-4.4.6-gentoo.old

-rw-r--r-- 1 root root 2450915 Aug 11 23:13 System.map-4.9.34-gentoo

-rw-r--r-- 1 root root 2450915 Aug  7 20:05 System.map-4.9.34-gentoo.old

-rw-r--r-- 1 root root 4394992 May 30  2015 vmlinuz-3.18.11-gentoo

-rw-r--r-- 1 root root 4312144 Jun 12  2015 vmlinuz-3.18.12-gentoo

-rw-r--r-- 1 root root 4740960 Aug 11 23:18 vmlinuz-4.4.6-gentoo

-rw-r--r-- 1 root root 4740960 Aug  7 20:16 vmlinuz-4.4.6-gentoo.old

-rw-r--r-- 1 root root 4957168 Aug 11 23:13 vmlinuz-4.9.34-gentoo

-rw-r--r-- 1 root root 4957168 Aug  7 20:05 vmlinuz-4.9.34-gentoo.old

```

As you can see, I ran 'make install' again just now, just to make sure /boot partition was mounted and correctly got the images from 'make install', hence the Aug 11 date by the 4.4.6-gentoo files.

I then rebooted into both 4.4.6 followed by 4.9.34 with the same result, no module loading...

Regards,

M.

----------

## ct85711

Can you please pastebin your kernel's .config, I want to see if anything in there will tell us more on why it isn't loading any modules.  As the kernel should be able to find and load modules, unless it is looking someplace else or something (possibly module support maybe is disabled or so).

----------

## muadib25

Sure, here:

https://pastebin.com/Tqestihj

This .config is the same I used on June 2016 when I first compiled 4.4.6.

----------

