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/grubGRUB_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

原文地址:https://www.cnblogs.com/lsgxeva/p/8918589.html

时间: 2024-08-26 02:10:38

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

CentOS7.6删除/boot目录下所有内容的故障修复详细步骤

CentOS7.6删除/boot目录下所有内容的故障修复 A. 装置重启,出现Starting进度条时,按一次Esc键 B. 选择CD-ROM从光盘启动 C. 选择Troubleshooting D. 选择Rescue a CentOS system E. 输入1,选择Continue F. 按Enter键 G. 输入chroot /mnt/sysimage切根 H. 挂载光盘mount /dev/sr0 /mnt I. rpm安装内核 rpm -ivh /mnt/Packages/kernel

linux下怎么修改grub.cfg

一.grub2的启动配置文件grub.cfggrub2的启动配置文件grub.cfg是/boot/grub/grub.cfg,而不是以前的memu.lst.如果你是多系统,有Ubuntu和windows,那么用下面的命令,可以使grub2得到所以可以启动的系统.sudo update-grub实际就是让系统自己生成合适的grub.cfg文件.这个grub.cfg文件是只读属性,so如果你要修改它,需要权限.sudo chmod +w /boot/grub/grub.cfg然后可以编辑grub.c

Grub2 基本操作 和 grub.cfg 配置信息

grub2基础教程(节选)1.安装ubuntu9.10时,grub默认安装在第一硬盘(hd0)的mbr,其实就是把引导文件 boot.img写入硬盘的mbr,当然,用户也可  以选择不写入硬盘mbr而是写入linux分区的引导扇区.启动时根据mbr所提供信息找到启动分区后,加载分区内的grub核心文件core.img和  配置文件grub.cfg,进入选择菜单画面,在菜单画面,按上下箭号选择需要系统菜单项,按Enter进入选项. 按e进入己选择菜单的编辑状态,在编辑状态下,由上下左右箭号来移动光

我的grub.cfg配置文件

路径:/boot/grub/grub.cfg 配置文件如下: # # DO NOT EDIT THIS FILE # # It is automatically generated by grub-mkconfig using templates # from /etc/grub.d and settings from /etc/default/grub # ### BEGIN /etc/grub.d/00_header ### if [ -s $prefix/grubenv ]; then s

Boot loader: Grub进阶[转]

Boot loader: Grub进阶 本文记录grub的一些进阶配置 关於核心功能当中的 vga 配置 事实上,你的 tty1~tty6 除了 80x24 的解析度外,还能够有其他解析度的支持喔!但前提之下是你的核心必须支持 FRAMEBUFFER_CONSOLE 这个核心功能选项才行.如何确定有没有支持呢?你可以查阅 /boot/config-2.6.18-92.el5 这个文件,然后这样搜寻: [[email protected] ~]# grep 'FRAMEBUFFER_CONSOLE

zynq生成boot.bin的批处理...方便啊!

在xilinx的SDK下生成boot.bin的过程,有时非常让人恼火... 得手动选几个文件xx.fsbl, xx.bit, xx.elf.....选来选去的非常麻烦, 而且SDK还常常Browse时...还不指定在当前工程目录下... 所以,我一怒之下,想写个批处理...没有写出来...拖延症严重.. *_* 最后还是高老师出马,我基本照抄...写了个简单注释... 总之是非常方便,手动把要转的bit,fsbl.elf,xx.elf一起拖到这个批处理中.... 如xxxx.bit,  xxx_

centos7利用系统镜像修复grub

1 故障描述 由于错误操作,导致grub配置文件失效,系统开机后一直卡在下面的画面. 2 解决办法 这时候,就要利用系统镜像光盘,进入修复模式,然后按下面图示操作 进入镜像的shell环境,如下图所示,继续操作. 恢复完成,exit退出镜像shell环境,然后reboot重启即可,系统就能正常登陆了. 原文地址:https://www.cnblogs.com/blog-tim/p/12331182.html

centos7 下 减少/boot分区空间,扩大/ 的空间

1.把/home内容备份 2.然后将/home文件系统所在的逻辑卷删除 3.扩大/root文件系统 4.新建/home tar cvf /tmp/home.tar /home #备份/home umount /home #卸载/home,如果无法卸载,先终止使用/home文件系统的进程 lvremove /dev/centos/home #删除/home所在的lvlvextend -L +50G /dev/centos/root #扩展/root所在的lv,增加50Gxfs_growfs /de

CentOS7网卡名修改

CentOS7网卡名修改CentOS7网卡名与CentOS6不同,然而7的早期版本与最新的版本的网卡名又有所不同,在生产环境中,为了实现自动化管理,首先要实现全部标准化,所以要将网卡名同一设置为和CentOS6相同的ethN的格式,具体的修改方法如下: 1.首先修改/etc/default/grub文件,在GRUB_CMDLINE_LINUX行最后添加net.ifnames=0 [[email protected] ~]# vim /etc/default/grub GRUB_TIMEOUT=5