`
topzhujia
  • 浏览: 56019 次
  • 性别: Icon_minigender_1
  • 来自: 重庆
社区版块
存档分类
最新评论

Grub 2 修改默认引导系统

阅读更多

      总有人装了Ubuntu仍忘不了Windows。我在刚接触linux 的时候也是这样,不过现在好了很多,如果不是必须要用Windows 的时候,我一般都选择进入Ubuntu。为了那些刚使用Ubuntu的人方便进入Windows,也为了以后有人再问我的时候,我可以很轻松明了的回答ta。特意在此记下GRUB2是如何修改默认引导系统的。

       在网上Google或Baidu一下,结果会出来很多,我大致看了一下,绝大部分内容雷同,基本都是让你修改/boot/grub/grub.cfg。没错,无论过程怎么样结果都是grub.cfg被修改。但是在这个文件的开头它已经清清楚楚的告诉你:DO NOT EDIT THIS FILE。grub.cfg不应该手动被修改。

      要想知道如何修改GRUB2,首先就应该清楚了解GRUB2是什么东西,是怎么回事。这里 https://wiki.ubuntu.com/Grub2 有比较详细的介绍。A more recent version of the information on this page can be found on https://help.ubuntu.com/community/Grub2 .

      为了方便起见,我把如何修改默认引导系统Copy过来,如下:

 

grub (/etc/default/grub)

 

 

 This file contains information previously found in the upper section of /boot/grub/menu.lst. It contains settings primarily affecting Grub's menu display. This file can be edited by root to make changes to these settings; they will be imported into grub.cfg when "update-grub" is executed.

 

<!--<br/ /><br/ />Code highlighting produced by Actipro CodeHighlighter (freeware)<br/ />http://www.CodeHighlighter.com/<br/ /><br/ />--># If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entrys
#GRUB_DISABLE_LINUX_RECOVERY="true"



This file contains information formerly contained in the upper section of Grub Legacy's ''menu.lst'' and items contained on the end of the kernel line. The items in this file can be edited by a user with administrator (root) privileges. Grub developers have have placed explanatory comments within the file itself.

  • GRUB_DEFAULT=0

    • Sets the default and pre-selected menu entry. Entries may be numeric or saved

    • GRUB_DEFAULT=0

      • Sets the default menu entry by menu position. As with Grub Legacy, the first "menuentry" in grub.cfg is 0, the second is 1, etc.
    • GRUB_DEFAULT="Windows XP Professional (on /dev/sda1)"

      • Sets the default menu entry by name.
    • GRUB_DEFAULT=saved

      • Sets the default menu entry with either whatever was selected on the last boot (if SAVEDEFAULT=true is set and the entry itself contains savedefault), whatever the last grub-set-default command saved or the first entry if nothing has ever been saved or the saved entry can't be found. If the menu is displayed during boot, the previously selected option will be highlighted. If no action is taken, this is selection which will be booted at the end of the timeout, or if the menu is hidden.
  • GRUB_TIMEOUT=10

    • No change from Grub Legacy. This is the number of seconds before the default entry is automatically booted.
    • Setting a value of -1 will display the menu until the user makes a selection (no timeout).

  • GRUB_HIDDEN_TIMEOUT=0

    • The hidden timeout option is available to single-OS computers - if multiple OS's are known to Grub 2, this option is bypassed.

    • On single-OS systems, the menu will be hidden unless a # symbol is present at the beginning of this line. ( # GRUB_HIDDEN_TIMEOUT=0 )

    • The default setting initially depends on the presence of other operating systems.
      • Another OS Detected: The menu will be displayed. ( The line will begin with a # symbol. )
      • No other OS Detected: This setting is not used, as determined by the
    • For integers greater than 0, the system will pause, but not display the menu, for the entered number of seconds.
    • 0 The menu will not be displayed. There will be no delay.

      • The user may force displaying the menu as the computer boots by holding down the SHIFT key (single-OS computers only).
        • During boot, the system will check the SHIFT key status. If it cannot determine the key status, a short delay will enable the user to display the menu by pressing the ESC key.
        • If enabled, the splash screen designated in 05_debian_theme will be displayed even if the hidden menu feature is selected.
  • GRUB_HIDDEN_TIMEOUT_QUIET=true

    • true - No countdown is displayed. The screen will be blank.
    • false - A counter will display on a blank screen for the duration of the GRUB_HIDDEN_TIMEOUT value.
  • GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian

    • Determines the descriptive name in the menu entry. (Ubuntu, Xubuntu, Debian, etc.)
  • GRUB_CMDLINE_LINUX

    • If it exists, this line imports any entries to the end of the linux command line (Grub Legacy's "kernel" line) for both normal and recovery modes. This is similar to the "altoptions" line in menu.lst

  • GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

    • This line imports any entries to the end of the 'linux' line (Grub Legacy's "kernel" line). The entries are appended to the end of the normal mode only. This is similar to the "defoptions" line in menu.lst. If you want a black screen with scrolling boot messages, remove "quiet splash". If you want a grub splash screen with limited messages underneath the Ubuntu logo, use only "splash". < This [only "splash"]will not work in Karmic during boot as the xsplash does not display the messages , but the messages at shutdown will be displayed.

  • #GRUB_TERMINAL=console

    • Uncomment to disable graphical terminal (grub-pc only).
  • #GRUB_GFXMODE=640x480

    • Uncomment (remove '#' from beginning of the line) to change (increase) resolution of your boot loader. Use one of classic (4:3 rate):
      • GRUB_GFXMODE=640x480 (is used if isn't here a proper value)
      • GRUB_GFXMODE=800x600
      • GRUB_GFXMODE=1024x768
      • GRUB_GFXMODE=1600×1200
    • or make experiments with some others nonstandards like widescreen (16:10 ratio in my case), here is list of most of commonly use Display resolution:

      • GRUB_GFXMODE=640x400
      • GRUB_GFXMODE=800x500
      • GRUB_GFXMODE=1024x640
      • GRUB_GFXMODE=1280x800
      • GRUB_GFXMODE=1680x1050
    • If you don't know what modes are supported by your graphics card, go to the grub command line and run 'vbeinfo'. It will list all available modes. (You might need to run 'insmod vbe' first if the vbe module isn't loaded yet)
  • GRUB_GFXPAYLOAD_LINUX=640x480x8 [grub2 >= 1.98-1 (Lucid)]

    • Use this setting to set the framebuffer resolution (replaces the vga= kernel option). It uses the GFXMODE values with additional color depth. Use 'vbeinfo' from the grub command line to list what modes are available to you.
  • #GRUB_DISABLE_LINUX_UUID=true

    • Uncomment this line if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux.
  • GRUB_DISABLE_LINUX_RECOVERY=true

    • Add or uncomment this line to prevent "Recovery" mode kernel options from appearing in the menu.
  • GRUB_DISABLE_OS_PROBER=true

    • Enables/disables the os-prober check of other partitions for operating systems, including Windows, Linux, OSX and Hurd.

分享到:
评论

相关推荐

    grub2文件系统下载

    GRUB2的配置文件主要位于`/etc/default/grub`,在这里可以设置启动菜单的选项,比如默认操作系统、启动参数等。修改完配置文件后,需要使用`grub2-mkconfig`命令生成新的GRUB配置,然后用`grub2-install`命令将GRUB...

    grub2多重引导示例镜像

    GRUB2(GRand Unified Bootloader 2)是Linux系统中的主流引导加载器,用于管理多重引导,即在一台计算机上安装和启动多个操作系统。这个"grub2多重引导示例镜像"是一个64Mb的磁盘镜像文件,其中包含了GRUB2配置和...

    grub修改ubuntu启动项

    **Grub修改Ubuntu启动项详解** 在早期的Ubuntu版本中,Grub(GRand Unified Bootloader)作为系统启动引导程序,用户可以通过简单的编辑 `/boot/grub/menu.lst` 文件来定制启动选项。然而,随着Grub的升级到Grub 2...

    grub2开机背景设置字体文件

    GRUB2(GRand Unified Bootloader 2)是Linux系统中的引导加载器,负责在操作系统启动时选择要加载的内核。它提供了丰富的自定义功能,包括改变开机背景和字体等,以提升用户体验。本话题将详细介绍如何在GRUB2中...

    GRUB2_中文指南

    在配置GRUB2时,可能需要了解一些常见的配置命令,例如设置启动时的菜单显示时间(`GRUB_TIMEOUT`)、更改默认启动项(`GRUB_DEFAULT`)、设置启动命令行(`GRUB_CMDLINE_LINUX`)等。此外,GRUB2支持通过在启动时按...

    Grub_多系统引导.zip

    标题中的“Grub_多系统引导”表明了我们要讨论的主题是GRUB(Grand Unified Bootloader)在处理多操作系统引导上的应用。GRUB是一款常见的开源引导加载器,它允许用户在计算机启动时选择要运行的操作系统,这对于有...

    Grub.conf文件修改Linux系统

    2. **默认引导项**:`default`指令指定默认启动的操作系统编号。 3. **隐藏时间**:`timeout`指令设置在启动菜单显示多久后自动选择默认项。 4. **启动菜单条目**:每个`menuentry`表示一个可选的启动项,包括操作...

    GRUB2 Windows 启动项修改

    GRUB2(GRand Unified Bootloader 2)是Linux系统中的多引导加载器,它允许用户在计算机上安装并切换不同的操作系统,如Windows和Linux。GRUB2的强大之处在于其高度可配置性,能帮助用户自定义启动菜单,提供个性化...

    ubuntu下修改grub引导(11.0以上版本)

    ### Ubuntu 下修改 GRUB 引导(11.0 以上版本) 在 Ubuntu 系统中,GRUB(Grand Unified Bootloader)作为默认的启动管理器,在计算机启动过程中扮演着非常重要的角色。本文将详细介绍如何在 Ubuntu 11.0 及以上...

    GRUB2基础教程

    GRUB2是一种流行的引导加载程序,广泛用于Linux和其他类Unix系统中。它负责加载操作系统内核到内存中并启动系统。GRUB2相较于其前身GRUB,增加了很多新的特性和改进,提供了更为强大的配置选项和用户界面。 一、...

    grub for dos 引导文件

    4. **配置GRUB**:创建或修改`grub.cfg`文件,列出所有要引导的操作系统及其对应的启动参数。 5. **重启并测试**:保存配置后,重启电脑,GRUB应该会显示启动菜单,让你选择要启动的操作系统。 **高级特性:** ...

    grub镜像引导器

    2. 安装GRUB:在安装Linux的过程中,引导安装程序会自动检测到其他操作系统,并在GRUB配置中添加相应的引导项。 3. 更新GRUB:安装完成后,运行`sudo update-grub`命令,GRUB会扫描所有可用的系统并更新配置。 4. ...

    grub2 for dos

    GRUB2 for DOS是一款在DOS环境下使用的GRUB2引导加载器,主要目的是为了帮助用户在计算机上安装和管理Linux与Windows双系统。GRUB2是Grand Unified Bootloader的第二代版本,它提供了比其前辈GRUB更强大的功能和更...

    0050Grub_多系统引导.zip

    标题 "0050Grub_多系统引导.zip" 暗示了这个压缩包包含的是关于GRUB(Grand Unified Bootloader)多系统引导的教程或资料。GRUB是一款广泛使用的开源多操作系统启动加载器,它允许用户在计算机启动时选择要运行的...

    Grub2基础教程Grub2基础教程

    Grub2(GRand Unified Bootloader 2)是Linux系统中的一个引导加载器,它负责在计算机启动时加载操作系统内核。Grub2取代了早期的Grub,提供了更多功能和改进,使得系统引导更加灵活和可定制。 ### 一、Grub2新特性...

    Windows-grub引导扇区程序

    2. **引导顺序**:Windows的启动管理器默认优先级可能会高于GRUB,需要在BIOS设置中调整启动设备顺序,确保GRUB先于Windows Boot Manager加载。 3. **错误消息**:遇到错误消息如“GRUB rescue”时,通常需要通过...

    GRUB2的高级教程

    GRUB2相较于其前身GRUB1,提供了更多的功能和改进,使得系统引导更加灵活和可定制化。由于GRUB2的复杂性和不断发展,掌握其高级特性对系统管理员和开发者来说至关重要。 **1. 多阶段引导** GRUB2采用多阶段引导机制...

    最新Grub2全面教程

    在配置文件中可以设置各种启动参数和菜单项,例如默认引导的操作系统、超时时间、内核参数等。 Grub2的新特性还包括支持rescue模式,该模式可以在系统无法引导时提供帮助。此外,它还支持多种文件系统格式,可以...

Global site tag (gtag.js) - Google Analytics