initrd网络转载

initrd网络转载

另:

Cent OS 5.4(2.6.18-194.el5)升级到2.6.34后启动可能汇报错

如下:

Red Hat nash version 5.1.19.6 starting
insmod : error inserting '/lib/dm-region-hash.ko' : -1 File exists
mount: could not find filesystem '/dev/root'
setuproot: moving /dev failed: No such file or directory
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
setuproot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!
一、insmod: error inserting '/lib/dm-region-hash.ko' : -1 File exists

Resolve:

1.解压initrd文件

[root@test9 ~]# cp /boot/initrd-2.6.34.6.img /tmp

[root@test9 ~]# cd /tmp/

[root@test9 tmp]# ls

initrd-2.6.34.6.img

[root@test9 tmp]# mkdir newinitrd

[root@test9 tmp]# cd newinitrd/

[root@test9 newinitrd]# zcat ../initrd-2.6.34.6.img |cpio -i

11537 blocks

释放之后看到如下内容

[root@test9 newinitrd]# ls

bin   dev   etc   init   lib   proc   sbin   sys   sysroot

 

2. 下边就是编辑init,删掉其中重复的四行中的两行

echo "Loading dm-region-hash.ko module"

insmod /lib/dm-region-hash.ko

echo "Loading dm-region-hash.ko module"

insmod /lib/dm-region-hash.ko

 

3,重新打包initrd

[root@test9 newinitrd]# find .|cpio -c -o > ../initrd

11538 blocks

[root@test9 newinitrd]# cd ..
[root@test9 tmp]# rm –rf initrd.2.6.34.6.img

[root@test9 tmp]# gzip -9 < initrd > initrd.2.6.34.6.img

[root@test9 tmp]# ls

initrd-2.6.34.6.img    initrd      newinitrd ………

好了,initrd.img就是重新打包的initrd了,然后把initrd.2.6.34.6img拷贝到/boot,

这样“insmod: error inserting '/lib/dm-region-hash.ko' : -1 File exists” 就不会有了

其实将init文件的第二行“setquiet” 去掉,你就知道initrd文件到底在做什么了

二、 “mount: could not find filesystem '/dev/root'

setuproot: moving /dev failed: No such file or directory
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
setuproot: mount failed: No such file or directory”

在最近的2.6.33内核编译升级时,也出现“mount: could not find filesystem '/dev/root'”提示,最后找到问题所在,要设置.config文件:

CONFIG_SYSFS_DEPRECATED_V2=Y  具体位置,可以在make menuconfig时使用查找功能,查找CONFIG_SYSFS_DEPRECATED_V2会有提示在什么配置节设置:

 Symbol: SYSFS_DEPRECATED_V2 [=y]                                                                                            

   Prompt: enable deprecated sysfs features to support old userspace tools                                                     

   Defined at init/Kconfig:627                                                                                               

     Depends on: SYSFS [=y]                                                                                                    

     Location:                                                                                                                 

       -> General setup                                                                                                        

     Selects: SYSFS_DEPRECATED [=y]   

General setup 

  --> [*] enable deprecated sysfs features to support old userspace tools

然后重新译内核即可

 

注:也可以直接去修改内核源码的配置文件:.config

找到CONFIG_SYSFS_DEPRECATED_V2取消注释,保存退出

再重新编译内核。

你可能感兴趣的:(Linux)