Linux GRUB 2及修改默认启动项
The GRUB 2 boot loader makes sure that you can boot Linux. GRUB 2 is installed in the boot sector of your server’s hard drive and is configured to load a Linux kernel and the initramfs:
■ The kernel is the heart of the operating system, allowing users to interact with the hardware that is installed in the server.
■ The initramfs contains drivers that are needed to start your server. It contains a mini file system that is mounted during boot. In it are kernel modules that are needed during the rest of the boot process (for example, the LVM modules and SCSI modules for accessing disks that are not supported by default).
Normally, GRUB 2 works just fine and does not need much maintenance. In some cases, though, you might have to change its configuration. To apply changes to the GRUB 2 configuration, the starting point is the /etc/default/grub file. In this file, you’ll find options that tell GRUB what to do and how to do it.
[root@rhel7 ~]# cat /etc/default/grub
GRUB_TIMEOUT=
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@rhel7 ~]#
The most important part that it configures is the GRUB-CMDLINE_LINUX option. This line contains boot arguments for the kernel on your server.
Modifying Default GRUB 2 Boot Options
To apply modifications to the GRUB 2 boot loader, the file /etc/default/grub is your entry point; do not change the contents of the /boot/grub2/grub.cfg(不要直接修改这个配置文件) configuration file directly. The most important line in this file is GRUB_CMDLINE_ LINUX, which defines how the Linux kernel should be started. In this line, you can apply permanent fixes to the GRUB 2 configuration. Some likely candidates for removal are the options rhgb and quiet(删除这两个参数后,启动时显示详细信息) . These options tell the kernel to hide all output while booting. That is nice to hide confusing messages for end users, but if you are a server administrator, you probably just want to remove these options.
Another interesting parameter is GRUB_TIMEOUT. This defines the amount of time your server waits for you to access the GRUB 2 boot menu before it continues booting automatically.
Applying Modifications to GRUB2
In this exercise you’ll apply some changes to the GRUB2 boot configuration and write them to the /boot/grub2/grub.cfg configuration file.
- 1. Open the file /etc/default/grub with an editor and remove the rhgb and quiet options from the GRUB_CMDLINE_LINUX line.
- 2. From the same file, set the GRUB_TIMEOUT parameter to 10 seconds. Save changes to the file and close the editor.
[root@rhel7 ~]# cat /etc/default/grub
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap"
GRUB_DISABLE_RECOVERY="true"
[root@rhel7 ~]#
- 3. From the command line, type grub2-mkconfig > /boot/grub2/grub.cfg to write the changes to GRUB 2. (Note that instead of using the redirector > to write changes to the grub.cfg file, you could use the -o option. Both methods have the same result.)
[root@rhel7 ~]# grub2-mkconfig > /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.-.el7.x86_64
Found initrd image: /boot/initramfs-3.10.-.el7.x86_64.img
Found linux image: /boot/vmlinuz--rescue-c9e1b1f7c9514da7a2e9448646555486
Found initrd image: /boot/initramfs--rescue-c9e1b1f7c9514da7a2e9448646555486.img
done
[root@rhel7 ~]#
- 4. Reboot and verify that while booting you see boot messages scrolling by.
Linux GRUB 2及修改默认启动项的更多相关文章
- CentOS 7 添加win7启动项——修改默认启动项
CentOS 7使用grub2引导启动,在win7之后装完CentOS再启动会丢失win7启动项. 首先,添加win7启动项,步骤如下: 1.使用root登陆系统 2.用文本编辑器打开 /boot/g ...
- 三个linux系统共存,修改默认启动
一个mint,一个ubuntu,想要默认启动ubuntu,那么咱们这么来:修改启动顺序,我们需要修改Ubuntu的GRUB配置文件.使用常见的编辑程序如"gedit"就可以很方便 ...
- 安装ubuntu和windows双系统后,如何修改默认启动项
在安装了Ubuntu16.04系统之后,系统会默认自启动Ubuntu16.04,而我们大多数情况下可能都在使用windows系统,不修改默认设置,不经意间便会启动了Ubuntu16.04,通过我的经历 ...
- win7 启动管理器修改默认启动项
最近给我的超级本做了系统备份,以防万一,但是备份完成后,系统启动的时候总会首先进入Windows启动管理器,且默认启动项是Ghost,还需要选择一下才能进入Win7系统,如何解决这个问题呢? 方案一: ...
- Ubuntu - Grub2.0修改默认启动项
1. 我的环境: Ubuntu 10.04 2. 关键位置和文件: /boot/grub/grub.cfg 文件: /etc/grub.d/ 目录: /etc/default/grub 文件: ...
- linux deepin 12.12.1和Windows 7双系统修改默认启动项
1.打开终端,输入 sudo gedit /etc/default/grub ,然后输入密码.2.在出来的文本编辑器中找到 GRUB_DEFAULT=0 一行,把0改为2(因为我的Windows 7在 ...
- 【Linux-CentOS】CentOS安装Win双系统后Win启动项丢失及默认启动项修改
转载自:搁浅bky,有部分更正,建议看此文. 1.Windows启动项消失的原因: 在安装Win7.8/10系统+CentOS7双系统后,默认会将mbr(Main Boot Record)改写为g ...
- CentOS 7与 Windows双系统丢失Windows启动项及默认启动项修改
1.Windows启动项消失的原因: 在安装Win7.8/10系统+CentOS7双系统后,默认会将mbr(Main Boot Record)改写为grub2,默认的CentOS7无法识别Wind ...
- Centos7多内核情况下修改默认启动内核方法
1.1 进入grub.cfg配置文件存放目录/boot/grub2/并备份grub.cfg配置文件 [root@linux-node1 ~]# cd /boot/grub2/ [root@linux ...
随机推荐
- 【转】POJ题目分类
初级:基本算法:枚举:1753 2965贪心:1328 2109 2586构造:3295模拟:1068 2632 1573 2993 2996 图:最短路径:1860 3259 1062 2253 1 ...
- RedHat9上安装jdk
1.先在windows下载jdk:jdk-6-dlj-linux-i586.bin 2.用ftp上传给linux下 3.chmod 777 jdk-6-dlj-linux-i586.bin 4.将jd ...
- JQUERY1.9学习笔记 之基本过滤器(九) 小于选择器
小于选择器 jQuery( ":lt(index)" ) jQuery( ":lt(-index)" ) 描述:选择所有小于指定下标的元素. <!DOCT ...
- C语言笔记(结构体与offsetof、container_of之前的关系)
关于结构体学习,需要了解:结构体的定义和使用.内存对齐.结构体指针.得到结构体元素的偏移量(offsetof宏实现) 一.复习结构体的基本定义和使用 typedef struct mystruct { ...
- 2-16 HDO1106
这题寒假也没搞出来,但今天花了一小时终于搞定. 题意是输入一串数字字符,把‘5’当作空格,然后把被分割开的数字进行排序输出. 首先是字符串输入,按照高精度的处理方法,数值低位放到数组低位.(字符串型的 ...
- oldboy第五天学习
一.生成器 列表生成器 >>> a [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> b = [] >>> for i in ...
- matplotlib绘制精美的图表(这是教程哦)
http://sebug.net/paper/books/scipydoc/matplotlib_intro.html
- DC-DC转换器原理与应用
DC/DC转换器为转变输入电压后,有效输出固定电压的电压转换器.DC/DC转换器分为三类:升压型DC/DC转换器.降压型DC/DC转换器以及升降压型DC/DC转换器.根据需求可采用三类控制.PWM控制 ...
- C++编程中对缓冲区的理解(OS默认4096大小的缓冲区,有例子,很形象)
什么是缓冲区缓冲区又称为缓存,它是内存空间的一部分.也就是说,在内存空间中预留了一定的存储空间,这些存储空间用来缓冲输入或输出的数据,这部分预留的空间就叫做缓冲区.缓冲区根据其对应的是输入设备还是输出 ...
- 使用Qt编写模块化插件式应用程序
动态链接库技术使软件工程师们兽血沸腾,它使得应用系统(程序)可以以二进制模块的形式灵活地组建起来.比起源码级别的模块化,二进制级别的模块划分使得各模块更加独立,各模块可以分别编译和链接,模块的升级不会 ...