特殊:Badtitle/NS100:GrubHowto:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
第1行: | 第1行: | ||
{{From|https://help.ubuntu.com/community/GrubHowto}} | {{From|https://help.ubuntu.com/community/GrubHowto}} | ||
{{Languages|UbuntuHelp:GrubHowto}} | {{Languages|UbuntuHelp:GrubHowto}} | ||
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=important.png '''Note: These directions do not apply to clean installs of Karmic or later. Karmic onward uses [[UbuntuHelp:Grub2|Grub2]] ''unless you upgraded from a previous version of Ubuntu and have not manually upgraded to Grub2.''''' | |||
== GRUB == | == GRUB == | ||
GRUB is more than just a boot loader | GRUB is more than just a boot loader. It is also the world's best boot manager, meaning it is best installed to the Master Boot Record of the first hard disk. That way GRUB will be the first thing that loads when the computer starts. It allows you to boot Linux directly or boot another boot loader which can then load its own operating system(s). You can have different operating systems, and versions of them, on the same or different hard drives. For example, if you have both Windows and Linux installed on a computer, GRUB would load before either of these and let you choose which one to boot. | ||
You can also create a boot floppy with GRUB to use in case of emergency, GrubHowto/BootFloppy<<BR>> | You can also create a boot floppy with GRUB to use in case of emergency, GrubHowto/BootFloppy<<BR>> | ||
GRUB is Open Source software, the source code is open for anyone to inspect. From a security standpoint, you should only trust Open Source software. | GRUB is Open Source software, the source code is open for anyone to inspect. From a security standpoint, you should only trust Open Source software. | ||
第81行: | 第82行: | ||
/dev/sda3 14G 8.3G 5.0G 63% / | /dev/sda3 14G 8.3G 5.0G 63% / | ||
</nowiki></pre> | </nowiki></pre> | ||
<code><nowiki>/</nowiki></code> is on <code><nowiki>/dev/ | <code><nowiki>/</nowiki></code> is on <code><nowiki>/dev/sda3</nowiki></code>. Because this is going to be passed to the kernel, there's no need to translate to Grub notation. The 'ro' causes the kernel to mount the drive read-only initially; later the drive will be remounted read/write. This is generally done so <code><nowiki>fsck</nowiki></code> can run on <code><nowiki>/</nowiki></code> at bootup. | ||
<pre><nowiki> | <pre><nowiki> | ||
# kopt=root=/dev/sda3 ro | # kopt=root=/dev/sda3 ro | ||
第141行: | 第142行: | ||
<<BR>>First, you need to get a grub prompt (grub>) somehow. So what you can do is: | <<BR>>First, you need to get a grub prompt (grub>) somehow. So what you can do is: | ||
* Use a rescue disk, like Super Grub Disk, from which you can boot into your OS, or press the “c” key to get a GRUB prompt. | * Use a rescue disk, like Super Grub Disk, from which you can boot into your OS, or press the “c” key to get a GRUB prompt. | ||
* Use your Live *ubuntu CD. Boot into the [[UbuntuHelp:LiveCD|LiveCD]]. Now get a terminal and proceed exactly as in Case 1, starting with '''sudo grub''' to get a GRUB prompt. | * Use your Live *ubuntu CD. Boot into the [[UbuntuHelp:LiveCD|LiveCD]]. Now get a terminal and proceed exactly as in Case 1, starting with '''sudo grub''' to get a GRUB prompt. Note: grub is not included with 9.10 Ubuntu [[UbuntuHelp:LiveCD|LiveCD]] | ||
=== Manually boot into a Linux OS === | === Manually boot into a Linux OS === | ||
These are the same 3 methods you see in a menu.lst, except in menu.lst you have “title” lines and you don’t need the boot command (since it’s implied). | These are the same 3 methods you see in a menu.lst, except in menu.lst you have “title” lines and you don’t need the boot command (since it’s implied). |
2010年5月19日 (三) 22:32的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/GrubHowto }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/af | • {{#if: UbuntuHelp:GrubHowto|Afrikaans| [[::GrubHowto/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/ar | • {{#if: UbuntuHelp:GrubHowto|العربية| [[::GrubHowto/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/az | • {{#if: UbuntuHelp:GrubHowto|azərbaycanca| [[::GrubHowto/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/bcc | • {{#if: UbuntuHelp:GrubHowto|جهلسری بلوچی| [[::GrubHowto/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/bg | • {{#if: UbuntuHelp:GrubHowto|български| [[::GrubHowto/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/br | • {{#if: UbuntuHelp:GrubHowto|brezhoneg| [[::GrubHowto/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/ca | • {{#if: UbuntuHelp:GrubHowto|català| [[::GrubHowto/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/cs | • {{#if: UbuntuHelp:GrubHowto|čeština| [[::GrubHowto/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/de | • {{#if: UbuntuHelp:GrubHowto|Deutsch| [[::GrubHowto/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/el | • {{#if: UbuntuHelp:GrubHowto|Ελληνικά| [[::GrubHowto/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/es | • {{#if: UbuntuHelp:GrubHowto|español| [[::GrubHowto/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/fa | • {{#if: UbuntuHelp:GrubHowto|فارسی| [[::GrubHowto/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/fi | • {{#if: UbuntuHelp:GrubHowto|suomi| [[::GrubHowto/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/fr | • {{#if: UbuntuHelp:GrubHowto|français| [[::GrubHowto/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/gu | • {{#if: UbuntuHelp:GrubHowto|ગુજરાતી| [[::GrubHowto/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/he | • {{#if: UbuntuHelp:GrubHowto|עברית| [[::GrubHowto/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/hu | • {{#if: UbuntuHelp:GrubHowto|magyar| [[::GrubHowto/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/id | • {{#if: UbuntuHelp:GrubHowto|Bahasa Indonesia| [[::GrubHowto/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/it | • {{#if: UbuntuHelp:GrubHowto|italiano| [[::GrubHowto/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/ja | • {{#if: UbuntuHelp:GrubHowto|日本語| [[::GrubHowto/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/ko | • {{#if: UbuntuHelp:GrubHowto|한국어| [[::GrubHowto/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/ksh | • {{#if: UbuntuHelp:GrubHowto|Ripoarisch| [[::GrubHowto/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/mr | • {{#if: UbuntuHelp:GrubHowto|मराठी| [[::GrubHowto/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/ms | • {{#if: UbuntuHelp:GrubHowto|Bahasa Melayu| [[::GrubHowto/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/nl | • {{#if: UbuntuHelp:GrubHowto|Nederlands| [[::GrubHowto/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/no | • {{#if: UbuntuHelp:GrubHowto|norsk| [[::GrubHowto/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/oc | • {{#if: UbuntuHelp:GrubHowto|occitan| [[::GrubHowto/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/pl | • {{#if: UbuntuHelp:GrubHowto|polski| [[::GrubHowto/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/pt | • {{#if: UbuntuHelp:GrubHowto|português| [[::GrubHowto/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/ro | • {{#if: UbuntuHelp:GrubHowto|română| [[::GrubHowto/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/ru | • {{#if: UbuntuHelp:GrubHowto|русский| [[::GrubHowto/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/si | • {{#if: UbuntuHelp:GrubHowto|සිංහල| [[::GrubHowto/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/sq | • {{#if: UbuntuHelp:GrubHowto|shqip| [[::GrubHowto/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/sr | • {{#if: UbuntuHelp:GrubHowto|српски / srpski| [[::GrubHowto/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/sv | • {{#if: UbuntuHelp:GrubHowto|svenska| [[::GrubHowto/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/th | • {{#if: UbuntuHelp:GrubHowto|ไทย| [[::GrubHowto/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/tr | • {{#if: UbuntuHelp:GrubHowto|Türkçe| [[::GrubHowto/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/vi | • {{#if: UbuntuHelp:GrubHowto|Tiếng Việt| [[::GrubHowto/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/yue | • {{#if: UbuntuHelp:GrubHowto|粵語| [[::GrubHowto/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/zh | • {{#if: UbuntuHelp:GrubHowto|中文| [[::GrubHowto/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/zh-hans | • {{#if: UbuntuHelp:GrubHowto|中文(简体)| [[::GrubHowto/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:GrubHowto | UbuntuHelp:GrubHowto | {{#if: | :}}GrubHowto}}/zh-hant | • {{#if: UbuntuHelp:GrubHowto|中文(繁體)| [[::GrubHowto/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:GrubHowto|:GrubHowto|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :GrubHowto/zh | | {{#ifexist: GrubHowto/zh | | {{#ifeq: {{#titleparts:GrubHowto|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:GrubHowto|1|-1|}} | zh | | }}
Note: These directions do not apply to clean installs of Karmic or later. Karmic onward uses Grub2 unless you upgraded from a previous version of Ubuntu and have not manually upgraded to Grub2.
GRUB
GRUB is more than just a boot loader. It is also the world's best boot manager, meaning it is best installed to the Master Boot Record of the first hard disk. That way GRUB will be the first thing that loads when the computer starts. It allows you to boot Linux directly or boot another boot loader which can then load its own operating system(s). You can have different operating systems, and versions of them, on the same or different hard drives. For example, if you have both Windows and Linux installed on a computer, GRUB would load before either of these and let you choose which one to boot.
You can also create a boot floppy with GRUB to use in case of emergency, GrubHowto/BootFloppy<
>
GRUB is Open Source software, the source code is open for anyone to inspect. From a security standpoint, you should only trust Open Source software.
Make sure that you use grub with sudo or in a root shell. It is possible to start a grub shell as a regular user without the requisite privileges, the problem being that instead of receiving a "permission denied" error when executing a command grub will print bogus error messages, for example ones that suggest grub cannot find your hard disks. It's pretty frustrating to try to troubleshoot problems that don't really exist.
Modifying boot options in GRUB
If you need to get into the grub menu to modify boot options or choose a different kernel, you need to press 'ESC' just after it starts.<
>
By default you have to press 'ESC' within three seconds. If you want to increase this time limit, you can edit the grub configuration file /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.<
>
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.
After pressing 'ESC' you will be presented with a list of kernels and operating systems that you can boot.<
>
You can press an up or down arrow key to highlight a different kernel or operating system to boot.<
>
For example, you might need to boot into 'recovery mode' to fix some problem with your operating system.<
>
To modify the boot options within the grub menu, highlight the operating system you want to edit and press 'e'.<
>
There you will be presented with lines starting with 'root', 'kernel', 'initrd', 'quiet' and 'savedefault'.<
>
You may wish to make changes to any of these lines before booting.<
>
Boot options can be appended to the end of the 'kernel' line, Boot Parameters.<
>
To receive a more verbose boot process you can remove the 'quiet' line by highlighting it and pressing 'd' to remove that line.<
>
You may also want to highlight the 'kernel' line press 'e' to edit and remove the word 'splash' from the end of the line.<
>
After making any necessary modifications you can press 'b' to boot that operating system.<
>
These modifications will not persist across reboots.
Automagic Kernels List
Ubuntu uses a script called update-grub
to modify menu.lst
. Whenever you install kernel updates from the repositories, update-grub
is run to update the grub settings. It automatically detects all of the kernels you have in the /boot
directory, and applies various global settings to each one. <
>
The relevant parts of menu.lst
that update-grub
looks at are the ones in between the "### BEGIN AUTOMAGIC KERNELS LIST" and "### END DEBIAN AUTOMAGIC KERNELS LIST" lines. <
>
In this section of the menu.lst file, comments are preceded 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 /boot
resides on a different partition than /
(root). See the appropriate section on this page for more information about different /boot
partitions.<
>
Another common option is 'kopt=', which are kernel options applied to all kernels in the menu.lst
, read the next section below.
Setting kernel parameters
In `/boot/grub/menu.lst`, you will find a line like this:
# kopt=root=/dev/sda1 ro
This looks like a comment, but do not remove the '# ' at the beginning. /!\ THIS IS IMPORTANT: grub
sees this line as a comment and ignores it, but it is used as a configuration parameter by update-grub
to generate the contents of the file that grub
will read at boot.
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 `noapic`:
# kopt=root=/dev/sda1 ro noapic
After editing the file, run:
sudo update-grub
Note that you can temporarily add kernel parameters at the grub boot menu also, by pressing 'e ' and editing the kernel line.
If /boot is on another partition
If /boot
is mounted on another partition, it will mean that your Linux kernel will be restricted to the area of your hard disk where the /boot partition is located. That is a good way to overcome GRUB Error 18 in older computers.<
> A Separate /boot partition is also needed when the root file system will be encrypted.<
>
If your operating system was installed that way by the Ubuntu installer then it should work perfectly without the user needing to do anything.<
>
If for some reason you need to create your own separate /boot partition at some later time after the installation of your Ubuntu operating system, you must create an entry in your /etc/fstab file for it. You will also need to edit your /boot/grub/menu.lst file with the correct partition number in the groot line, see 'Automagic Kernels List' further up in this page.<
>
If you do those two things correctly then when you use update-grub
, you should never run into any problems. <
>
A Separate /boot partition is not very good for people who want to boot more than one Linux operating system because iit is tricky to get more than one Linux to share the same Separate /boot partition peacefully. For that, you need a 'Dedicated GRUB Partition', which contains only GRUB files and not necessarily any Linux kernels, and is operating system independant.
Changing the Disk that Grub is installed to
Consider the following problem: You have two hard drives, one SATA (/dev/sda), the other PATA (/dev/hda). Your BIOS seems to think that PATA drives should always be booted in preference of SATA drives, but you want to boot from the SATA drive. Grub can work around this problem.
Finding groot
First, figure out what Grub names the drives. This is listed in /boot/grub/device.map
. There you will find a table of Grub-style names (e.g. (hd0)) and Linux-style names (e.g. /dev/hda/). You need to know what drive and partition /boot
is on. To find where /boot
is, use df
:
df /boot
This should tell you the Linux-style partition name where /boot
is. Then simply match it with the Grub-style name in device.map
. This is what groot should be.
Example:
$ df /boot Filesystem Size Used Avail Use% Mounted on /dev/sda5 46M 15M 30M 33% /boot $ cat /boot/grub/device.map (hd0) /dev/hda (hd1) /dev/sda
So groot should be (hd1,4) (note that Grub partition numbers are always one less than Linux numbers). Thus in /boot/grub/menu.lst
,
# groot=(hd1,4)
Finding kernel root
The other piece of the puzzle is telling the kernel where /
is. Simply find out where /
is mounted.
df /
This is what root should be in kopt. Example:
$ df / Filesystem Size Used Avail Use% Mounted on /dev/sda3 14G 8.3G 5.0G 63% /
/
is on /dev/sda3
. Because this is going to be passed to the kernel, there's no need to translate to Grub notation. The 'ro' causes the kernel to mount the drive read-only initially; later the drive will be remounted read/write. This is generally done so fsck
can run on /
at bootup.
# kopt=root=/dev/sda3 ro
In summary, groot is where /boot
is, and is what Grub sees that drive as. kopt=root is where /
is, and is what the kernel sees that drive as.
Boot splash images
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.
Manual configuration
After creating a splash image, add a line like
splashimage=(hd0,4)/boot/grub/splash.xpm.gz
to your menu.lst file. A useful trick is to make a symlink to the actual image named splash.xpm.gz.
cd /boot/grub sudo ln -s my_image.xpm.gz splash.xpm.gz
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. Make sure any symlink does not point to a file on another partition, for instance if you have /boot on a separate partition. 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)].
sudo apt-get install grub-splashimages sudo ln -s /boot/grub/splashimages/my_image.xpm.gz /boot/grub/splash.xpm.gz sudo update-grub
Note: replace the my_image.xpm.gz with the one that you want.
Backup, Repairing and Reinstalling GRUB
To make a backup a copy of the existing menu.lst file use:
cp /boot/grub/menu.lst /boot/grub/menu.lst.old
You can try re-installing the grub using the Ubuntu Live CD, in two different ways.
GUI
- Boot your computer up with Ubuntu CD
- Go through all the process until you reach "[!!!] Disk Partition"
- Select Manual Partition
- Mount your appropriate linux partions
/ /boot swap .....
- DO NOT FORMAT THEM.
- Finish the manual partition
- Say "Yes" when it asks you to save the changes
- It will give you errors saying that "the system couldn't install ....." after that
- Ignore them, keep select "continue" until you get back to the Ubuntu installation menu
10. Jump to "Install Grub ...." 11. Once it is finished, just restart your computer
Command line
- Boot your computer up with Ubuntu CD
- Open a terminal window or switch to a tty.
- Go SuperUser (that is, type "sudo -s"). Enter root passwords as necessary.
- Type "grub"
- Type "find /boot/grub/stage1". You'll get a response like "(hd0,1)". Use whatever your computer spits out for the following lines.
- Type "root (hd0,1)", or whatever your hard disk + boot partition numbers are for Ubuntu.
- Type "setup (hd0)", to install GRUB to MBR, or "setup (hd0,1)" or whatever your hard disk + partition nr is, to install GRUB to a partition.
- Quit grub by typing "quit".
- Reboot and remove the bootable CD.
If you can't boot into any of your Linux OSs:
<
>First, you need to get a grub prompt (grub>) somehow. So what you can do is:
- Use a rescue disk, like Super Grub Disk, from which you can boot into your OS, or press the “c” key to get a GRUB prompt.
- Use your Live *ubuntu CD. Boot into the LiveCD. Now get a terminal and proceed exactly as in Case 1, starting with sudo grub to get a GRUB prompt. Note: grub is not included with 9.10 Ubuntu LiveCD
Manually boot into a Linux OS
These are the same 3 methods you see in a menu.lst, except in menu.lst you have “title” lines and you don’t need the boot command (since it’s implied). Method #1: Chainload To chainload Linux which is on (hdx,y):
grub> root (hdx,y) grub> chainloader +1 grub> boot
Note: Windows is always booted by chainloading Note: To chainload, GRUB must first be installed in the OS’s root partition. See Installing GRUB. So, run the commands:
grub> root (hdx,y), grub> setup (hdx,y)
Method #2: Use the specific kernel-initrd commands (as in a full menu.lst), ending with the boot command.<
><
>
Method #3: Configfile
This almost always works! Example: To boot into Kubuntu on sdb3 (= (hd1,2)), type
grub> configfile (hd1,2)/boot/grub/menu.lst # you’ll get the boot menu on sdb3
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 lsmod
and then search for your floppy. Then go to www.rom-o-matic.com and get the appropriate rom.
Edit `/boot/grub/menu.lst` and add the following before ### BEGIN AUTOMAGIC KERNELS LIST
or after ### END DEBIAN AUTOMAGIC KERNELS LIST
, otherwise your changes will be wiped out by security updates, etc.
title LTSP root (hd0,2) kernel /boot/(rom you get from rom-o-matic)
Security
By editing the boot command in grub, root access can be gained without the need of a password. To avoid this, edit the part "## password ['--md5'] passwd" of `/boot/grub/menu.lst`:
password yourfancyplaintextpassword
Insert the password of your choice. To prevent normal users to read this password, you should also remove read permission for these:
sudo chmod o-r /boot/grub/menu.lst
You can also use an md5 password, more info in the Gentoo Security Handbook.
Windows
See :
More information
- The official GNU GRUB manual has a "DOS/Windows" chapter with hints on setting up dual-boot systems.
- Illustrated Dual Boot Site has a GRUB Page which has a lot of information about GRUB in Ubuntu.
- Reinstall Ubuntu Grub Bootloader After Windows Wipes it Out
- Installing GRUB using grub-install
- How To Repair your GRUB
- HowtoPartition
- http://www.supergrubdisk.org/wiki/Howto_Boot_Windows_without_problems#Grub_solution
- Auto SuperGrub Disk
Other Languages
ComoGrub (Spanish)