我grub.conf在 CentOS 7 中搜索文件。我找不到它locate(我updatedb之前打过电话)。它存储在哪里?
在旧版本的 CentOS 中,我可以找到它。
Ada*_*m C 22
CentOS7 使用的是 grub2 和生成的/boot/grub2/grub.cfg而不是旧grub.conf格式,这就是您找不到它的原因。新的 grub.cfg 文件不用于直接编辑,您需要修改用于生成它的源文件。
有问题的文件/etc/default/grub和脚本/etc/grub.d/。特别是,如果您希望添加自己的自定义条目,那么您需要将引导节附加到/etc/grub.d/40_custom. 该节将如下所示:
menuentry "My custom boot entry" {
set root=(hd0,1)
linux /vmlinuz-3.11-custom
initrd /initrd-plymouth.img
}
Run Code Online (Sandbox Code Playgroud)
您可以将常用选项添加到linux行中以将自定义选项传递给内核。一旦你让一切看起来都像你想要的那样,你运行:
grub2-mkconfig --output=/boot/grub2/grub.cfg
Run Code Online (Sandbox Code Playgroud)
然后,如果您想更改默认启动项,您可以更改GRUB_DEFAULT选项 in/etc/default/grub以指向您添加的新节,通过零索引位置或名称(我更喜欢名称),如下所示:
GRUB_DEFAULT="My custom boot entry"
Run Code Online (Sandbox Code Playgroud)