精华内容
下载资源
问答
  • GRUB2

    千次阅读 2013-03-06 23:26:25
  • grub2

    2014-02-08 04:48:15
    Okuji在PUPA重写了GRUB,使他更清晰,安全,健壮,更强大,PUPA最后把他重命名为GRUB2,把原来版本的grub命名为GRUB Legacy,2005年发行了grub legacy(0.97),2007 GNU/Linux 开始在小范围内使用GRUB

    文章转自:http://my.oschina.net/guol/blog/37373

    大约2002年左右,Yoshinori K. Okuji在PUPA重写了GRUB,使他更清晰,安全,健壮,更强大,PUPA最后把他重命名为GRUB2,把原来版本的grub命名为GRUB Legacy,2005年发行了grub legacy(0.97),2007 GNU/Linux 开始在小范围内使用GRUB2,到2009年底大多数主要的发行版都开始默认安装GRUB2。

         虽然grub2是重写的grub,但是他借鉴了grub的一些特征,grub2改进如下:

         1 引导配置文件采用新名字grub.cfg,新的语法,加入许多新的命令

         2 grub.cfg 是用grub-mkconfig自动产生的,由update-grub维护,在执行update-grub之前修改的配置都不会 生效,这样可以很容易的应对内核升级这样情况。

         3 grub2中的分区号不再是以0开始,而是以1开始。

        4 配置文件是不可写的,而是修改文件后用命令自动更新

        5 grub2有更可靠的方法在磁盘上有多系统时发现文件和目标内核,可以用命令发现系统设备号或者UUID。

        6 更多的文件系统支持,如ext4 hfs ntfs

       7 grub2可以直接从lvm和raid读取文件

       8 在grub中的stage1 stage1.5 stage2已经被取消

       9 grub2引入很多设备模块,允许core镜像更小

       10 支持脚本,包括简单的语法

       11 在启动时没有选择菜单的话,按住shift即可强制显示菜单


         boot loader 是计算机启动时运行的第一个程序,核他负责加载内核并将控制权交给操作系统的内核,然后内核开始初始化系统的剩余部分,grub是个功能强大的工具,可以加载各种各样的操作系统,grub一个重要的特性就是灵活,他可以理解文件系统和内核的执行方式,所以你可以使用你喜欢的方式加载操作系统,当你用grub引导时你可以用命令行接口模式或者菜单模式,你也可以在菜单模式下转入命令行模式。

         grub2的组件为grub-pc,同时grub-common也会默认被安装,grub2是过渡期的虚拟组件,会被安全移除。

         Grub2的相挂钩脚本如下:

         grub-install 

       1 安装grub到设备中,如果需要会创建/boot/grub目录

       2 他会把*.mod、*.lst、*.img从 /usr/lib/grub/i386-pc/ 目录复制到/boot/grub目录下,他会覆盖已有文件

       3 然后会调用grub_probe扫描计算机并收集磁盘和分区信息

       4 接着调用grub_mkimage构建一个新的new.img

      5 最后调用grub_setup把grub的boot.img写入MBR中,把core.img写进设备的第一个扇区。

       注意grub_install并不运行grub_mkconfig

     grub-install -v

         显示版本号

    grub-install /dev/sda

          这表示你希望把grub安装进/dev/sda(把boot.img写进第一块硬盘的MBR),如果由于某些原因你想把grub安装到单独的boot分区,可以使用/dev/sdaX,grub2不建议这样,因为他会减小grub的可靠性,或者其他用户用grub-install把grub装进了错误的分区导致操作系统的危险性。

    grub-install --root-directory=/media/grub2 /dev/sda

          创建一个大约60M的分区,用文件系统格式化分区,把他挂载到/media/grub2,/dev/sda是指把stage1写入MBR

    mke2fs /dev/fd0
    mount -t ext2 /dev/fd0 /mnt
    mkdir /mnt/boot
    grub-install --boot-directory=/mnt/boot /dev/fd0
    umount /dev/fd0

           创建一个软驱启动盘

           注意grub-install只是一个脚本,内部真正执行工作的是grub-mkimage和grub-setup,因此你也可以直接用着两个命令安装grub,建议还是用grub-install,除非你非常熟悉grub内部。

         update-grub

         update-grub主要是在每次配置文件有更新后生成新的grub.cfg,其实update-grub是调用grub-mkconfig,在系统中还有一个update-grub2,发现他是调用update-grub

         grub-mkconfig

         调用grub-mkdevicemap和grub-probe生成grub.cfg

         grub-set-default

         设置在下次进入系统时从哪个内核选项进去

         grub-mkdevicemap

          为grub自动产生新的device.map,grub-mkdevicemap程序可以创建device.map文件,在执行grub-install时会自动执行他以创建映像关系,如果文件不存在,则会读取/boot/grub/devicd.map这个文件,如果映像文件存在,则grub读取他创建BIOS drives to OS drives

         grub-setup

         被grub_install调用,安装grub

         grub-probe 

         从给定的设备上探测设备信息

         grub2有两中不同的引导方法,一个是直接加载操作系统,一个是连锁(chain-load)到另一个boot load,然后再从另一个boot load加载系统,一般来说第一个更常用,但是假如grub不支持所有的操作系统就需要这种方法。


       Grub2镜像:

          boot.img

         在PC  BIOS系统中,boot.img在grub启动的第一部分,他被写入MBR或者boot分区,因为PC的boot扇区只有512bytes,所以此文件精确到只有512bytes,他唯一的功能是从本地磁盘读取内核镜像第一个扇区位置然后跳到内核镜像,因为文件大小的限制,boot.img不能识别任何文件系统,所以当安装grub时,grub-setup把内核镜像第一个扇区的位置硬编码进boot.img中。

         diskboot.img

         当从硬盘引导时此镜像作为内核镜像的第一个扇区的内容,他把剩余的内核镜像读入内存中然后启动内核。

          cdboot.img 的原理同上

           pxeboot.img

          当从网络用PXE引导时用次镜像启动内核镜像

           kernel.img

           此镜像包含grub运行时包含的基本工具,框架驱动、文件句柄、环境变量、安全模式命令行解析器等,他可以直接使用,但是编译进所有的内核镜像中了。

           core.img

           这是grub的内核镜像,他被grub-mkimage程序从kernel.img和一些模块动态编译而成,一般情况下他已经包含足够的模块去访问/boot/grub,模块机制可以使得内核镜像保持很小。

           *.mod

           其余的一切是可以动态加载的一些模块,当需要他们时,他们是被自动加载编译进内核镜像的,但也可以使用insmod手动加载。


         grub legacy的镜像文件

            stage1 

            他非常像grub2中的boot.img,他们有一样的功能

            *_stage1_5

            在grub legacy中,stage1_5的作用是包含足够的系统代码从而可以使更大的stage2从普通系统上读入,他有点像grub2中的core.img但是core.img比他功能强多了,grub legacy可以只使用stage1和stage2在一些受限制的情况下工作,但是grub2没有core.img就不能工作。

             stage2

            grub2没有stage2镜像,代替的是他运行时从/boot/grub加载模块


         grub2 包含一个完全修改过的配置文件及目录,menu.list不再使用

         grub2采用模块化的设计,主要配置文件是/boot/grub/grub.cfg,但是这个文件的权限是444,连root也不让修改,这是刻意为之的,不要修改文件权限,grub.cfg的内容更新由update-grub命令来更新,其实就是执行grub-mkconfig -o /boot/grub/grub.cfg来更新,此文件会在更新内核自动更新,在/oot/grub目录下有很多模块文件,以在按需时自动加载模块。每段模块配置的加载以### BEGIN xxx ###开始,以### END xxx ###结尾。

         /etc/default/grub

         此文件包含menu.list的前半部分内容,以及每行内核配置后面追加的配置,在更新时会合并到grub.cfg中

         /etc/grub.d/目录

         update-grub命令执行时会读取此目录下的文件,并将配置合并至grub.cfg中,grub.cfg中的菜单顺序是由此目录中的文件顺序决定的,文件开头数字较小的会先执行,全英文名字的文件将会在最后执行,自定义选项在40_custom中定义,或者建立一个新文件,此目录下的文件必须有执行权限才会被update-grub读取,并把配置合并到grub.cfg中。

          00_header

          配置初始的显示项目,如默认选项,时间限制等,一般由/etc/default/grub导入,一般不需要配置

          05_debian_theme

         配置引导画面,文字颜色等主题

         10_linux

         定位当前操作系统使用中的root设备内核的位置

         30_os-prober

         用来搜索linux和其他系统,此脚本中的变量用来指定在/boot/grub/grub.cfg 和 grub2菜单中的名称显示方式,可以修改/etc/default/grub光比这个脚本

         40_custom

         用来加入用户自定义的菜单样板,将会在执行update-grub时更新至grub.cfg中

         41_custom

        判断custom.cfg此配置文件是否存在,如果存在就加载它

        

       定制自己的配置文件

             配置文件在/boot/grub/grub.cfg,此文件是只读的不允许手动修改,grub-mkconfig在大多数情况下生成grub.cfg,他适合升级发行版系统,发现可用内核并打算加入菜单中,grub-mkconfig也有一些限制,当打算加入一个普通的菜单选项时可以编辑/etc/grub.d/40_custom或者/boot/grub/custom.cfg。

             /etc/default/grub控制grub-mkconfig的操作,grub里面是以键值对存在的选项,如果值有空格或者其他字符需要用引号引起来,参数如下

             GRUB_DEFAULT 

             默认的菜单选择项,值可以是数字,默认从0开始,值也可以是title后面的字符串,当值是‘saved’时有特殊含义:默认的菜单选则项会被保存在GRUB_SAVEDEFAULT中,下次启动时会从这个值启动。当值为saved是可以用grub-set-default和grub-reboot来设置默认启动项,grub-set-default直到下次修改前都有效,grub-reboot下次启动时生效

            GRUB_SAVEDEFAULT

            只有这个值是true,GRUB_DEFAULT是saved时才会起作用

            GRUB_TIMEOUT

            选择菜单的显示时间,默认是5,值是0表示不显示菜单选项,值是-1表示无限期的等待做出选择

            GRUB_HIDDEN_TIMEOUT

            grub2第一次执行时会寻找其他操作系统,如果没有检测到则会将菜单隐藏,如果有其他操作系统才会显示菜单,如果参数大于0,则会等待响应的秒数,但是不会显示菜单,可以按住shift显示菜单。

            GRUB_DISTRIBUTOR

            菜单中的描述名称,采用命令lsb_release判断,应该是红帽系列的,如果不是就归为Debian

            GRUB_CMDLINE_LINUX

            此行将追加到所有的linux 定义内核行的后面,不论是救援模式还是一般模式

            GRUB_CMDLINE_LINUX_DEFAULT

            次选项只会追加在一般模式后面,同上

            GRUB_TERMINAL=console

            启用console,默认注释状态

            GRUB_DISABLE_LINUX_UUID=true

            在grub中指定root时可以使用UUID,默认注释

            GRUB_GFXMODE=640x480

            图形化菜单的分辨率,默认注释

            GRUB_DISABLE_LINUX_RECOVERY=true

            禁止显示救援模式

     

            在建立自定义菜单时要注意关键字已经和grub legacy不一样了:

            title 更改为 menuentry 并且以{ 结束,

            insmod 可以加载所需要的模块

            root  更改为 set root=

            kernel 更改为 linux

    展开全文
  • GRUB 2

    2013-03-05 15:43:55
    0.介绍 ... https://help.ubuntu.com/community/Grub2 注意(hdX,Y)是第X块硬盘,第Y个分区 X0开始计数,Y均从1开始计数 配置文件为grub.cfg ...强大的loopback详见grub2安装系统 grub-mkconfig可以自动生成
    0.介绍
    http://www.gnu.org/software/grub/manual/grub.html
    https://help.ubuntu.com/community/Grub2
    注意(hdX,Y)是第X块硬盘,第Y个分区
    X0开始计数,Y均从1开始计数
    配置文件为grub.cfg


    强大的loopback详见grub2安装系统
    grub-mkconfig可以自动生成配置文件
    可以定义变量
    grub中 root (hd0,0)
    grub2  set root=(hd0,1)
    安装(程序grub)和安装grub到mbr是不一样的
    1.
    grub2 安装到U盘
    $ grub2-install --root-directory=/mnt/ /dev/sdb

    grub2下是不可以只在grub中修复引导的
    这是相对与grub不足的地方
    2.
    shell中修复引导

    通过configfile进入系统(配置文件必须是grub2 的)

    grub>configfile (hd1,0)/boot/grub/grub.cfg

    $ grub2-install  /dev/sda
    这样是安装到MBR
    3.
    liveCD修复
    (1)简单的
    如果boot不是单独的分区,就是所/和/boot是同一个分区
    $ mount /dev/sda2 /mnt
    $ grub2-install --root-directory /mnt /dev/sda
    grub会自动安装到boot文件夹中
    如果boot是单独一个分区
    $ mount /dev/sda2 /mnt
    $ mount /dev/sda1 /mnt/boot
    $ grub2-install --root-directory /mnt /dev/sda
    (2)复杂的
    1.
    Disk unity,找到fedora安装所在分区
    fdisk -l也可以
    2.
    mount -t ext4 -o rw /dev/sdaX /media
    3.
    mount -t proc none /media/proc
    mount -o bind /dev /media/dev
    mount -o bind /sys /media/sys
    mount -t devpts devpts /media/dev/pts
    4.grub2安装到硬盘MBR上恢复引导
    chroot  /media
    grub2-install /dev/sda


    5.安装grub2
    grub2-mkconfig  -o  /boot/grub2/grub.cfg
    reboot
    6.
    exit
    umount /media/proc
    umount /media/dev/pts
    umount /media/sys
    umount /media/dev
    umount /media
    reboot
    展开全文
  • Grub2

    千次阅读 2013-03-11 09:50:03
    GRUB 2 is the default boot loader and manager for Ubuntu since version 9.10 (Karmic Koala). As the computer starts, GRUB 2 either presents a menu and awaits user input or automatically transfers contr

    GRUB 2 is the default boot loader and manager for Ubuntu since version 9.10 (Karmic Koala). As the computer starts, GRUB 2 either presents a menu and awaits user input or automatically transfers control to an operating system kernel. GRUB 2 is a descendant of GRUB (GRand Unified Bootloader). It has been completely rewritten to provide the user significantly increased flexibility and performance. GRUB 2 is Free Software.

    In this guide, GRUB 2 is version 1.98 or later. GRUB legacy (version 0.97) will be referred to as GRUB. To determine your version, use grub-install -v. Grub version 1.99 became the default on Ubuntu 11.04 (Natty Narwhal) and introduced some major changes in the Grub file contents. This guide covers the use of Grub 1.98, the Grub release found in Ubuntu 10.04 LTS (Lucid Lynx). and Grub 1.99, packaged with Ubuntu 12.04 LTS (Precise Pangolin). Content reflecting other versions of Grub 2 will be noted in the appropriate entry.

    http://pix.toile-libre.org/upload/original/1353953772.png

    Improvements

    GRUB 2's major improvements over the original GRUB include:

    • Scripting support including conditional statements and functions
    • Dynamic module loading
    • Rescue mode
    • Custom Menus
    • Themes
    • Graphical boot menu support and improved splash capability
    • Boot LiveCD ISO images directly from hard drive
    • New configuration file structure
    • Non-x86 platform support (such as PowerPC)
    • Universal support for UUIDs (not just Ubuntu)

    GRUB vs GRUB 2

    GRUB 2's default menu will look familiar to GRUB users but there are a great number of differences beneath the surface.

    • On a new installation of Ubuntu 9.10 or later with no other installed operating systems, GRUB 2 will boot directly to the login prompt or Desktop. No menu will be displayed.
    • Hold down (right) SHIFT to display the menu during boot. In certain cases, pressing the ESC key may also display the menu.
    • No /boot/grub/menu.lst. It has been replaced by /boot/grub/grub.cfg.

    • There is no "/find boot/grub/stage1" at the grub prompt. Stage 1.5 has been eliminated.
    • The main Grub 2 configuration file, normally located in the /boot/grub folder, is grub.cfg. It is the product of various scripts and should not normally be edited directly.

    • grub.cfg is overwritten by certain Grub 2 package updates, whenever a kernel is added or removed, or when the user runs update-grub.

    • The menu list of available Linux kernels is automatically generated by running update-grub.

    • The user can create a custom file in which the user can place his own menu entries. This file will not be overwritten. By default, a custom file named 40_custom is available for use in the /etc/grub.d folder.

    • The primary configuration file for changing menu display settings is called grub and by default is located in the /etc/default folder.

    • There are multiple files for configuring the menu - /etc/default/grub mentioned above, and all the files in the /etc/grub.d/ directory.

    • Partition numbering has changed. The first partition is now 1 rather than 0. The first device/drive is still hd0 by default (no change). These designations can be altered if necessary in the device.map file in the /boot/grub folder.

    • Automated searches for other operating systems, such as Windows, are accomplished whenever update-grub is executed. Operating systems found will be placed in the Grub 2 menu.

    • Changes made in the configuration files will not take effect until the update-grub command is executed.

    Upgrading to GRUB 2 From GRUB

    GRUB 2 is the default bootloader for Ubuntu. Users who still have Grub 0.97 installed on their Ubuntu systems can upgrade to GRUB 2 by installing the currently-supported releases of Ubuntu or by enabling repositories which contain the GRUB 2 package grub-pc.

    Please visit the Grub2/Upgrading community documentation for more information and instructions.

    File Structure

    GRUB 2 incorporates a totally revised directory and file hierarchy. The major GRUB 2 folders include /etc/grub.d, which contains the main GRUB 2 scripts, and /boot/grub, which contains the GRUB 2 modules and menu file (grub.cfg). User customizations are normally made to the /etc/default/grub file.

    The description of the major GRUB 2 folders and files is located on the Grub2/Setup page.

    Configuring GRUB 2

    Configuration changes are normally made to the /etc/default/grub file and to the custom scripts located in /etc/grub.d. No changes are made to the GRUB 2 menu until the update-grub command is run as root. This command runs the GRUB 2 configuration scripts and updates the /boot/grub/grub.cfg file.

    Descriptions of the GRUB 2 options and how to change them are presented on the Grub2/Setup community documentation page.

    Boot Display Behavior

    GRUB 2 loads before any operating system. Its modular components are loaded on an as-needed basis. Menu display behavior is generally determined by settings in /etc/default/grub. Review the "Configuring GRUB 2" section for specific entry and formatting guidance.

    Initial Default

    • GRUB 2 will boot straight into the default operating system if no other operating system is detected. No menu will be displayed. If another operating system is detected, the GRUB 2 menu will display.

    Timed Display

    • The menu is displayed for a predetermined number of seconds. The default entry is highlighted and other selections may be made by the user until the timeout expires. The default timeout is 2 seconds. The timer continues until any key is pressed or the highlighted entry is selected by pressing ENTER. If no user input is made GRUB 2 boots the default entry at the end of the timeout period.

    • Once a key has been pressed the timeout is deactivated and the user must make a selection manually.
    • The default entry is determined by the GRUB_DEFAULT= setting in /etc/default/grub; the first "menuentry" has a value of "0".

    Hidden

    • Normal Hidden Operations Enabled:
      • No menu entries are displayed. The splash screen, if configured, will be displayed.
      • The time the screen remains blank but available for display is determined by a setting in /etc/default/grub (GRUB_HIDDEN_TIMEOUT)

      • GRUB 2 can display a countdown timer to provide visual feedback on the time remaining until the default selection is chosen. The timeout setting is enabled in /etc/default/grub (GRUB_HIDDEN_TIMEOUT_QUIET)

      • The user may display the menu by pressing any key.
        • Once the menu displays, the GRUB_TIMEOUT counter begins. Pressing any key stops the countdown.
          • If no key is pressed by the end of the timeout the default entry determined by settings in /etc/default/grub will be selected.

    • Hidden Menu Operations Not Expected (Abnormal):
      • The user may be able to display the menu in one or more of the following ways:
        • Holding down the SHIFT key early in the boot process until the menu displays.
          • GRUB 2 searches for a depressed SHIFT key signal during boot. If the key is pressed or GRUB 2 cannot determine the status of the key, the menu is displayed.
        • Pressing the ESC key during a 3 second window as GRUB 2 runs.

    Saved

    • Saving an OS can be achieved by running sudo grub-set-default if GRUB_DEFAULT=saved is set in /etc/default/grub. It may also be saved if GRUB_SAVEDEFAULT=true is also set in /etc/default/grub. In this case, the default OS remains until a new OS is manually selected from the GRUB 2 menu or the grub-set-default command is executed.

    Last Boot Failed or Boot into Recovery Mode

    If the last boot failed or after a boot into Recovery Mode the menu will be displayed until the user makes a selection. The timeout setting in /etc/default/grub do not apply in this case.

    To change this behaviour, edit /etc/grub.d/00_header and change line 236 (this line is in the make_timeout() function) to

    set timeout=0
    • For timeout=-1, there will be no countdown and thus the menu will display.

    • For timeout=0, menu will not display even for a failed startup.

    • For timeout>=1, menu will display for the specified number of seconds.

    Run update-grub after the change have been made. Special thanks to McCunha on Ubuntu Forums for the above tip.

    The above change, however, still causes grub to boot into text graphics mode. Thus, an additional change is required. Edit /etc/grub.d/10_linux and change line 188 to

    set linux_gfx_mode=keep

    Once again, run update-grub after the change has been made.

    Password Protection

    GRUB 2 is capable of password-protecting menu editing, access to the GRUB 2 terminal, and specific or all menuentries. It can also limit access to specific entries to specific users, and can encrypt plain-text passwords for increased security. Please refer to the Grub2/Passwords community documentation.

    Custom Menu Entries

    GRUB 2 allows users to create customized menu selections which will be automatically added to the main menu when sudo update-grub is executed. A 40_custom file is available in /etc/grub.d/ for use or to serve as an example to create other custom menus. Information on building and using custom menus in GRUB 2 is located in the Grub2/CustomMenus community document.

    Troubleshooting

    GRUB 2 provides excellent capabilities for troubleshooting and correcting boot problems from the boot menu or GRUB 2 terminal. Troubleshooting and recovery procedures detailed in the Grub2/Troubleshooting community document.

    Included on the referenced page is a section on Selected_Problems_and_Bugs.

    Fixing reboot/shutdown freezes

    If your machine freezes upon attempts to shutdown or reboot, try modifying /etc/default/grub. Open the file with gksudo gedit /etc/default/grub (graphical interface) or sudo nano /etc/default/grub (command-line). Any other plaintext editor (Vim, Emacs, Kate, Leafpad) is fine too. Find the line that starts with GRUB_CMDLINE_LINUX_DEFAULT and add reboot=bios to the end. It should result in something like

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash reboot=bios"

    if done properly. Then save the file, run sudo update-grub and reboot in any way that's possible for you. After that, reboots and shutdowns should start working properly.

    With certain hardware (notably DELL) the kernel parameter that you add needs to be reboot=pci (instead of reboot=bios), the procedure remains the same.

    Displays

    GRUB 2 can do more than provide a simple black & white menu. Its menu can be customized by the user to present a more visually-appealing menu by changing font colors, backgrounds and resolutions.

    For information on using splash images and changing font colors and menu resolutions, please refer to the Grub2/Displays community documentation.

    Some people may have old bookmarks leading to this page in which case these links might be useful to them but it's better to link to the sub-pages directly as the sub-sections here are only here temporarily while this main page gets broken-up into digestible sub-pages.

    GRUB 2 Splash Images

    Grub2/Displays#Installing_Splash_Images

    Set the splash image

    Grub2/Displays#Installing_Splash_Images

    Set menu font and highlight colors

    Grub2/Displays#Setting_Menu_Font_Colors

    Testing Fonts and Splash Images

    Grub2/Displays#Testing_Fonts_and_Splash_Images

    Changing Resolutions w/ Splash Images

    Grub2/Displays#Changing_Menu_Resolutions

    Creating User Splash Images

    Grub2/Displays#Creating_User_Splash_Images

    Resolution Settings

    Grub2/Displays#Resolution_Settings

    Image Creation and Setup

    Grub2/Displays#Image_Creation_and_Setup

    Themes

    GRUB 2 Theming is still under development, as is integration with gfxmenu. Theme elements will include colors, fonts, progress indicators, menus, and labels. Both of these hold great promise but are not ready for release with Ubuntu 9.10. Check the Links section at the bottom of this page for references.

    • grub2.theme.dinxter.png

      grub2.theme.bennett.png

    Installing/Reinstalling/Moving GRUB2

    Please visit the Grub2/Installing community documentation. Information concerning upgrades from GRUB 0.97 (Legacy) to GRUB 2 is now located at Grub2/Upgrading.

    Booting an ISO from a Menuentry

    Ubuntu ISOs, as well as many utility ISOs and some other Linux operating systems, can be booted from a hard drive via a GRUB menuentry. This eliminates the need to create a CD/DVD and allows bootable image files to be stored only on the hard drive.

    For information on this Grub 2 feature, please visit the Grub2/ISOBoot page.

    Security

    Preventing booting via Grub command-line

    The ability to manually boot using the Grub command-line constitutes the biggest security risk in Linux. Any OS can be booted in this manner from any USB or CD/DVD drive, circumventing BIOS restrictions. Placing passwords or locking menu items (in the Grub configuration files) does not prevent a user from booting manually using commands entered at the grub command-line. (Once a foreign OS is booted, of course, it can be used to access any part of an unencrypted hard drive).

    To prevent the command-line usage of Grub and require bootloading from menu options only, there are currently no options.

    Miscellaneous

    Booting from a serial console

    If you want GRUB to operate over a serial line, you will need to uncomment GRUB_TERMINAL in /etc/default/grub and set it to serial (instead of the console default). The default serial console settings are to operate on the first serial port (ttyS0) at a 9600 bit/s transfer rate with 8 data bits, 1 stop bit and no parity.

    If you want to use another serial port or if your console uses different settings, you must add a GRUB_SERIAL_COMMAND line to specify additional parameters to the serial command. The serial command in GRUB 2 uses the same syntax as its GRUB Legacy counterpart (documented here). For example, for a very common 9600 bit/s (baud) serial line with 8 data bits, 1 stop bit and no parity:

    GRUB_SERIAL_COMMAND="serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1"

    An example is a 4800 bit/s (baud) serial line with 7 data bits, 1 stop bit and even parity:

    GRUB_SERIAL_COMMAND="serial --unit=0 --speed=4800 --word=7 --parity=even --stop=1"

    Booting FreeBSD, NetBSD, and multiboot OSes

    Please refer to the article Grub2OtherOs

    Links

    External Links

    展开全文
  • GRUB2配置文件grub.cfg详解(GRUB2实战手册),各个参数解析。
  • grub2与grub区别

    万次阅读 2016-05-13 17:41:46
    GRUB legacy(版本为0.97)是指GRUB,而非GRUB2检测版本:$ grub-install -v grub-install (GNU GRUB 1.98-1ubuntu10)GRUB2与GRUB的区别:1.GRUB2引导菜单启动项是从/boot自动生成的,不是有menu.lst配置的。...
  • grub和grub2区别

    千次阅读 2018-12-08 14:45:40
    grub2是版本号在1.98之后的grub;grub一般指grub legacy,版本号为0.97。 grub2新增加功能: 动态加载模块; 新的配置文件结构,更好地支持UUID; /boot/grub/menu.1st被/boot/grub/grub.cfg取代; 磁盘分区...
  • Grub2】制作UEFI版本Grub2引导

    万次阅读 2017-07-04 10:08:11
    本来不想设置积分,无奈最低只能设置1分,大家见谅。没有积分的还是从grub2官网下载按照...首先要从grub官网下在grub2,grub2中包含所有grub2相关的命令,可以用来生成grub2引导,这里着重介绍制作UEFI版本的grub2...
  • Grub2Grub2修复

    千次阅读 2018-12-17 14:27:10
    Grub2引导存在于绝大多数linux,起到引导系统的作用,当它损坏了,无法进入系统时,该如何修复呢。 1、pbr完好,mbr损坏。 2、pbr也丢失了。 对于第一种,进入pe,使用bootice建立grub2主引导记录即可。 对于第二...
  • grub2-set-default & grub2-editenv & grub2-mkconfig
  • grub2设置默认启动项Linux booting is usually controlled by Grub or the new Grub2. Setting the default booting entry is a frequent operations. Here, we introduce how to set the default entry in Grub2 ...
  • grub2详解教程

    2017-02-13 18:43:12
    Grub2的中文文档, 讲解了grub2如何编译, 配置, 安装, 加载主题, 如何使用grub2来启动系统等.
  • Grub2Grub2主题美化

    千次阅读 2018-01-03 17:22:34
    Grub主题美化其实很简单,结构性很强,比较有条理,逐步设置就能做出满意的theme。 资料链接: ... http://wiki.rosalab.ru/en/index.php/Grub2_theme_/_reference#Boot_menu_.28b
  • 在centos7下的update-grub命令等同效果的是:grub2-mkconfig -o /boot/grub2/grub.cfg 这个命令。 还可以更改其他配置文件来更新启动项。 CentOS7启动项丢失则使用grub2-install /dev/sdx来...
  • Grub2】在优盘中安装Grub2

    千次阅读 2018-12-17 14:28:22
    Grub2不像grub那样需要下载grub4dos,因为现在各大linux基本都是用grub2引导,直接在linux下安装即可,如果没有linux系统,那就只能使用bootice建立grub2的mbr然后下载grub24dos放到对应根目录了。 下面介绍linux下...
  • grub2 加密

    2019-05-07 11:13:36
    grub2 加密 几乎能接触到物理机的人都能用上面的方法去修改 root 密码,安全性还是有点问题,我们可以通过grub菜单加密,进入grub时必须输入密码,这样就能避免上述情况发生。 1、 7.0和 7.1方法如下 1)、执行...
  • GRUB2配置

    千次阅读 2019-03-01 14:52:45
    GRUB 2 通过运行/etc/grub.d/folder目录下的脚本来 建立配置文件 (grub.cfg) ,并且/etc/default/grub这个文件也可以配置。update-grub命令(手动运行,或更新内核的时候会被执行)可以自动更新grub.cfg ...
  • Grub2资料

    2019-07-04 17:11:27
    GRUB 2 is the default boot loader and manager for Ubuntu since version 9.10 (Karmic Koala). As the computer starts, GRUB 2 either presents a menu and awaits user input or automatically transfers contr...
  • grub2详解

    千次阅读 2019-08-16 14:29:19
    本文主要介绍的是grub2,在文末对传统grub进行了简述,但在grub2的内容部分中包含了很多grub2和传统grub的对比。 如果仅仅是想知道grub2中的boot.img/core.img/diskboot.img/kernel.img或者传统grub中stage1/stage1_...
  • grub2设置

    千次阅读 2018-03-19 19:06:23
    grub2修改启动顺序 方法一: 查看所有的entry gsl@linux-13kr:/boot/grub2> sudo awk -F \' '$1=="menuentry " {print i++ " : " $2}' /boot/grub2/grub.cfg 0 : openSUSE Leap ...
  • Centos6使用grub引导,CentOS7使用GRUB2启动。 现在使用GRUB引导两个系统启动。 GRUB的设置是在 ‘/boot/grub/menu.lst’。更改之后会自动更新,重启即可。 下图是更改默认启动项和等待时间。 添加CentOS的...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 13,332
精华内容 5,332
关键字:

grub2