ubuntu12.04升级之后移植乱码,原先还装了13.04,所以用13.04的grub不会乱码,但是删了13.04之后,12.04的grub乱码确实很难忍受,查了下官方文档,顺便摘抄一下相关知识。
原因可能是grub2被屏蔽掉了,我发现进入grub显示的是grub0.98,所以有了头绪,执行如下命令即可
sudo apt-get install grub-pc
sudo upgrade-from-grub-legacy当然除了使用命令行外,你也可以使用图形工具Boot-repair
Getting Boot-Repair
1st option : get a CD including Boot-RepairThe easiest way to use Boot-Repair is to burn one of the following disks and boot on it.
Remark : you can also install the ISO on a live-USB (eg via UnetBootin or LiliUSB or Universal USB Installer).
2nd option : install Boot-Repair in Ubuntu- boot your computer on a Ubuntu live-CD or live-USB. - choose "Try Ubuntu" - connect internet - open a new Terminal, then type:
sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update - Press Enter. - Then type: sudo apt-get install -y boot-repair && (boot-repair &) - Press Enter
Using Boot-Repair
Recommended repair
Advanced optionsWarning: the default settings are the ones used by the "Recommended Repair". Changing them may worsen your problem. Don't modify them before creating a BootInfo URL, and asking advice on this thread. 除此之外,官方文档还介绍另外一种修复方法: |
apt-get update
The following command will completely remove grub-pc and grub-common. In GRUB 1.99 and later, grub-gfxpayload-lists will also be removed.
You will be warned you are removing the bootloader. TAB to OK and press ENTER.
apt-get purge grub-common
apt-get install grub-pc
If using the ChRoot procedure, Exit chroot then continue the ChRoot procedure at Step 13:
一下摘自ubuntu官方文档:
To upgrade to GRUB 2 install the grub-pc package. This package can be installed with Synaptic, if installed, or by running the command below. Once the installation begins, a simple script will guide the user through the rest of the installation:
sudo apt-get install grub-pc
The package manager may complain about version conflicts and offer a solution to un-install GRUB. This may cause you to worry that it might become impossible for you to use the "Chain load to GRUB2 from legacy GRUB" option that is mentioned below. Selecting the un-install GRUB option here will not prevent you booting with the legacy menu described in step 4 below.
1. At the first prompt, read the message, tab to select "OK", then press ENTER. |
|
2. After selecting "OK" the next option allows the user to test GRUB 2 by adding an entry to their normal GRUB menu. Select "Yes" to place a Chainload option on the GRUB menu. When GRUB boots the next time, the user can select a normal GRUB entry or transfer control to GRUB 2 via the Chainload entry. |
|
3. The next step(s) will import sections from GRUB's menu.lst to the "Linux command line" (shown) and possibly the "Linux default command line". These entries allow the user to enter any special commands such as quiet, splash, noapic and others of that nature. GRUB 2 should automatically import these settings. Normally the user should accept any existing entries and TAB to "OK". If necessary, entries can be added later. Refer to the Configuring GRUB 2 section for more detail. |
|
|
When installing on a fresh drive, you may need to mark the selected partition as bootable. Although Linux does not use the boot flag, other OS's may require its presence.
grub.cfg is the file which replaced GRUB 0.97's menu.lst. This file contains the GRUB 2 menu information but unlike GRUB's menu.lst the grub.cfgfile is not normally edited directly. The file is the result of various scripts which build the menu in sections, with each script responsible for a specific part of the menu.
grub.cfg is updated by running the update-grub command as root.
The grub.cfg file is not created or updated when the grub-install command is run.
Each section is clearly delineated with "(### BEGIN)" and references the script in the /etc/grub.d directory from which the information was generated. These sections are more fully explained in the Scripts section.
00_header Sets environmental variables such system file locations, video settings, and previously saved entries. It also imports preferences stored in /etc/default/grub. Users normally do not need to make changes to this file.
05_debian_theme The settings in this file set the GRUB 2 background image, text colors, selection highlighting and themes. In the absence of a splash image, this file sets a monochromatic theme for the initial menu display. Information on how to set font renderings and splash images are discussed in the Grub2/Displays community documentation page.
10_linux Identifies kernels on the root device for the operating system in use and creates menu entries for these items. This includes the associated recovery mode option if enabled. In GRUB 1.99 and later, only the latest kernel is displayed on the main menu page, with additional kernels included in a submenu. See the Grub2/Submenus page for information on this feature.
Note: For earlier versions of GRUB 2, all kernels residing in the boot folder are included on the main menu. To reduce the number of displayed kernels, remove the older kernels from the /boot folder or use one of the available GRUB 2 customization applications.
20_memtest86+ Searches for /boot/memtest86+.bin and includes it as an option on the GRUB 2 boot menu. There is currently no line option to remove this entry from the menu. The display of memtest86+ can be inhibited by removing the executable bit from this file and runningupdate-grub.
sudo chmod -x /etc/grub.d/20_memtest86+ sudo update-grub
30_os-prober This script uses os-prober to search for Linux and other operating systems and places the results in the GRUB 2 menu.
Variables in this file determine the format of the displayed names in /boot/grub/grub.cfg and on the GRUB 2 menu. Users familiar with basic scripting can alter these variables to change the format of the displayed menu entries.
The user can insert an entry into /etc/default/grub which disables this script (see Configuring GRUB 2). Removing the executable bit from the file will also prevent it from searching for other operating systems.
By default os-prober ignores any disks that possess "dmraid" signatures, which can be listed via sudo dmraid -r -c (if installed).
If the script finds another Ubuntu/Linux operating system, it will attempt to use the titles contained in the 10_linux section of that installation's grub.cfg file. If not found, the script will construct a menuentry from the actual boot information it locates.
40_custom A template for adding custom menu entries which will be inserted into grub.cfg upon execution of the update-grubcommand.
The contents of this file, below the "exec tail -n +3 $0" line and the default comments, are imported directly into /boot/grub/grub.cfgwithout any changes.
As the comments at the top of the file state, add custom lines below those already contained in the 40_custom file.
As mentioned in the introduction of this section, the name of the file determines the location of its contents in the GRUB 2 menu. As a general rule, if using numerals at the start it is advisable to allow the 00_header and 05_debian_theme scripts to be run before the first custom menu. These files contain no menuentries and thus will not interfere with a menuentry from a custom script with a lower priority.
Configuration changes are normally made to /etc/default/grub and to the custom files located in /etc/grub.d. Any changes made directly to the/boot/grub/grub.cfg are overwritten whenever update-grub is executed either by the user or when called automatically by various system functions.
After editing /etc/default/grub or the scripts in the /etc/grub.d folder the user should run sudo update-grub to incorporate the changes into the GRUB 2 menu.
This file contains basic settings which would be considered normal for the user to configure. Options include the time the menu is displayed, the default OS to boot, etc. The default options included in file upon installation are only a small number of the variables which GRUB 2 can recognize. The GRUB 2 defined variables can be identified using the command previously documented in the GRUB 2 Settings section or at the end of this section.
In addition to the defined variables, the user may introduce self-created variable(s) and use them in the scripts contained in the /etc/grub.dfolder.
The grub file is a system file, therefore any editing must be done by a user with 'Administrator/root' privileges. The file is a simple text file and can be edited by any text editor. The default text editor in Ubuntu is Gedit, and the file can be edited with the following command. "gksu" is the graphical equivalent of "sudo" and the "&" allows the terminal to be used to update GRUB 2 once the user saves the file.
gksu gedit /etc/default/grub &
After making changes and saving the file, the GRUB 2 menu must be updated to include the changes by running:
sudo update-grub
GRUB_DEFAULT=
GRUB_DEFAULT=0 Sets the default menu entry by menu position. The first "menuentry" in grub.cfg is 0, the second is 1, etc.
Note: Grub 1.99 introduces a submenu menu structure. For a menu item in a submenu, the entry becomes a two-digit entry. The first entry is the position of the submenu title in the main menu. The second entry is the position within the submenu. If the submenu is the 3rd entry in the main entry, and the user wishes to boot the first entry in the submenu, it would be designated as "2>0". See the community documentation for a fuller explanation: Grub2/Submenus.
GRUB_DEFAULT="xxxx" An exact menu entry, including the quotation symbols, may also be used. In this case, location in the menu will not matter.
Example: GRUB_DEFAULT="Ubuntu, Linux 2.6.31-9-generic"
Example (Submenu Entry): GRUB_DEFAULT="2>Ubuntu, Linux 2.6.38-8-generic"
GRUB_DEFAULT=saved The information in this section applies to GRUB 1.98 and later. The "saved" entry enables the "grub-reboot" and "grub-set-default" commands to set the default OS for future boots.
The default OS for future boots will not be set merely by selecting an OS when booting.
grub-set-default Sets the default boot entry until changed.
The format is sudo grub-set-default X, with X being the menu entry position (starting with 0 as the first entry) or the exact menu string.
Example: sudo grub-set-default 3
Example: sudo grub-set-default "Ubuntu, Linux 2.6.32-15-generic"
grep menuentry /boot/grub/grub.cfg
grub-reboot This command sets the default boot entry for the next boot only. The format of the command is the same as for grub-set-default (see above).
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT=0
To display the menu under this condition, place a # symbol at the start of the line and ensure the GRUB_TIMEOUT setting is a positive integer.
If the value is set to 0, a keystatus check is performed to determine if the SHIFT key is depressed. If GRUB 2 determines the SHIFTkey is depressed during the boot process, the menu will be displayed. This gives the user a method of interrupting an automatic boot which would normally not display the menu.
GRUB_HIDDEN_TIMEOUT=X
X is a positive integer (e.g. 1, 5, 10, etc)
The boot process will pause and display a blank screen or the designated splash image for X seconds. At the end of the time period, the system will boot. No menu will be displayed.
GRUB_HIDDEN_TIMEOUT=
No value entered after the = sign
GRUB_HIDDEN_TIMEOUT_QUIET=true
Determines whether a countdown timer is displayed on a blank screen when using the GRUB_HIDDEN_TIMEOUT feature.
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.
Note: There is a longstanding confirmed bug on the hidden menu feature in GRUB 1.97 to GRUB 1.99. The menu may not hide as specified in the description on this page. While editing the 30_os-prober script can fix this issue, it is beyond the scope of this page.
GRUB_TIMEOUT=10
Place a comment symbol (#) in front of the GRUB_HIDDEN_TIMEOUT entry
GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian
GRUB_CMDLINE_LINUX
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
#GRUB_TERMINAL=console
grub> prompt: GRUB 2 loaded modules but was unable to find the grub.cfg file.
grub rescue> prompt: GRUB 2 failed to find its grub folder, or failed to load thenormal module.
grub>: - The grub prompt on a blank screen.
GRUB 2 has found the boot information but has been either unable to locate or unable to use an existing GRUB 2 configuration file (usuallygrub.cfg).
grub rescue>: - The rescue mode.
GRUB 2 is unable to find the grub folder or its contents are missing/corrupted. The grub folder contains the GRUB 2 menu, modules and stored environmental data.
GRUB - a single word at the top left of the screen, with no prompt and no cursor.
Here are some useful tips and features for use with the GRUB 2 terminal:
Turning off the splash image. This may make viewing the terminal easier. Press c at the GRUB 2 menu to get to the command line and then type: set color_normal=white/blue or the color combination you wish to use. "black" as the second entry retains the menu's transparency and should be avoided as a selection if the user wants to work with a solid background color.
TAB completion. This feature is very handy. At any point, pressing the TAB key may complete an entry, if the element is unique, or display available options. Typing a few additional characters and pressing TAB again may allow tab completion to finish the entry.
set pager=1 To prevent text from scrolling off the screen, type set pager=1.
Help. Type help to view a list of all the commands. Type help x to view help commands beginning with the letter "x". Tab completion and using the up arrow to repeat commands work the same as in a normal terminal.
When GRUB 2 is fully functional, the GRUB 2 terminal is accessed by pressing c. If the menu is not displayed during boot, hold down the SHIFT key until it appears. If it still does not appear, try pressing the ESC key repeatedly.
From a GRUB 2 terminal with the grub> prompt, a wide variety of commands are available.
Command |
Result / Example |
boot |
Initiate the boot sequence, also F10 or CTRL-x |
cat |
Display the contents of readable files; cat (hd0,1)/boot/grub/grub.cfg |
configfile |
Load a GRUB 2 configuration file such as grub.cfg; configfile (hd0,5)/boot/grub/grub.cfg |
initrd |
Loads the initrd.img, necessary for booting; initrd (hd0,5)/initrd.img |
insmod |
Loads a module; insmod (hd0,5)/boot/grub/normal.mod, or insmod normal |
linux |
Loads the kernel; insmod /vmlinuz root=(hd0,5) ro |
loop |
Mount a file as a device; loopback loop (hd0,2)/iso/my.iso |
ls |
Lists the contents of a partition/folder; ls, ls /boot/grub, ls (hd0,5)/, ls (hd0,5)/boot |
lsmod |
List loaded modules |
normal |
Activate the normal module, if loaded |
search |
Search for a device. Type help search for the available options. |
set |
Review current settings, or set XXX to set a variable such as colors, prefix, root |
vbeinfo |
Display GRUB 2 available resolutions |
To view the complete command list, type help. For details on a particular command, type help [command]
When GRUB 2 is unable to boot or display the GRUB 2 menu the system will be left at a GRUB 2 terminal if possible. If the system boots to thegrub> prompt, the usual modules and commands are normally available. The user may need to manually load modules using the insmod [module] command before some commands will work.
In the grub rescue mode, only a limited set of commands are available. These commands are sufficient to investigate the contents of the drives, set prefix (path to the grub folder) and root (partition), load modules and boot.
The rescue mode provides fewer commands than the normal GRUB prompt line, but also provides these additional commands:
Command |
Result / Example |
dump |
Clears memory |
exit |
Exit GRUB 2 |
normal |
Return to the standard "grub>" mode if possible. |
Among the commands which can be used in the grub rescue mode:
boot |
cat |
chain |
help |
insmod |
linux |
ls |
multiboot |
normal |
search |
set |
unset |
The majority of this guide is devoted to working with the GRUB 2 terminal, which is used to enter commands to attempt to repair a broken bootloader. Boot-Repair is a GUI application which can automatically analyze boot problems and select the proper course of action to repair them. Its simple interface provides beginners as well as experienced Linux users an easy method of repairing the majority of GRUB 2 problems.
Additionally, Boot-Repair contains an automated method to run a boot info script which performs a series of tests and provides a file containing much valuable information regarding the status of the computer's operating and boot systems. This file can be inspected by community helpers on forums or IRC channels to help diagnose boot problems.
Boot-Repair can be run from a LiveCD or an operating Linux system. To download the package run the following commands:
sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update sudo apt-get install -y boot-repair && boot-repair
Visit the Boot-Repair community document for more information.
Boot-Repair is available from the Launchpad repositories and can be run from a CD or a working Linux OS.
A great many boot problems are due to incorrect paths to required files. The GRUB 2 terminal, in either 'failure' mode, provides a robust ability to search hard drive(s) and partitions and to inspect their contents.
In order to boot successfully, the root, prefix, linux and initrd variables must be correct. The user must verify the paths and names of these items. If they are incorrect, use the commands below to find and fix them. GRUB 2 variable settings can be viewed with the set command.
In the following examples, X is a hard drive number; Y is a partition number. If a command example includes either of these replace them with the appropriate value.
In the graphic below, the text in red are commands to be entered by the user, and text in green is the output of the command on an operating system (i.e. what you would like to see if your Ubuntu installation is on sda1).
The first hard drive is 0. The first partition is 1. Thus sda1 becomes (hd0,1), sdb5 is (hd1,5).
Use the ls command in the follow manner
Command |
Purpose |
ls |
Search the entire computer for devices and partitions: (hd0) (hd1) (hd0,1) (hd0,5) (hd1,1) |
ls / |
Search the root directory of the device designated as root (use the set command to check root). |
ls (hdX,Y) |
View information about a partition - format, size, UUID, etc. |
ls (hdX,Y)/ |
View the root contents of a partition. Use this command to look for the presence of vmlinuz and initrd.imgsymlinks |
ls (hdX,Y)/boot/ |
View the contents of a folder |
ls (hdX,Y)/boot/ |
Inspect the /boot folder. It should contain the actual kernel (linux-3.2...) and initrd image (initrd.img-3.2....) |
ls (hdX,Y)/boot/grub/ |
Inspect the /boot/grub folder. It should contain grub.cfg and many *.mod files. If looking for a specific file, include the name in the search to limit the number of returns. If available, the command set pager=1 will also limit returns to a single screen. |
What to Look For |
Where It Should Be (Default Installation) |
Specific / General Search Example |
grub.cfg |
(hdX,Y)/boot/grub/ or /boot/grub/ |
ls (hdX,Y)/boot/grub/grub.cfg or ls /boot/grub/ |
vmlinuz |
(hdX,Y)/ or / |
ls (hdX,Y)/vmlinuz or ls /vmlinuz or ls / |
linux-3.2.0-14* |
(hdX,Y)/boot/ or /boot/ |
ls (hdX,Y)/boot/vmlinuz-3.2.0-14 |
initrd |
(hdX,Y)/ or / |
ls (hdX,Y)/ or ls /initrd |
initrd.img-3.20-14 |
(hdX,Y)/ or /boot/ |
ls (hdX,Y)/boot/initrd.img-3.20-14 or ls (hdX,Y)/boot/ |
* Note: Use the full kernel name, including -generic, when searching or setting a kernel variable. Using the "TAB completion" technique may eliminate some typing and be more accurate if available.
Use the following commands to set these parameters (if incorrect). Substitute the correct value for X and Y. (Example: set root=(hdX,Y) becomesset root=(hd0,5) )
Task |
Command |
Notes |
Set the prefix |
set prefix=(hdX,Y)/boot/grub |
Use the actual location of the grub folder |
Set root |
set root=(hdX,Y) |
|
Set the kernel |
linux /vmlinuz root=/dev/sda1 ro |
Set the kernel if the symlink vmlinuz exists in / |
Set the kernel |
linux (hdX,Y)/boot/vmlinuz-3.0.2-14 root=/dev/sda1 ro |
Set the kernel itself |
Set the initrd image |
initrd /initrd.img |
Set the initrd image if the symlink exists in / |
Set the initrd image |
initrd (hdX,Y)/boot/initrd.img-3.0.2-14 |
Set the initrd image itself |
Use the section below based on the type of GRUB 2 terminal prompt displayed on the monitor.
The commands which follow assume you have determined the proper parameters for prefix, root, linux, and initrd. Review the Search & Set section of this page for guidance .
Terminal Display: The GRUB 2 header/version information and a grub> prompt.
If GRUB 2 leaves you at the grub> prompt, it has normally found the grub folder and loaded at least some basic modules. The configuration file (grub.cfg) may be missing, misnamed, or corrupted.
Quick Fix:
Use the Search & Set section to confirm the correct paths are set. Inspect the contents of the /boot/grub folder. Look for the grub.cfg file. It could be misnamed or missing. If not located in /boot/grub, use the ls command look for another .cfg file or look in /boot or other locations. If you locate the correct .cfg file:
configfile /boot/grub/grub.cfg or configfile (hdX,Y)/boot/grub/grub.cfg
If a .cfg with another name is located, substitute its path/filename in the command.
If the configuration file is loaded and not corrupt, when the above command is executed the GRUB 2 menu should appear and the user can make a selection to boot. Once booted into the system, correct the filename or move the configuration file to its proper location. Runupdate-grub. If the configuration file is not found, a message will be generated and the user must enter the boot commands manually.
Extended Fix:
The following commands should set the root and prefix paths and load the kernel and initrd image. With this information, GRUB 2 does not need a configuration file and should be able to boot the system if the only problem was a corrupted or missing menu.
Press ENTER after completing each line. Some entries will not provide feedback. This is normal.
If a "file not found" or similar error message is displayed while running these commands, ensure you are using the correct X,Y values and the correct paths are set.
1. set root=(hdX,Y) |
Confirm the correct X,Y values and press ENTER. |
Example: If the Ubuntu system is on sda5, enter: set root=(hd0,5) |
|
2. linux /vmlinuz root=/dev/sdXY ro |
Example: linux /vmlinuz root=/dev/sda5 ro |
If the vmlinuz symlink does not exist, use the full path to the kernel in /boot |
|
Example: linux /boot/vmlinuz-3.2.0-14-generic root=/dev/sda1 ro |
|
If successful, after ENTER there will be a slight delay and no messages. |
Wubi users only - substitute these commands in Steps 1 and 2:
1.set root=(loop0) |
2. linux /vmlinuz root=/dev/sdXY loop=/ubuntu/disks/root.disk ro |
3. initrd /initrd.img |
Selects the latest initrd image. |
If the vmlinuz symlink does not exist, use the full path to the initrd image in /boot |
|
If successful, after ENTER there will be a slight delay and no messages. |
|
4. boot |
Boot to the latest kernel on the selected partition. |
If the system fails to boot:
Attempt to find the GRUB 2 configuration file. The normal name is grub.cfg file. If not found, look for a misnamed .cfg file or in alternate locations. The menu configuration file may contain settings required for a successful boot (such as non-standard kernel options) even if the paths/filenames are correct.
Use the set command to confirm the correct root and prefix settngs. Also inspect the folders' actual contents with the ls command. The grub prompt normally means the GRUB 2 folder is intact but doesn't guarantee the integrity of other system files.
root= should point to the drive and partition on which Ubuntu is installed. If you use the ls / command you should see the main Ubuntu system folders.
If the system boots, please refer to the [[#Post-Boot Follow Up|Post Boot Follow Up] section
If the system fails to boot, proceed to the [#grub rescue|grub rescue]] section for more detailed troubleshooting options.
The GRUB 2 rescue mode is a major enhancement to the GRUB bootloader. The presence of the grub rescue> prompt signifies that GRUB 2 has failed to find the grub folder, the grub.cfg file, and/or the associated modules. The rescue prompt is presented so the user can provide the path to the grub folder, load the necessary modules, and provide the proper boot commands.
A common reason for the grub rescue> prompt is an incorrect path to the grub folder. Reasons for the prompt also include a failure to update GRUB 2 after certain system or partition operations, improper designation of the grub folder location, missing linux or initrd.img symlinks in /, or a failed installation.
To successfully boot from the grub rescue> prompt:
The grub folder must exist and contain the necessary GRUB 2 files and modules.
The proper paths must be set via the set prefix command.
If the path to the grub folder (normally /boot/grub) is not correct, an unknown command or file not found message is likely.
Use the General Troubleshooting Preparation section to locate the correct partitions and file locations. Once the user has confirmed the paths and existence of the proper folders using the Search & Set section, run the following commands:
1. set prefix=(hdX,Y)/boot/grub |
Use the values determined earlier. |
Example: If the Ubuntu system is on sda5, enter: set prefix=(hd0,5)/boot/grub |
|
2.* set root=(hdX,Y) |
Confirm the correct X,Y values and press ENTER. |
Example: If the Ubuntu system is on sda5, enter: set root=(hd0,5) |
|
3. insmod normal |
Load the normal module. |
If the module loads there will be no message. |
|
If the module fails to load, try the full path: insmod (hdX,Y)/boot/grub/normal.mod |
|
4. normal |
Transition to the normal GRUB 2 mode with increased functionality. |
If the module loads there will be no message. |
|
If the module loads, HELP, TAB completion and command recall using the UP/DN keys should be available. |
|
5. set |
(Optional) Review the current settings. |
6. insmod linux |
Load the linux module. An error message usually means the path is incorrect. |
7.* linux /vmlinuz root=/dev/sdXY ro |
Selects the latest kernel. |
Example: linux /vmlinuz root=/dev/sda5 ro |
|
If the vmlinuz symlink does not exist in /, use the full path to the kernel in /boot |
|
Example: linux /boot/vmlinuz-3.2.0-14-generic root=/dev/sda1 ro |
|
8. initrd /initrd.img |
Selects the latest initrd image. |
If the initrd symlink does not exist in /, use the full path to the initrd image in /boot |
|
If successful, after ENTER there will be a slight delay and no messages. |
|
9. boot |
Boot to the latest kernel on the selected partition. |
* Wubi users only - substitute these commands in Steps 2 and 7:
1.set root=(loop0) |
2. linux /vmlinuz root=/dev/sdXY loop=/ubuntu/disks/root.disk ro |
Some additional considerations:
The current prefix and root settings may be checked at any time with the set command. To remove a setting, use the unset command.
Example: unset prefix
Modules must be loaded before they can be used. If a module has not been loaded a unknown command error is displayed. If an incorrect path is specified, a file not found error message may be displayed.
The linux module must be loaded to be able to load both the kernel and the initrd image unless the normal module is loaded first.
If the modules cannot be found in the /boot/grub folder, the user may be able to load them from the /usr/lib/grub/i386-pc folder. The address if Ubuntu was installed on sda1 would be (hd0,1)/usr/lib/grub/i386-pc and the command would be:
insmod (hd0,1)/usr/lib/grub/i386-pc/normal.mod
Refer to the Post Boot Follow Up section if the system successfully boots.
Presence of the word GRUB at the top left of the monitor with no blinking cursor indicates that GRUB 2 can not even find the Master Boot Record (or equivalent) information. Thus, the core.img file, the /boot and /grub folder locations and contents are completely unknown to GRUB 2.
The seriousness of the problem cannot be assessed without the use of another operating system or an Ubuntu LiveCD or equivalent. The Ubuntu partition should be mounted for inspection and the user can then check to see if the system files are intact. If so, the user can use the ''ChRoot''procedure from the LiveCD to reinstall GRUB 2 and rewrite the information to the MBR.
Details on this procedure are contained in the Grub2/Installing community documentation.
Following a failed boot, GRUB 2 is designed to display the GRUB 2 menu on the next boot and await user input. This will happen even if the user has set the system to boot without displaying the GRUB 2 menu. This provides the user the opportunity to select a different menu option or edit a menuentry to change boot parameters. While this can cause problems on a server, for most users it is a benefit which will prevent constant rebooting during unmonitored operations.
In addition to its troubleshooting benefits, pre-boot editing of the GRUB 2 menu also allows users to add or remove kernel options, change operating modes, and accomplish other tasks such as testing fonts and splash images. For users who like to experiment, the settings altered via the GRUB 2 terminal are non-persistent and won't affect future boots.