上一篇博客介绍了CentOS处理启动过程中,没有找到raid驱动导致的启动失败的问题,对于基于Debian的发行版、Gentoo等等系统处理起来是不一样的。因为各自都有对应的initramfs.img的管理工具。

介绍下各个发行版添加kernel module到initramfs的方法

Debian/Ubuntu

将启动过程依赖的raid驱动添加到/etc/initramfs-tools/modules

cat >> /etc/initramfs-tools/modules << EOF
ahci
aacraid
megaraid_sas
mpt3sas
EOF

添加完成之后还需要更新initramfs.img

update-initramfs -u

Gentoo

Gentoo可以使用genkernel来将所有内核模块集成到内存镜像:

genkernel --splash --no-install --no-clean --menuconfig all

Gentoo也可以使用dracut来管理内存镜像initramfs,需要在/etc/dracut.conf文件中添加下列信息:

# additional kernel modules to the default
add_drivers+="ahci megaraid_sas mpt3sas mpt2sas aacraid"

重新构建一下内存镜像

KERNEL_VERSION=`ls /lib/modules/ -1`
dracut --force --fstab --early-microcode

参考链接

【腾讯云】境外1核2G服务器低至2折,半价续费券限量免费领取!
https://cloud.tencent.com/act/cps/redirect?redirect=1068&cps_key=e4b50f6c64a4480367f8a8d16fd07c5a&from=console

标签: kernel, dracut, driver, initramfs, update-initramfs, genkernel

添加新评论