Fatal Error: Could not open /lib/modules/

Asked by Ganesh on 2007-01-01


Binary package hint: linux-source-2.6.15


I have installed ubuntu linux 2.6.15-27-386 successfully. I have downloaded linux-source-2.6.15 and I am trying to rebuild the kernel from the source based on the information available at http://fossil.wpi.edu/docs/howto_build_kernel.html. After trying the following commands I am not able to boot from the kernel I built when I select the grub menu item "Ubuntu, kernel linux-source-2.6.15". The error message is:

Fatal Error: Could not open /lib/modules/

I have verified the files and directoy listed in /boot/grub/menu.lst do exist, as shown below. Even if I copy modules.dep to modules.dep.temp, it is not booting.

Any idea what step I am missing?

Thanks and regards

List of commands I tried to build the kernel from the source from /home/vganesh/linux_src/linux-source-2.6.15 directory.

$ uname -a
Linux vganesh-desktop 2.6.15-27-386 #1 PREEMPT Fri Dec 8 17:51:56 UTC 2006 i686 GNU/Linux

$ sudo chown -R USER:root /home/vganesh/linux_src/linux-source-2.6.15/
$ sudo chown -R root /home/vganesh/linux_src/linux-source-2.6.15/
$ sudo make clean
$ sudo make menuconfig
$ sudo make
$ sudo make bzImage
$ sudo make modules_install
$ sudo mkdir /boot/testing
$ sudo cp arch/i386/boot/bzImage /boot/testing/
$ sudo vi /boot/grub/menu.lst
$ cat /boot/grub/menu.lst
title Ubuntu, kernel linux-source-2.6.15
root (hd1,0)
kernel /boot/testing/bzImage root=/dev/hdb1 ro quiet splash
initrd /boot/initrd.img-2.6.15-23-386


$ ls -l /boot/testing/
total 1388
-rw-r--r-- 1 root root 1414758 2006-12-31 09:37 bzImage
$ ls -l /boot/initrd.img-2.6.15-23-386
-rw-r--r-- 1 root root 7001304 1996-12-31 21:23 /boot/initrd.img-2.6.15-23-386

$ ls -l /lib/modules/
ls: /lib/modules/ No such file or directory

$ ls -l /lib/modules/
-rw-r--r-- 1 root root 327117 2006-12-31 09:32 /lib/modules/

$ ls -l /lib/modules/
total 1412
lrwxrwxrwx 1 root root 43 2006-12-31 09:26 build -> /home/vganesh/linux_src/linux-source-2.6.15
drwxr-xr-x 10 root root 4096 2006-12-31 09:31 kernel
-rw-r--r-- 1 root root 306170 2006-12-31 09:32 modules.alias
-rw-r--r-- 1 root root 69 2006-12-31 09:32 modules.ccwmap
-rw-r--r-- 1 root root 327117 2006-12-31 09:32 modules.dep
-rw-r--r-- 1 root root 813 2006-12-31 09:32 modules.ieee1394map
-rw-r--r-- 1 root root 806 2006-12-31 09:32 modules.inputmap
-rw-r--r-- 1 root root 21795 2006-12-31 09:32 modules.isapnpmap
-rw-r--r-- 1 root root 74 2006-12-31 09:32 modules.ofmap
-rw-r--r-- 1 root root 243251 2006-12-31 09:32 modules.pcimap
-rw-r--r-- 1 root root 1135 2006-12-31 09:32 modules.seriomap
-rw-r--r-- 1 root root 129369 2006-12-31 09:32 modules.symbols
-rw-r--r-- 1 root root 362008 2006-12-31 09:32 modules.usbmap
lrwxrwxrwx 1 root root 43 2006-12-31 09:26 source -> /home/vganesh/linux_src/linux-source-2.6.15

Re: Fatal Error: Could not open /lib/modules/ from mlind at 2007-01-01 00:28:08 UTC

Did you try to run depmod manually?

Re: Fatal Error: Could not open /lib/modules/ from ChuckShort at 2007-01-01 16:29:45 UTC

This is more of a support than a bug. You might want to open a support request instead.

I ran the command "sudo make depmod" successfully. However, when I try to reboot I see the same issue.

Question information

English Edit question
Ubuntu linux-source-2.6.15 Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:

I would not recommend using that method for compiling an Ubuntu kernel. The following page details the preferrred method:-


Ganesh (venkat-ganesh43016) said : #2


Thanks for the recommendation and I followed the instructions literally. I am able to download the source and then tried to compile the kernel based on the information from the wiki page you have pointed. The compilation ran for twenty fours and then I was running out of disk space :-(!! So I have deleted all the *.o files. Then I realized I must compile the kernel specifically for my computer and NOT for all architectures,

Now from the url https://wiki.kubuntu.org/KernelCustomBuild, I see the following information.
To build a specific target, use this command:

AUTOBUILD=1 fakeroot debian/rules binary-debs flavours=k7

This will only build the AMD k7 variant of the i386 architecture.

From sysinfo for my computer, the CPU details are as follows:

 - Vendor identification -> [GenuineIntel]
 - Model name -> [Pentium III (Katmai)]
 - Raw frequency -> [451.104 MHz]
 - Cache size -> [512 KB]
 - Model number -> [7]
 - Family number -> [6]
 - Stepping -> [3]
 - BogoMIPS -> [903.38]

Now I am trying to find out what must be the correct value for the flavours for my computer.

If I need to find the correct flavours value for another computer say xeon, from where can I get this information? Are all possible values for flavours listed somewhere?

Even though I am familiar with bash scripts as well as Makefiles, I am finding it difficult to understand the debian rules. What are these debian rules? Is it something new? Where can I get more information on understanding the debian rules, what are they for etc?

Thanks and regards,

Best Ganesh (venkat-ganesh43016) said : #3

I followed the instructions The “Alternate Build Method: The Old-Fashioned Debian Way” available at https://wiki.ubuntu.com/KernelCustomBuild and that worked for me. I was able to build the kernel and I am able to successfully start it too.

Thanks a lot.