日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

删除 CentOS Stream 8 开机多余引导项及等待时间

發(fā)布時間:2024/4/13 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 删除 CentOS Stream 8 开机多余引导项及等待时间 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

刪除 CentOS Stream 8 開機多余引導項及等待時間

    • 刪除"System setup"
    • 刪除 CentOS (0-rescue-XXX)
    • 去掉開機關于引導項的 5 秒等待時間

筆者的運行環(huán)境:

CentOS Stream 8 x86_64

??筆者的電腦在安裝 CentOS Stream 8 之后,開機一直出現(xiàn) 5 秒的開機引導項選擇等待。在該引導項中,除了無操作之后,系統(tǒng)默認選擇的 CentOS Stream 8,還有兩個多余項:

  • CentOS (0-rescue-XXX) 8
  • System setup

??它們總是延長開機時間,因此筆者決定去掉它們。

刪除"System setup"

  • 進入目錄 /etc/。

    [root@localhost ~]# cd /etc/
  • 輸入如下命令來查找與 grub 有關的文件。

    [root@localhost etc]# ls -lF *grub* lrwxrwxrwx. 1 root root 31 32 16:03 grub2-efi.cfg -> ../boot/efi/EFI/centos/grub.cfg*grub.d: 總用量 92 -rwxr-xr-x. 1 root root 8958 32 16:03 00_header* -rwxr-xr-x. 1 root root 1043 721 14:41 00_tuned* -rwxr-xr-x. 1 root root 232 32 16:03 01_users* -rwxr-xr-x. 1 root root 832 32 16:03 08_fallback_counting* -rwxr-xr-x. 1 root root 14088 32 16:03 10_linux* -rwxr-xr-x. 1 root root 830 32 16:03 10_reset_boot_success* -rwxr-xr-x. 1 root root 889 32 16:03 12_menu_auto_hide* -rwxr-xr-x. 1 root root 11696 32 16:03 20_linux_xen* -rwxr-xr-x. 1 root root 2559 32 16:03 20_ppc_terminfo* -rwxr-xr-x. 1 root root 10670 32 16:03 30_os-prober* -rwxr-xr-x. 1 root root 1412 32 16:03 30_uefi-firmware* -rwxr-xr-x. 1 root root 214 32 16:03 40_custom* -rwxr-xr-x. 1 root root 216 32 16:03 41_custom* -rw-r--r--. 1 root root 483 32 16:03 README

  • 可以看出,在上面列出的文件中,我們需要的文件為 grub2-efi.cfg。不過,這是一個符號鏈接文件,它指向文件 /boot/efi/EFI/centos/grub.cfg。可以選擇直接編輯文件 grub2-efi.cfg,也可以選擇編輯文件 grub.cfg。

  • 以文本方式打開上述文件,找到與 menuentry 、System setup 有關的段落。

    ### BEGIN /etc/grub.d/30_uefi-firmware ### menuentry 'System setup' $menuentry_id_option 'uefi-firmware' {fwsetup } ### END /etc/grub.d/30_uefi-firmware ###
  • 將此段注釋或刪除。(注意:修改前最好先備份,以免發(fā)生誤修改)

    ### BEGIN /etc/grub.d/30_uefi-firmware ### # menuentry 'System setup' $menuentry_id_option 'uefi-firmware' { # fwsetup #} ### END /etc/grub.d/30_uefi-firmware ###
  • 現(xiàn)在,開機引導項 System setup 就被去掉了。重啟 CentOS Stream 8 即可看到效果。

  • 刪除 CentOS (0-rescue-XXX)

  • 與上面 刪除"System setup" 類似的方法,在文件 /boot/efi/EFI/centos/grub.cfg 中尋找與 menuentry 、CentOS (0-rescue-XXX) 有關的段落,并注釋掉。

  • 如果沒有找到(筆者在 CentOS Stream 8 上沒有找到),說明上述的引導項沒有位于此文件中,不過也應該位于某個目錄中。于是擴大查找范圍,在目錄 /boot 中查找關鍵字 0-rescue。

    (下面的 XXX 是被筆者替換過的序列號文本,不同電腦會有不同。)

    [root@localhost ~]# grep -rn "0-rescue" /boot /boot/loader/entries/XXX-0-rescue.conf:1:title CentOS (0-rescue-XXX) 8 /boot/loader/entries/XXX-0-rescue.conf:2:version 0-rescue-XXX /boot/loader/entries/XXX-0-rescue.conf:3:linux /vmlinuz-0-rescue-XXX /boot/loader/entries/XXX-0-rescue.conf:4:initrd /initramfs-0-rescue-XXX.img /boot/loader/entries/XXX-0-rescue.conf:6:id centos-XXX-0-rescue-XXX /boot/System.map-4.18.0-326.el8.x86_64:9105:XXX T cgroup_rstat_exit /boot/System.map-4.18.0-326.el8.x86_64:26614:XXX T acpi_disable /boot/System.map-4.18.0-326.el8.x86_64:54743:XXX r __pci_fixup_resume_earlyricoh_mmc_fixup_XXX
  • 果然查找到了關鍵信息。上面的輸出表明,關鍵信息在文件 /boot/loader/entries/XXX-0-rescue.conf 中。打開目錄 /boot/loader/entries/,可以發(fā)現(xiàn)其中有兩個文件,正好對應著 CentOS Stream 8 開機的剩余兩個開機引導項。

    [root@localhost ~]# ls /boot/loader/entries/ XXX-0-rescue.conf XXX-4.18.0-326.el8.x86_64.conf
  • 刪除上述的文件 XXX-0-rescue.conf 即可。重啟 CentOS Stream 8 即可看到效果。

    (注意:刪除前最好先備份。不要刪除另外一個、當前系統(tǒng)的引導項!)

  • 去掉開機關于引導項的 5 秒等待時間

  • 與上面 刪除"System setup"類似的方法,打開文件 /boot/efi/EFI/centos/grub.cfg,找到如下段落:

    (注意:一定要選擇如下段落。此文件中可能有與如下代碼相似的代碼,不要找錯了。)

    terminal_output console if [ x$feature_timeout_style = xy ] ; thenset timeout_style=menuset timeout=5 # Fallback normal timeout code in case the timeout_style feature is # unavailable. elseset timeout=5 fi
  • 將上述段落中的時間改為 0。即,將 timeout=5 改為 timeout=0 。

    (注意:修改前最好先備份,以免發(fā)生誤修改)

    terminal_output console if [ x$feature_timeout_style = xy ] ; thenset timeout_style=menuset timeout=0 # Fallback normal timeout code in case the timeout_style feature is # unavailable. elseset timeout=0 fi
  • 現(xiàn)在,開機引導項的等待時間就被去掉了。重啟 CentOS Stream 8 即可看到效果。

  • 總結(jié)

    以上是生活随笔為你收集整理的删除 CentOS Stream 8 开机多余引导项及等待时间的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。