CentOS7重新生成 /boot/grub2/grub.cfg
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的更多相关文章
- fedora 28 重新生成 /boot/grub2/grub.cfg
使用情景: 之前电脑安装了windows 7/ fedora 28 双系统,由于特殊原因,需要删除 windows 系统.在格式化硬盘后,我们还需要跟新 grub2 的启动条目:删除grub 启动的界 ...
- 破解CentOS7的root及加密grub修复实战
破解CentOS7的root及加密grub修复实战 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.破解CentOS7的root口令方案1 1>.启动时任意键暂停启动 2& ...
- CentOS7 Linux中通过加密grub防止黑客通过单用户系统破解root密码
如何防止别人恶意通过单用户系统破解root密码,进入系统窃取数据? 给grub加密,不让别人通过grub进入单用户. 17.3.1 基于centos6进行grub加密 [root@63 ~]# gr ...
- CentOS7密码忘记解决方法&&GRUB菜单加密
CentOS7的root密码忘记怎么办 注意:该方法只适用于Linux7版本,可以用cat /redhat-release 查看 这里这里只介绍一种方法 1.启动的时候,在启动界面,相应启动项,内核名 ...
- centos7备份还原与grub2引导和rescue模式修改root密码
一.centos7备份1.su -2.cd /3.tar -zpPcvf backup.tgz --exclude=/sys --exclude=/mnt --exclude=/proc --excl ...
- Ubuntu grub2的启动配置文件grub.cfg,为了修改另人生厌的时间
文章转自http://hi.baidu.com/detax/blog/item/90f18b54a8ef5253d00906e4.html 升级到Ubuntu 9.10后,就要接触grub2了,它和以 ...
- linux下怎么修改grub.cfg
一.grub2的启动配置文件grub.cfggrub2的启动配置文件grub.cfg是/boot/grub/grub.cfg,而不是以前的memu.lst.如果你是多系统,有Ubuntu和window ...
- CentOS7 修复grub.cfg文件
为了达到实验目的,首先删除grub.cfg文件 重启后发现系统进不去了,这正是我们想要的 进入系统救援模式,通过输入以下命令修复grub.cfg文件 重启后发现能正常引导进入系统了
- grub.cfg文件编辑
grub2启动项里面找不到Windows的情况,这时候就需要自己去配置grub.cfg 在grub.cfg中加入如下代码: menuentry 'Windows Boot Manager (on /d ...
随机推荐
- python_41_with语句
#为了避免打开文件后忘记关闭,可以通过管理上下文,即:with open('log','r') as f: # 如此方式,当with代码块执行完毕时,内部会自动关闭并释放文件资源. with open ...
- 题解 P1280 【尼克的任务】
传送门 f[i]表示i~n的最长空闲时间: 如果当前无任务就休息一秒(f[i]=f[i+1]+1): 否则f[i]=max(f[i],f[i+当前工作时间]); 用结构体来记录,我们对于每一个时刻开一 ...
- 修改android studio中的avd sdk路径、avd sdk找不到的解决方案
要进行Android应用程序的开发,首先就要搭建好Android的开发环境,所需要的工具有如下4个:1.java JDK:2.Android SDK:3.Eclipse:4.ADT 1.java JD ...
- linux内核--定时器API
/**<linux/timer.h> 定时器结构体 struct timer_list { ........ unsigned long expires; --内核希望定时器执行的jiff ...
- 【css】如何实现响应式布局
“自适应网页设计”到底是怎么做到的?其实并不难. 首先,在网页代码的头部,加入一行viewport元标签. <meta name="viewport" content=&qu ...
- python各种操作列表的方法及案例
一.循环的使用方法 names = ["张真","刘德华","哈林","谢霆锋","张柏芝"] fo ...
- day 52 Django基础一之web框架的本质
Django基础一之web框架的本质 django第一天 本节目录 一 web框架的本质及自定义web框架 二 模板渲染JinJa2 三 MVC和MTV框架 四 Django的下载安装 五 基于D ...
- Python中的正则
regex_lst = [ ('字符组',), ('非打印字符',), ('特殊字符',), ('定位符',), ('限定符',), ('re模块',), ('分组命名',), ('或匹配',), ( ...
- 对二维数组使用指针进行操作的探索(C语言)
/* Name: 对二维数组使用指针进行操作的探索 Copyright: Author: lingr7 Date: 01/12/18 11:55 Description: */ #include< ...
- 遗传算法 | C++版GA_TSP
嗯哼,时隔半年,再次有时间整理关于组合优化问题——旅行商问题(Traveling Salesman Problem, TSP),这次采用的是经典遗传算法(Genetic Algorithm, GA)进 ...