和6年能登半島地震により亡くなられた方々のご冥福をお祈りするとともに、被害に遭われた皆さまに対し、心よりお見舞い申し上げます。一日も早く被災地の安全が確保され、復旧が進む事を心よりお祈り申し上げます。

GRUB2 めも

ブートローダ

電源ON → BIOS → ブートローダ(GRUB2)

※昔、LILOブートローダでハマった記憶が(汗) 現在、GRUB2がスタンダードなのね。

GRUB

grub2-mkconfig → grub.cfgを生成

# grep -w menuentry /etc/grub2.cfg
menuentry 'CentOS Linux (3.10.0-1127.13.1.el7.x86_64) 7 (Core)' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-229.el7.x86_64-advanced-c416f0c2-5208-414b-b3ce-d7aaa65eb335' {
menuentry 'CentOS Linux (3.10.0-1127.13.1.el7.x86_64) 7 (Core) with debugging' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-229.el7.x86_64-advanced-c416f0c2-5208-414b-b3ce-d7aaa65eb335' {
menuentry 'CentOS Linux 7 (Core), with Linux 3.10.0-229.el7.x86_64' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-229.el7.x86_64-advanced-c416f0c2-5208-414b-b3ce-d7aaa65eb335' {
menuentry 'CentOS Linux 7 (Core), with Linux 0-rescue-fbf48c96b49c4cfca19cde302d4b2615' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-fbf48c96b49c4cfca19cde302d4b2615-advanced-c416f0c2-5208-414b-b3ce-d7aaa65eb335' {
# cat /etc/grub2.cfg | less

### BEGIN /etc/grub.d/10_linux ###
menuentry 'CentOS Linux (3.10.0-1127.13.1.el7.x86_64) 7 (Core)' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-229.el7.x86_64-advanced-c416f0c2-5208-414b-b3ce-d7aaa65eb33
5' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  8b1d9da5-45ff-460c-8e59-014a2b3c9f9a
        else
          search --no-floppy --fs-uuid --set=root 8b1d9da5-45ff-460c-8e59-014a2b3c9f9a
        fi
        linux16 /vmlinuz-3.10.0-1127.13.1.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet LANG=ja_JP.UTF-8
        initrd16 /initramfs-3.10.0-1127.13.1.el7.x86_64.img
}
menuentry 'CentOS Linux (3.10.0-1127.13.1.el7.x86_64) 7 (Core) with debugging' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-229.el7.x86_64-advanced-c416f0c2-5208-414b-b
3ce-d7aaa65eb335' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  8b1d9da5-45ff-460c-8e59-014a2b3c9f9a
        else
          search --no-floppy --fs-uuid --set=root 8b1d9da5-45ff-460c-8e59-014a2b3c9f9a
        fi
        linux16 /vmlinuz-3.10.0-1127.13.1.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet LANG=ja_JP.UTF-8 systemd.log_level=debug systemd.log_target=kmsg
        initrd16 /initramfs-3.10.0-1127.13.1.el7.x86_64.img
}
menuentry 'CentOS Linux 7 (Core), with Linux 3.10.0-229.el7.x86_64' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-229.el7.x86_64-advanced-c416f0c2-5208-414b-b3ce-d7aaa65eb335' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  8b1d9da5-45ff-460c-8e59-014a2b3c9f9a
        else
          search --no-floppy --fs-uuid --set=root 8b1d9da5-45ff-460c-8e59-014a2b3c9f9a
        fi
        linux16 /vmlinuz-3.10.0-229.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet LANG=ja_JP.UTF-8
        initrd16 /initramfs-3.10.0-229.el7.x86_64.img
}
menuentry 'CentOS Linux 7 (Core), with Linux 0-rescue-fbf48c96b49c4cfca19cde302d4b2615' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-fbf48c96b49c4cfca19cde302d4b2615-advanced-c416f0c2-5208-414b-b3ce-d7aaa65eb335' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  8b1d9da5-45ff-460c-8e59-014a2b3c9f9a
        else
          search --no-floppy --fs-uuid --set=root 8b1d9da5-45ff-460c-8e59-014a2b3c9f9a
        fi
        linux16 /vmlinuz-0-rescue-fbf48c96b49c4cfca19cde302d4b2615 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet
        initrd16 /initramfs-0-rescue-fbf48c96b49c4cfca19cde302d4b2615.img
}

/etc/default/grubは全体設定用のファイル

# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

現在の起動メニューを確認する

# grub2-editenv list
saved_entry=CentOS Linux (3.10.0-1127.13.1.el7.x86_64) 7 (Core)