查看“GrubHowto”的源代码
来自Ubuntu中文
←
GrubHowto
跳到导航
跳到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
'''Other Languages: ComoGrub (Spanish)''' === What Is GRUB 什么是Grub === * GRUB is a bootloader, it is the first thing that loads when the computer starts. It allows you to have different operating systems, and versions of them, on the same hard drive. For example you may have Windows and Linux on a computer, GRUB would load before either of these and give you a choice. You can also create a boot floppy with GRUB to use in case of emergency. * Grub是一个启动引导器,它是电脑启动后加载的第一个程序。有了它,你可以在一个硬盘里面安装多个不同的操作系统、以及操作系统的不同版本。例如,您也许在您的电脑上装了Windows和Linux,Grub将在这两者之前加载之前加载到你的电脑上,并让您选择一个操作系统。您也可以创建一个Grub的启动软盘来进行急救。 === Increasing the GRUB timeout 增加Grub的延迟时间 === * If you need to get into the grub menu you need to press ESC just after it starts. By default you have to press ESC very quickly. To increase this time edit /boot/grub/menu.lst, increasing the seconds in the TIMEOUT part. Alternatively you could have the menu always come up at boot time. To do this, comment out 'hiddenmenu' by inserting a # at the beginning of the line. Once you have changed menu.lst you must run: * 要进入Grub的菜单,必须在启动时按“ESC”键。但默认的状况是你必须很快地按“ESC”(不然就进了系统了)。为了增加这个延时,可以编辑这个文件:/boot/grub/menu.lst,找到TIMEOUT,增加他后面是数字(数字代表秒数)。或者你也可以设置成启动的时候自动显示菜单,方法是把“hiddenmenu”注释掉,也就是在hiddenmenu的前面加一个“#”。一旦您改变了menu.lst文件,你就需要运行: * <pre><nowiki> sudo update-grub </nowiki></pre> attachment:IconsPage/IconNote.png * If the Ubuntu installer detected other operating systems on the disk during the installation, then the grub menu will be displayed by default and the timeout will be increased, so the step above will be unnecessary. * 如果在安装时,Ubuntu安装程序检测到你的硬盘上装有其他操作系统,则Grub菜单将自动显示,延时也会自动增加,所以将不需要以上步骤。 === Automagic Kernels List === Debian uses a tool called <code><nowiki>update-grub</nowiki></code> to install grub to the MBR. It automatically detects all of the kernels you have in the <code><nowiki>/boot</nowiki></code> directory, and applies various global settings to each one. Also, whenever you install kernel updates from the repositories, <code><nowiki>update-grub</nowiki></code> is run to, well, update grub. Debian通常会用 一个 叫做 update-grub的工具来 将grub安装到硬盘的mbr上。通常它会自动识别您已经安装到 引导分区的内核,并且为每一个设置相应的规则。因此,无论什么时候您从存储设备上安装内核,update-grub都会正常的 运行,正确安装grub. The relevant parts of <code><nowiki>menu.lst</nowiki></code> that <code><nowiki>update-grub</nowiki></code> looks at are the ones in between the "### BEGIN AUTOMAGIC KERNELS LIST" and "### END DEBIAN AUTOMAGIC KERNELS LIST" lines. Comments are precedded by at least two '#', e.g. '## this is a comment'. Global options are after single '#', e.g. '# groot=(hd0,4)'. The most common one to change is probably the groot option. Change this if <code><nowiki>/boot</nowiki></code> resides on a different partition that <code><nowiki>/</nowiki></code>. See the appropriate section on this page for more information about different <code><nowiki>/boot</nowiki></code> partitions. Another common option is 'kopt=', which are kernel options applied to all kernels in the <code><nowiki>menu.lst</nowiki></code>. === Setting kernel parameters === 设定内核参数 . In <code><nowiki>/boot/grub/menu.lst</nowiki></code>, you will find a line like this: * 在 <code><nowiki>/boot/grub/menu.lst 里你可以找到下边的这句:</nowiki></code> <pre><nowiki> # kopt=root=/dev/sda1 ro </nowiki></pre> It is a comment, but do not remove the '# ' at the beginning. /!\ THIS IS IMPORTANT. If you require additional kernel parameters (for example, if someone has asked you to test booting with certain parameters in order to troubleshoot a problem), add them to the end of the line, for example to add <code><nowiki>noapic</nowiki></code>: * 这是一个备注, 但是不要删除最开始的'#'. /!\ 这是非常重要的. 如果你需要额外的内核参数 (比方说,如果有人需要你从一个特定的参数去启动来诊断问题的时候.), 把它在句子的最后,比方说加入 noapic: <pre><nowiki> # kopt=root=/dev/sda1 ro noapic </nowiki></pre> After editing the file, run: * 当结束编辑文档的时候,运行: * <pre><nowiki> sudo update-grub </nowiki></pre> === If /boot is on another partition === 如果 /boot在另外一个分区 . If <code><nowiki>/boot</nowiki></code> is mounted on another partition and you use <code><nowiki>update-grub</nowiki></code>, then you may run into problems. One fix is to use <code><nowiki>grub-install</nowiki></code>, which is a distribution-agnostic way to install <code><nowiki>grub</nowiki></code>. * 如果/boot在另外一个分区,你想用update-grub的时候,你可能会遇到问题。 一种解决办法是用grub-install,这是一个distribution-agnostic(我不是电脑专业的,这个是什么意思啊?)的方法去安装grub. <pre><nowiki> sudo grub-install --root-directory=/boot /dev/sda </nowiki></pre> This is probably less desirable because <code><nowiki>update-grub</nowiki></code> is very good at setting things up properly, therefore it should be used instead. Another fix is to create a symlink in <code><nowiki>/boot</nowiki></code> to itself: * 这个可能不是非常这得去尝试。因为update-grub自己本身非常善于正确的设定,所以,应该用这个。 另外一种方法是建立一个symlink在/boot: <pre><nowiki> cd /boot sudo ln -s . boot </nowiki></pre> The reasoning behind this is when grub boots, it looks at whatever partition it is installed on. <code><nowiki>update-grub</nowiki></code> (and <code><nowiki>grub-install</nowiki></code>) assumes that everything is in <code><nowiki>/boot</nowiki></code>. When <code><nowiki>/boot</nowiki></code> is on the same partition as <code><nowiki>/</nowiki></code>, then all is OK, as <code><nowiki>menu.lst</nowiki></code> will be in <code><nowiki>/boot/grub</nowiki></code>. If <code><nowiki>/boot</nowiki></code> is on a separate partition, then grub sees <code><nowiki>/boot</nowiki></code> as <code><nowiki>/</nowiki></code> (hence the '--root-directory' above). By adding a symlink, when it looks for <code><nowiki>/boot/grub</nowiki></code>, it will be there. By creating the symlink, you have put a loop in the file system, which may cause problems when using certain options of <code><nowiki>cp</nowiki></code>, <code><nowiki>mv</nowiki></code>, etc. * 原因是,当grub启动的时候,他回自己寻找已经安装的分区。update-grub(和undate-install)会假设所有的东西都在/boot里边。 当/boot在同一个 / 分区里,因为menu.lst会在 /boot/grub,所以就不会有问题。 如果 /boot 在另外一个分区, grub就会把/boot当成 / (也就是上边说的 '--root-diretctory'). 加入了 symlink, 他就会寻找/boot/grub, 它会在那儿的. 建立symlink, 你需要加入一个loop在file system, 当你用到一些option的时候 (比如说, cp, mv 等等),这个会造成问题. === Bootsplash === * Grub allows an image to be displayed behind the menu. You can obtain a set of images with the package "grub-splashimages", or you can make your own. The images must be 640x480 pixels, contain no more than 16 colors (but a smaller number like 12 works better to allow some different colors for the menu text), and be in gzipped xpm format. The GIMP can be used to resize (Image -> Scale Image...), reduce colors (Image -> Mode -> Indexed...), and can save to .xpm.gz files. After creating a splash image, add a line like <pre><nowiki> splashimage=(hd0,4)/grub/splash.xpm.gz </nowiki></pre> to your menu.lst file. A useful trick is to make a symlink to the actual image named splash.xpm.gz. <pre><nowiki> cd /boot/grub sudo ln -s my_image.xpm.gz splash.xpm.gz </nowiki></pre> Grub loads the image from the disk upon boot; it is not stored in the MBR. If you use a symlink, you will not have to edit menu.lst and reinstall grub to change the image, you just have to change the symlink. Here is an image of the GNU by Peter Gerwinski: attachment:gnu-head.xpm.gz ==== Splash Image with update-grub ==== * The command '''update-grub''' will automatically pick up /boot/grub/splash.xpm.gz and configure the ''menu.lst'' file for you. It will take care of the correct hdX and partition number [no need to type in (hd0,4)]. <pre><nowiki> sudo apt-get install grub-splashimages sudo ln -s /boot/grub/splashimages/my_image.xpm.gz /boot/grub/splash.xpm.gz sudo update-grub </nowiki></pre> '''Note:''' replace the my_image.xpm.gz with the one that you want. === Creating a boot floppy === * You can use grub to create a boot floppy. See /BootFloppy === Change the default operating system === * By default, Grub in Ubuntu boots Ubuntu by default. If you wish to change this to another operating system, see [[/ChangeDefaultOS]] === Network booting === * If you use LTSP or Edubuntu, you may want to boot from your network card. Specific network cards need a specifc rom to boot from. To find which one you need, run <code><nowiki>lsmod</nowiki></code> and then search for your floppy. Then go to www.rom-o-matic.com and get the appropriate rom. Edit <code><nowiki>/boot/grub/menu.lst</nowiki></code> and add the following before <code><nowiki>### BEGIN AUTOMAGIC KERNELS LIST</nowiki></code> or after <code><nowiki>### END DEBIAN AUTOMAGIC KERNELS LIST</nowiki></code>, otherwise your changes will be wiped out by security updates, etc. <pre><nowiki> title LTSP root (hd0,2) kernel /boot/(rom you get from rom-o-matic) </nowiki></pre> ---- * [[category:CategoryDocumentation]] [[category:CategoryCleanup]] ---- * <pre><nowiki> ---- 原文出处:wiki.ubuntu.org.cn 原文作者: 授权许可:[http://creativecommons.org/licenses/by-sa/2.0/ 创作共用协议Attribution-ShareAlike 2.0] [http://www.gnu.org/copyleft/fdl.html GNU自由文档许可证] 翻译人员:x5yw ShaunDu 校对人员: 贡献者: 适用版本: 文章状态:[[翻译中]] ----</nowiki></pre>
返回
GrubHowto
。
导航菜单
页面操作
页面
讨论
阅读
查看源代码
历史
页面操作
页面
讨论
更多
工具
个人工具
登录
导航
首页
最近更改
随机页面
页面分类
帮助
搜索
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息