- 论坛徽章:
- 0
|
内核挂了,日志过程,请兄弟们分析一下,谢谢……
有关对
kernel: kmod: failed to exec /sbin/modprobe -s -k scsi_hostadapter, errno = 2
的分析:
Whenever the linux kernel detects that an operation it attempts requires
a driver not compiled in, and not loaded yet, it calls out to a userspace
program in order to load the driver. The program used for this purpose is
configurable on the fly from userspace, and defaults to /sbin/modprobe.
The currently used program can be obtained by doing a
$ cat /proc/sys/kernel/modprobe
(Note: all this requires a kernel configured to use modules, and the
kernel module loader, of course. All distributions known to me ship
kernels configured this way)
The reason for using a userspace program is that this program might have
much more information available about the module requested than the
kernel itself. modprobe, for example, uses a dependency database to obtain
information about requirements of the kernel module itself. For example,
if the kernel tries to load the usb driver (usb-uhci.o, or another),
modprobe knows that it will need usbcore.o as well, and loads both.
In addition, modprobe can honor a configuration file (/etc/modules.conf
by default), in which additional information, as module parameters, can
be stored. When using multiple network cards inside one machine, this can
be used to map ethernet devices (eth0, eth1..) onto specific network
cards.
When the kernel boots, it tries to get it's hardware subsystems up and
running. One of these subsystems is the SCSI system. So the kernel tries
to call modprobe to load "scsi_hostadapter". This is not a real module
name, it's an alias, which has to be mapped by modprobe to a real kernel
module name. The problem is, at this early stage, the kernel is very much
on it's own. There is no root file system, because the hard disks can not
be accessed yet (there is no SCSI driver), and the initial ramdisk (a tiny,
comressed filesystem containing some small programs and drivers to make
the kernel mount it's real root filesystem) is not mounted yet, either.
So, there simply is no /sbin/modprobe for the kernel to execute, and the
attempt fails with error number 2, which means: ENOENT (No such file or
directory).
You may ask: if this call fails, then, how does the kernel detect it's
SCSI disks, anyway (it has to, since it mounts it's real root file system
of them a little while later)? The initial ramdisk contains this driver,
and explicitly loads it using /sbin/insmod (which is contained in the
ramdisk as well).
There is not much magic in the linux boot process, really, but it is still
fascinating to see how it all comes together in the end. |
|