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 ...
随机推荐
- js删除数组指定的某个元素
1.给js数组对象原型加indexof方法 获得元素索引 Array.prototype.indexOf = function(val) { for (var i = 0; i < this.l ...
- POJ3320 Jessica's Reading Problem(尺取+map+set)
POJ3320 Jessica's Reading Problem set用来统计所有不重复的知识点的数,map用来维护区间[s,t]上每个知识点出现的次数,此题很好的体现了map的灵活应用 #inc ...
- Neutron/ML2学习
Neutron/ML2 Neutron ML2 模块层2(ml2)插件是一种允许OpenStack网络同时地利用在复杂现实数据中心发现的各种第二层网络技术的框架.目前它与存在的openvswitch. ...
- 『重构--改善既有代码的设计』读书笔记----Introduce Explaning Variable
有时候你会遇到一系列复杂的表达式连续运算的时候,这个时候你可能根本招架不住如此长或者是如此复杂的长函数.这个时候你可以通过引用临时变量来储存他们的结果,将这些长函数的结果分成一个个临时变量来让函数清晰 ...
- type和instance
获取对象类型 type(object) >>> test_data = [1, 2, 3] >>> type(test_data) <type 'list'& ...
- IOS开发----委托机制
委托模式从GoF装饰模式.适配器模式和模板方法等演变过来,几乎每一个应用都会或多或少的用到委托模式. 在古希腊有一个哲学家,他毕生只做三件事情:“睡觉”.“吃饭”.和“工作”.为了更好的生活,提高工作 ...
- python:open/文件操作
open/文件操作f=open('/tmp/hello','w') #open(路径+文件名,读写模式) #读写模式:r只读,r+读写,w新建(会覆盖原有文件),a追加,b二进制文件.常用模式 如:' ...
- IOS--UIPageControl的使用方法详细
IOS--UIPageControl的使用方法详细 // UIPageControl的常用方法 UIPageControl *onePageControl = [[UIPageControl al ...
- 深入JS系列学习2
今天看和学习了深入理解JS系列2.3.4.5,更加明白了函数声明和表达式的区别,自执行函数和立即执行函数,js强大的原型链继承,js中对象的想过写法,modules模式等. 在ECMAScript中, ...
- 【动态规划】XMU 1583 Sequence
题目链接: http://acm.xmu.edu.cn/JudgeOnline/problem.php?id=1583 题目大意: T组数据,对于n(n<=6000)给定序列Xn(Xn<= ...