<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.linuxquestions.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nxja</id>
	<title>LQWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.linuxquestions.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nxja"/>
	<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/wiki/Special:Contributions/Nxja"/>
	<updated>2026-04-15T12:54:26Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.0</generator>
	<entry>
		<id>https://wiki.linuxquestions.org/index.php?title=Grub_version_1&amp;diff=53598</id>
		<title>Grub version 1</title>
		<link rel="alternate" type="text/html" href="https://wiki.linuxquestions.org/index.php?title=Grub_version_1&amp;diff=53598"/>
		<updated>2010-07-30T21:50:23Z</updated>

		<summary type="html">&lt;p&gt;Nxja: typo fixed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''GRUB''' (short for '''GR'''and '''U'''nified '''B'''oot Loader) is a [[boot loader]], similar in overall function to [[LILO]]. It is the standard way to boot into an [http://en.wikipedia.org/wiki/Operating_system operating system] (or several) used by most recent [[Linux]] [[distributions]], but capable of being loaded on any Linux distro.&lt;br /&gt;
&lt;br /&gt;
GRUB may have advantages over your current bootloader, but it's your choice.&lt;br /&gt;
* You can change your boot menu entries by editing a text file. While LILO requires the text file to be amended and the need to re-run /sbin/lilo.&lt;br /&gt;
* You can &amp;quot;test&amp;quot; your boot menu entries in an interpreted environment. This may prevent some minor changes that renders the system unbootable.&lt;br /&gt;
* Grub boot floppies can use a kernel size of 1423 Kb and an [[initrd]] of 1423 Kb using 3 floppies to boot.&lt;br /&gt;
* Grub-0.97 is compatible with LDM and can boot firmware raid compatible with dmraid, including raid-0&lt;br /&gt;
&lt;br /&gt;
== GRUB boot menu ==&lt;br /&gt;
The default location is in ''/boot/grub/menu.lst''. The .lst suffix stands for menu list, not menu first. The file contains configuration options (like [http://grub.enbug.org/ChangeDefaultBootEntry default boot entry,] (''grub.enbug.org'') color, timeout and password settings) and a list of menu entries. The file is often managed by some tool from the [[distribution]] itself, so when kernels are installed or removed the boot menu list gets automatically updated. Another common location is ''/etc/grub.conf'' but this is often a link file to the ''/boot/grub'' file.&lt;br /&gt;
&lt;br /&gt;
=== Manual configuration ===&lt;br /&gt;
To configure grub, [[find out your distribution]]. SUSE uses /boot/grub/menu.lst, Red Hat and Ubuntu use /boot/grub/grub.cfg.&lt;br /&gt;
Full documentation of the format of the file can be found in the GRUB [[info]] pages. But for a quick start, here are a couple of example entries to get you going.&lt;br /&gt;
&lt;br /&gt;
Basic entry to boot a linux kernel located on the first disk:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
title Linux kernel 2.6.4 &lt;br /&gt;
      root (hd0,0) &lt;br /&gt;
      kernel /boot/vmlinuz-2.6.4 root=/dev/hda1 ro 3&lt;br /&gt;
      initrd /boot/initrd.img &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;title&amp;lt;/tt&amp;gt; denotes the selectable boot-menu title; &lt;br /&gt;
* &amp;lt;tt&amp;gt;root (hd0,0)&amp;lt;/tt&amp;gt; says [[/boot]] [[partition]] is on the first partition first drive or that the SUB-folder /boot to the / partition refers to same structure;&lt;br /&gt;
* &amp;lt;tt&amp;gt;kernel&amp;lt;/tt&amp;gt; tells grub where to find the linux [[kernel]]. The &amp;quot;root&amp;quot; mentioned after vmlinuz refers to the / entry in your [[fstab|/etc/fstab]] file. Kernel parameters such as desired [[runlevel]] (3) may be presented at the end of the kernel-line; &lt;br /&gt;
* &amp;lt;tt&amp;gt;[[initrd]]&amp;lt;/tt&amp;gt; describes the use and location of a preconfigured [[ramdisk]].&lt;br /&gt;
&lt;br /&gt;
Note that grub starts counting disks from 0, while skipping other [[IDE]] devices. Thus &lt;br /&gt;
&amp;lt;tt&amp;gt;/dev/hda1=(hd0,0)&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/dev/hdc1=(hd1,0)&amp;lt;/tt&amp;gt; when a [[cdrom]]-drive is attached as [[slave]] on the first IDE-channel. When adding drives to an existing configuration, &amp;lt;tt&amp;gt;drives.map&amp;lt;/tt&amp;gt; may need to be refreshed from within grub, especially when more than one drive/partition is bootable.&lt;br /&gt;
&lt;br /&gt;
=== Debian ===&lt;br /&gt;
[[Debian]] manages the menu file with ''update-grub.'' This script checks which kernels are located in /boot/ and generates a menu entry for them. It adds its own configuration options to the menu.lst file. These concern the options that are given to the generated menu entries. Usually, update-grub is automatically run after kernel packages have been installed or removed (at least it's the default configuration for the sarge/testing disribution). If not, update-grub can be added as a postinst_hook and a postrm_hook in the ''/etc/kernel-img.conf'' file.&lt;br /&gt;
&lt;br /&gt;
=== Red Hat ===&lt;br /&gt;
[[Red Hat]] also manages the menu.lst file itself. It should be updated automatically when a kernel rpm is installed or removed&lt;br /&gt;
&lt;br /&gt;
=== SuSE ===&lt;br /&gt;
[[SuSE]] manages the menu.lst of GRUB using [[YAST]].&lt;br /&gt;
&lt;br /&gt;
=== Booting Windows/DOS ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
title Win &lt;br /&gt;
rootnoverify (hd0,0) &lt;br /&gt;
makeactive &lt;br /&gt;
chainloader +1 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you where to have dual-booting with [[Linux]] on the first disk and Windows on the 2nd or some other disk you will run into a common trouble:  WARNING [[Windows]] only wants to boot from partitions on first disk in the system. But GRUB can trick Windows with the ''map'' command, an example entry to correct this problem would look like:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
title Win&lt;br /&gt;
rootnoverify (hd1,0)&lt;br /&gt;
map (hd0) (hd1)&lt;br /&gt;
map (hd1) (hd0)&lt;br /&gt;
makeactive&lt;br /&gt;
chainloader +1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Shutdown the machine from the menu ===&lt;br /&gt;
Another menu entry that can be handy is one to shutdown the machine:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
title Halt!&lt;br /&gt;
halt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using a Splash Image ===&lt;br /&gt;
&lt;br /&gt;
You can make grub display a nice looking splash image at the menu screen.  See http://ruslug.rutgers.edu/~mcgrof/grub-images/&lt;br /&gt;
&lt;br /&gt;
=== Removing obsolete kernels ===&lt;br /&gt;
&lt;br /&gt;
To remove obsolete kernel entries from your boot menu, it is enough to uninstall the old kernels like this:&lt;br /&gt;
 [[rpm]] -e kernel-default-2.6.25.18-0.2&lt;br /&gt;
&lt;br /&gt;
== Installing the GRUB bootloader ==&lt;br /&gt;
There are some cases when you want to install a bootloader to your disk:&lt;br /&gt;
* you are [[installing Linux on a USB disk]]&lt;br /&gt;
* your [[hard disk]] bootsector has been corrupted&lt;br /&gt;
&lt;br /&gt;
To install a GRUB bootloader to your harddisk (we take ''/dev/sda'' as an example here), issue&lt;br /&gt;
 grub-install ''/dev/sda''&lt;br /&gt;
GRUB will be installed then and use the file /boot/grub/menu.lst as boot menu.&lt;br /&gt;
&lt;br /&gt;
== Errors and solutions ==&lt;br /&gt;
=== Error 18 ===&lt;br /&gt;
'''''Error 18''': Selected cylinder exceeds maximum supported by BIOS''&lt;br /&gt;
 &lt;br /&gt;
This error is returned when a read is attempted at a linear block address beyond the end of the BIOS translated area. This generally happens if your disk is larger than the BIOS can handle (512MB for (E)IDE disks on older machines or larger than 8GB on others.). &lt;br /&gt;
In more practical terms this means the BIOS is unable to start executing the kernel because the kernel is not located within the block it can access at boot up time.&lt;br /&gt;
&lt;br /&gt;
This can be circumvented by creating a boot partition at the beginning of the disk that is completely within the first 1023 cylinders of the harddrive. This partition will contain the kernel. &lt;br /&gt;
&amp;lt;p&amp;gt;The kernel itself does not suffer from the same limitations as the BIOS so after the BIOS has loaded the kernel the kernel will have no problem accessing the whole harddrive.&lt;br /&gt;
&lt;br /&gt;
Newer BIOSes will automatically translate the harddrives size in a way that it can be completely contained within the first 1023 cylinders and hence modern computers do not suffer from this problem.&lt;br /&gt;
&amp;lt;br&amp;gt;The same error can happen when the BIOS detects a disk in a different way as Linux does. This can happen when changing motherboards or when moving a GRUB-bootable disk from one computer to another.&lt;br /&gt;
 If this happens, just boot with a GRUB floppy, read the C/H/S numbers from the existing partition table and manually edit the BIOS numbers to match.&lt;br /&gt;
&lt;br /&gt;
If using a SUSE linux and installing on VM Ware this problem is solved by creating a small partition at the very beginning of the harddisc, and mounting it as /boot.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Error 18 on Dual Boot Systems Using a Single Hard Drive ====&lt;br /&gt;
This error often occurs when creating a dual boot system (with Windows) on a single hard disk drive, as in a notebook PC, because the Linux partitions end up being beyond the LBA range. On a large notebook drive you may need to re-install Windows into a smaller primary partition (or resize the partition), then create an extended partition in the unallocated space and create partitions for Linux Root, Linux Swap, and Linux Home, then in the remaining unallocated space create another NTFS partition for Windows. In other words, the Linux partitions must be immediately after the Primary Windows partition so they are still within the LBA range, then you can place additional NTFS or FAT32 partitions after the Linux partitions.&lt;br /&gt;
&lt;br /&gt;
On a 160GB notebook drive, the following gave Error 18:&lt;br /&gt;
&lt;br /&gt;
Primary: 80GB Windows NTFS&lt;br /&gt;
&lt;br /&gt;
Extended: 4GB (FAT32), 50GB (NTFS), 4GB Linux Root (ext3), 2GB Linux Swap, 20GB Linux home (ext3).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following worked:&lt;br /&gt;
&lt;br /&gt;
Primary: 80GB Windows NTFS&lt;br /&gt;
&lt;br /&gt;
Extended: 4GB Linux Root (ext3), 2GB Linux Swap, 20GB Linux home (ext3), 4GB (FAT32), 50GB (NTFS).&lt;br /&gt;
&lt;br /&gt;
It can be somewhat of an annoyance to have the NTFS file system split into two partitions, but it's a workaround.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[Note: the reason for the 4GB FAT 32 partition is that it makes it possible for both Windows and Linux to access that partition, which can be useful when transferring files between the two operating systems.]&lt;br /&gt;
&lt;br /&gt;
==== Removing GRUB After Error 18 on a Dual Boot System (Windows/Linux) Using a Single Hard Drive ==== &lt;br /&gt;
If you install GRUB on a dual boot system with a single hard drive, and get Error 18, you will not be able to boot Windows. To fix this, you need to boot the system from a Windows Recovery CD, select &amp;quot;R&amp;quot; for Repair, and then run &amp;quot;fixmbr&amp;quot; (fix master boot record) at the DOS prompt in C:\windows. This will remove GRUB. If you don't have a recovery CD, you can download floppies from Microsoft for XP, see &amp;quot;http://support.microsoft.com/kb/310994&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Error 21 ===&lt;br /&gt;
'''''Error 21''''': Unknown boot failure&lt;br /&gt;
&lt;br /&gt;
==== Symptom ====&lt;br /&gt;
When booting, you get line saying&lt;br /&gt;
 Error 21&lt;br /&gt;
then the system stops.&lt;br /&gt;
&lt;br /&gt;
==== Reason 1 ====&lt;br /&gt;
This error can have at least one reason: an incorrect device list handed over to grub's ''setup'' command. &lt;br /&gt;
&lt;br /&gt;
==== Solution 1 ====&lt;br /&gt;
To resolve this error, use grub-install and watch its output thoroughly:&lt;br /&gt;
 tweedleburg:~ # grub-install /dev/sda&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
     GNU GRUB  version 0.97  (640K lower / 3072K upper memory)&lt;br /&gt;
 &lt;br /&gt;
  [ Minimal BASH-like line editing is supported.  For the first word, TAB&lt;br /&gt;
    lists possible command completions.  Anywhere else TAB lists the possible&lt;br /&gt;
    completions of a device/filename. ]&lt;br /&gt;
 '''grub&amp;gt; setup --stage2=/boot/grub/stage2 (hd0,0) (hd0,0)'''&lt;br /&gt;
  Checking if &amp;quot;/boot/grub/stage1&amp;quot; exists... yes&lt;br /&gt;
  Checking if &amp;quot;/boot/grub/stage2&amp;quot; exists... yes&lt;br /&gt;
  Checking if &amp;quot;/boot/grub/e2fs_stage1_5&amp;quot; exists... yes&lt;br /&gt;
  Running &amp;quot;embed /boot/grub/e2fs_stage1_5 (hd0,0)&amp;quot;... failed (this is not fatal)&lt;br /&gt;
  Running &amp;quot;embed /boot/grub/e2fs_stage1_5 (hd0,0)&amp;quot;... failed (this is not fatal)&lt;br /&gt;
  Running &amp;quot;install --stage2=/boot/grub/stage2 /boot/grub/stage1 (hd0,0) /boot/grub/stage2 p/boot/grub/menu.lst &amp;quot;... succeeded&lt;br /&gt;
 Done.&lt;br /&gt;
 grub&amp;gt; quit&lt;br /&gt;
 tweedleburg:~ #&lt;br /&gt;
Now watch the highlighted line. If you run into grub error 21, check that there are no non-existant [[device]]s. If there are, you may have found the issue. In this case, call&lt;br /&gt;
 grub&lt;br /&gt;
and issue the correct setup command in its [[shell]].&lt;br /&gt;
&lt;br /&gt;
==== Reason 2 ====&lt;br /&gt;
Your bootloader tries to load /boot/grub/menu.lst from a [[hard disk]] that no longer exists. For example, this can happen if you installed Linux for [[booting from USB]], you removed the USB disk, and the [[MBR]] has been changed.&lt;br /&gt;
&lt;br /&gt;
==== Solution 2 ====&lt;br /&gt;
Re-attach the missing disk, re-run grub-install.&lt;br /&gt;
&lt;br /&gt;
==== Reason 3 ====&lt;br /&gt;
Your initrd is broken. Call grub and test it like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)&lt;br /&gt;
&lt;br /&gt;
 [ Minimal BASH-like line editing is supported.  For the first word, TAB&lt;br /&gt;
   lists possible command completions.  Anywhere else TAB lists the possible&lt;br /&gt;
   completions of a device/filename. ]&lt;br /&gt;
&lt;br /&gt;
grub&amp;gt; root (hd0,0)&lt;br /&gt;
 Filesystem type is ext2fs, partition type 0x83&lt;br /&gt;
&lt;br /&gt;
grub&amp;gt; kernel /boot/vmlinuz&lt;br /&gt;
   [Linux-bzImage, setup=0x3000, size=0x1ffb98]&lt;br /&gt;
&lt;br /&gt;
grub&amp;gt; initrd /boot/initrd&lt;br /&gt;
&lt;br /&gt;
Error 16: Inconsistent filesystem structure&lt;br /&gt;
&lt;br /&gt;
grub&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== GRUB - nothing else ===&lt;br /&gt;
* When booting from USB, you get a line saying &lt;br /&gt;
 GRUB&lt;br /&gt;
nothing else.&lt;br /&gt;
: This can be a problem with your device map. Keep in mind that, when booting from USB, your USB disk corresponds to (hd0), the first harddisk. grub-install will tell you where its device map is - try correcting it.&lt;br /&gt;
&lt;br /&gt;
=== Invalid or damaged bootable partition ===&lt;br /&gt;
==== Symptom ====&lt;br /&gt;
When booting, you do not get a grub menu, but a message saying &lt;br /&gt;
 Invalid or damaged Bootable partition&lt;br /&gt;
&lt;br /&gt;
==== Reason ====&lt;br /&gt;
The reason can be that you installed grub to a partition that no longer exists. For example, you installed onto a disk that was the third in the [[device]] order and now another disk has been removed and grub can no longer access the &amp;quot;third&amp;quot; disk. You must know that the first disk is called hd(0), the second hd(1) and the third hd(2). When trying to re-install grub, you would see&lt;br /&gt;
 tweedleburg:/boot/grub&amp;gt; grub-install --recheck /dev/sdc&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
     GNU GRUB  version 0.97  (640K lower / 3072K upper memory)&lt;br /&gt;
 &lt;br /&gt;
  [ Minimal BASH-like line editing is supported.  For the first word, TAB&lt;br /&gt;
    lists possible command completions.  Anywhere else TAB lists the possible&lt;br /&gt;
    completions of a device/filename. ]&lt;br /&gt;
 grub&amp;gt; setup --stage2=/boot/grub/stage2 --force-lba (hd0) (hd2,0)&lt;br /&gt;
 &lt;br /&gt;
 Error 21: Selected disk does not exist&lt;br /&gt;
 grub&amp;gt; quit&lt;br /&gt;
 tweedleburg:/boot/grub&amp;gt;&lt;br /&gt;
Where (hd2) does not exist.&lt;br /&gt;
In /etc/grub.conf you find&lt;br /&gt;
 setup --stage2=/boot/grub/stage2 (hd0,0) (hd2,0)&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
For an awesome resource for troubleshooting just about any Grub problem (on any [http://en.wikipedia.org/wiki/Operating_system OS]), see this thread on Gentoo's forums: [http://forums.gentoo.org/viewtopic.php?t=122656&amp;amp;highlight=grub+error+collection Gentoo Forums: Grub Error Collection]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Securing GRUB]]&lt;br /&gt;
* [[MBR]]&lt;br /&gt;
* [[GRUB Floppies to boot large kernels]]&lt;br /&gt;
* [[Booting]]&lt;br /&gt;
* [[Booting from USB]] - includes [[troubleshooting]] procedures&lt;br /&gt;
* [[BootProcess]]&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.gnu.org/software/grub/ Project website] (''www.gnu.org'')&lt;br /&gt;
* [http://www.gnu.org/software/grub/manual/html_node/ GRUB Manual] (''www.gnu.org'')&lt;br /&gt;
* [http://www.uruk.org/orig-grub/errors.html Grub error codes list]&lt;br /&gt;
* [http://grub.enbug.org/ Grub wiki] (''grub.enbug.org'')&lt;br /&gt;
* [http://tldp.org/HOWTO/Linux+Win9x+Grub-HOWTO/index.html Linux+Win+Grub HowTo] (''tldp.org'')&lt;br /&gt;
* [http://www.lyonlabs.org/booting.html Booting with GRUB] (''www.ameritech.net'')&lt;br /&gt;
* [http://grub4dos.sourceforge.net/ WinGRUB] (''grub4dos.sourceforge.net'')&lt;br /&gt;
* [http://www.geocities.com/lode_leroy/grubinstall/ GRUB Installer for Windows] (''www.geocities.com'')&lt;br /&gt;
&lt;br /&gt;
[[Category:Boot]]&lt;/div&gt;</summary>
		<author><name>Nxja</name></author>
	</entry>
</feed>