Linux grub2 change default kernel
GRUB 2 is a rewrite of GRUB
1. The configuration file is grub.cfg rather than menu.lst or grub.conf
2. grub.cfg is typically automatically generated by grub-mkconfig
3.
Partition numbers in GRUB device names now start at 1, not 0
4. Many more file systems are supported, including but not limited to ext4, HFS+, and NTFS.
5. GRUB 2 can read files directly from LVM and RAID devices.
6. GRUB 2 has more reliable ways to find its own files and those of target kernels on multiple-disk systems,
GRUB 2 configuration file
GRUB 2 reads its configuration from the /boot/grub2/grub.cfg
file on traditional BIOS-based machines and from the /boot/efi/EFI/redhat/grub.cfg
file on UEFI machines. This file contains menu information.
The GRUB 2 configuration file, grub.cfg
, is generated during installation, or by invoking the /usr/sbin/grub2-mkconfig utility
[/etc/default/grub]
: grub2-mkconfig
tool
[root@dev proc]# cat /etc/default/grub
GRUB_TIMEOUT=5
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 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
* Do not attempt to manually edit the boot menu because it is automatically created from files within the /boot/
Configuring GRUB 2
[root@cdr]# grubby --default-kernel
/boot/vmlinuz-3.10.0-514.6.2.el7.x86_64
[root@cdr]# grubby --default-kernel /boot/vmlinuz-3.10.0-514.6.2.el7.x86_64
[root@cdr]# grubby --default-index
0
[root@cdr ]# ls -al /boot/vmlinuz-* -rwxr-xr-x. 1 root root 5156528 Feb 24 2017 /boot/vmlinuz-0-rescue-37f277e0207041d0bdf740809887b2bb -rwxr-xr-x. 1 root root 5392752 Feb 23 2017 /boot/vmlinuz-3.10.0-514.6.2.el7.x86_64 -rwxr-xr-x. 1 root root 6192432 Feb 20 2017 /boot/vmlinuz-4.10.0-1.el7.elrepo.x86_64
Changing the Default Boot Entry
[root@cdr]# grubby --set-default /boot/vmlinuz-4.10.0-1.el7.elrepo.x86_64
[root@cdr]# grubby --default-index
1
[root@cdr]# grubby --info=ALL
index=0
kernel=/boot/vmlinuz-3.10.0-514.6.2.el7.x86_64
args="ro crashkernel=auto rhgb quiet LANG=en_US.UTF-8"
root=UUID=3022c111-bd96-410c-bef2-ab1aa5e1789b
initrd=/boot/initramfs-3.10.0-514.6.2.el7.x86_64.img
title=CentOS Linux (3.10.0-514.6.2.el7.x86_64) 7 (Core)
index=1
kernel=/boot/vmlinuz-4.10.0-1.el7.elrepo.x86_64
args="ro crashkernel=auto rhgb quiet LANG=en_US.UTF-8"
root=UUID=3022c111-bd96-410c-bef2-ab1aa5e1789b
initrd=/boot/initramfs-4.10.0-1.el7.elrepo.x86_64.img
title=CentOS Linux (4.10.0-1.el7.elrepo.x86_64) 7 (Core)
index=2
kernel=/boot/vmlinuz-0-rescue-37f277e0207041d0bdf740809887b2bb
args="ro crashkernel=auto rhgb quiet"
root=UUID=3022c111-bd96-410c-bef2-ab1aa5e1789b
initrd=/boot/initramfs-0-rescue-37f277e0207041d0bdf740809887b2bb.img
title=CentOS Linux (0-rescue-37f277e0207041d0bdf740809887b2bb) 7 (Core)
index=3
non linux entry1
[root@cdr]# grubby --info=ALL
index=0 kernel=/boot/vmlinuz-3.10.0-514.6.2.el7.x86_64 args="ro crashkernel=auto rhgb quiet LANG=en_US.UTF-8" root=UUID=3022c111-bd96-410c-bef2-ab1aa5e1789b initrd=/boot/initramfs-3.10.0-514.6.2.el7.x86_64.img title=CentOS Linux (3.10.0-514.6.2.el7.x86_64) 7 (Core) index=1 kernel=/boot/vmlinuz-4.10.0-1.el7.elrepo.x86_64 args="ro crashkernel=auto rhgb quiet LANG=en_US.UTF-8" root=UUID=3022c111-bd96-410c-bef2-ab1aa5e1789b initrd=/boot/initramfs-4.10.0-1.el7.elrepo.x86_64.img title=CentOS Linux (4.10.0-1.el7.elrepo.x86_64) 7 (Core) index=2 kernel=/boot/vmlinuz-0-rescue-37f277e0207041d0bdf740809887b2bb args="ro crashkernel=auto rhgb quiet" root=UUID=3022c111-bd96-410c-bef2-ab1aa5e1789b initrd=/boot/initramfs-0-rescue-37f277e0207041d0bdf740809887b2bb.img title=CentOS Linux (0-rescue-37f277e0207041d0bdf740809887b2bb) 7 (Core) index=3 non linux entry1
Refence :
2. https://wiki.centos.org/HowTos/Grub2
'InfraPlatform' 카테고리의 다른 글
리눅스설치-hostname 변경하기 : CentOS 6 & 7 (0) | 2018.10.21 |
---|---|
linux sudo 권한 부여 하기 (0) | 2018.09.25 |
Kernel-ml for Enterprise Linux 7 install (0) | 2017.12.10 |
Centos 6&7 패스워드 잃어버렸을때 (Single Mode for password reset) (0) | 2017.11.20 |
Centos 7 4.x 커널 업그레이드 (kernel upgrade) (0) | 2017.06.14 |
루비 설치하기 RUBY (0) | 2014.09.23 |
[Bash Shellscript 기본다지기] here-documents를 활용한 telnet 메일 보내기 (0) | 2014.08.04 |