2017年1月4日 星期三

[Linux 常見問題] Searching for grub configuration file in CentOS 7

Source From Here
Question
I am searching for grub.conf file in CentOS 7. I cant find it with locate(I called updatedb before). Where does it stores?

How-To
CentOS7 is using grub2 and the generated /boot/grub2/grub.cfg rather than the old grub.conf format, which is why you can't find it. The new grub.cfg file is not intended for direct editing, instead you need to modify the source files that are used to generate it. The files in question are /etc/default/grub and the scripts in /etc/grub.d/. In particular, if you are looking to add your own custom entries, then you will want to append a boot stanza to /etc/grub.d/40_custom. The stanza will look something like this:
  1. menuentry "My custom boot entry" {  
  2.         set root=(hd0,1)  
  3.         linux /vmlinuz-3.11-custom  
  4.         initrd /initrd-plymouth.img  
  5.     }  
You can add the usual options to the linux line to pass in custom options to the kernel. Once you have everything looking the way you want it to, you run:
# grub2-mkconfig --output=/boot/grub2/grub.cfg

Then, if you want to alter the default boot entry, you change the GRUB_DEFAULT option in /etc/default/grub to point to the new stanza you added, by zero indexed position or by name (I prefer name), something like this:
  1. GRUB_DEFAULT="My custom boot entry"  


沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...