CentOS7重新生成 /boot/grub2/grub.cfg

CentOS7 is using grub2 and the generated /boot/grub2/grub.cfg rather than the old grub.confformat, 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:

menuentry "My custom boot entry" {
set root=(hd0,1)
linux /vmlinuz-3.11-custom
initrd /initrd-plymouth.img
}

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:

GRUB_DEFAULT="My custom boot entry"

修改/etc/default/grub
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto vconsole.keymap=us rhgb quiet"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto enforcing=0 vconsole.keymap=us rhgb quiet"
添加
enforcing=0
存盘退出
执行 grub2-mkconfig --output /boot/grub2/grub.cfg OK

CentOS7重新生成 /boot/grub2/grub.cfg的更多相关文章

  1. fedora 28 重新生成 /boot/grub2/grub.cfg

    使用情景: 之前电脑安装了windows 7/ fedora 28 双系统,由于特殊原因,需要删除 windows 系统.在格式化硬盘后,我们还需要跟新 grub2 的启动条目:删除grub 启动的界 ...

  2. 破解CentOS7的root及加密grub修复实战

    破解CentOS7的root及加密grub修复实战 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.破解CentOS7的root口令方案1 1>.启动时任意键暂停启动 2& ...

  3. CentOS7 Linux中通过加密grub防止黑客通过单用户系统破解root密码

    如何防止别人恶意通过单用户系统破解root密码,进入系统窃取数据? 给grub加密,不让别人通过grub进入单用户. 17.3.1  基于centos6进行grub加密 [root@63 ~]# gr ...

  4. CentOS7密码忘记解决方法&&GRUB菜单加密

    CentOS7的root密码忘记怎么办 注意:该方法只适用于Linux7版本,可以用cat /redhat-release 查看 这里这里只介绍一种方法 1.启动的时候,在启动界面,相应启动项,内核名 ...

  5. centos7备份还原与grub2引导和rescue模式修改root密码

    一.centos7备份1.su -2.cd /3.tar -zpPcvf backup.tgz --exclude=/sys --exclude=/mnt --exclude=/proc --excl ...

  6. Ubuntu grub2的启动配置文件grub.cfg,为了修改另人生厌的时间

    文章转自http://hi.baidu.com/detax/blog/item/90f18b54a8ef5253d00906e4.html 升级到Ubuntu 9.10后,就要接触grub2了,它和以 ...

  7. linux下怎么修改grub.cfg

    一.grub2的启动配置文件grub.cfggrub2的启动配置文件grub.cfg是/boot/grub/grub.cfg,而不是以前的memu.lst.如果你是多系统,有Ubuntu和window ...

  8. CentOS7 修复grub.cfg文件

    为了达到实验目的,首先删除grub.cfg文件 重启后发现系统进不去了,这正是我们想要的 进入系统救援模式,通过输入以下命令修复grub.cfg文件 重启后发现能正常引导进入系统了

  9. grub.cfg文件编辑

    grub2启动项里面找不到Windows的情况,这时候就需要自己去配置grub.cfg 在grub.cfg中加入如下代码: menuentry 'Windows Boot Manager (on /d ...

随机推荐

  1. Using an Image for the Layer’s Content

    Using an Image for the Layer’s Content Because a layer is just a container for managing a bitmap ima ...

  2. 【DBA-Oracle】更改Oracle数据字符集_转为常用的ZHS16GBK

    A.oracle server 端 字符集查询  select userenv('language') from dual 其中NLS_CHARACTERSET 为server端字符集 NLS_LAN ...

  3. java Html&JavaScript面试题:HTML 的 form 提交之前如何验证数值文本框的内容全部为数字? 否则的话提示用户并终止提交?

    提交的验证方法(通过单个字符比较): <!DOCTYPE html> <html> <head> <meta charset="UTF-8" ...

  4. Java传值分析

    public class Example{String str=new String("good");char[] ch={'a','b','c'};public static v ...

  5. Qt之QThread随记

    这是一篇随记,排版什么的就没有那么好了:) 首先要知道,一个线程在资源分配完之后是以某段代码为起点开始执行的,例如STL内的std::thread,POSIX下的pthread等,都是以函数加其参数之 ...

  6. C盘扩展卷是灰色的扩容方法

    当想要扩容C盘的时候可能会发现C盘的扩展卷竟然是灰色的.原因是C盘旁边没有紧挨着的“”未分配空间“”, 只要将D盘的空间分出一些来就可以了. !!!磁盘的分区合并有风险,重要文件等记得先备份  !!! ...

  7. 可拖拽div

    在开发的时候需要一个可拖拽的prompt弹框.自己写了一个,大概思路为: 1.获取鼠标左键按下移动的起点坐标(x,y). 2.获取div的left和top属性. 3.得到鼠标坐标到左上角的距离(x-t ...

  8. zabbix 密码忘记了如何恢复

    1.进入数据库 2.使用zabbix的数据库 use zabbix: 3.查看表信息 show tables; 4.搜索users表 select * from users; 5.修改userid为1 ...

  9. django+xadmin在线教育平台(六)

    4-1 使用py3.6和django1.11开发系统前注意事项 直接通过Python3.6和django最新版本来开发我们的系统的一些注意事项. 原版本: Python 2.7 & djang ...

  10. vim粘贴取消自动缩进

    Vim 复制粘贴探秘 Vim 作为最好用的文本编辑器之一,使用vim来编文档,写代码实在是很惬意的事情.每当学会了vim的一个新功能,就会很大地提高工作效率.有人使用vim几 十年,还没有完全掌握vi ...