Wikia

Debian Wiki

GRUB

Talk0
25pages on
this wiki

The GRUB boot loader is a piece of software that Debian can install to the master boot record. If you have both Debian and Windows on one machine, it will let you choose between the two.

FAQEdit

This is taken from the official GNU GRUB FAQ page.[1] It is under the GNU license and is thus free for redistribution.

I have questions about GRUB!Edit

First of all, read the document in the GRUB distribution enough carefully. You should be able to obtain most information from the document. This FAQ just gives you some hints.

Also, note that we don't accept bugs about unofficial versions, such as Red Hat's. Many versions distributed with GNU/Linux vendors are modified with their own patches, so not all bugs are reproducible in official versions. Thus, try the latest official version, before reporting bugs to us.

How does GNU GRUB differ from Erich's original GRUB?Edit

GNU GRUB is the successor of Erich's great GRUB. He couldn't work on GRUB because of some other tasks, so the current maintainer Gordon Matzigkeit took over the maintainership, and opened the development in order for everybody to participate it.

Technically speaking, GNU GRUB has many features that are not seen in the original GRUB. For example, GNU GRUB can be installed on UNIX-like operating system (i.e. GNU/Linux) via the grub shell /sbin/grub, it supports Logical Block Address (LBA) mode that solves the 1024 cylinders problem, and TAB completes a filename when it's unique. Of course, many bug fixes are done as well, so it is recommended to use GNU GRUB.

Can GRUB boot my operating system from over 8GB hard disks?Edit

That depends on your BIOS and your operating system. You must make sure that your drive is accessible in LBA mode. Generally, that is configurable in BIOS setting utility. Read the manual for your BIOS for more information.

Furthermore, some operating systems (i.e. DOS) cannot access any large disk, so the problem is not solved by any kind of boot loader. As long as I know, at least GNU/Hurd and GNU/Linux can boot from such a large disk.

Can I put Stage2 into a partition which is over 1024 cylinders?Edit

Yes, you can, if your BIOS supports LBA mode. Although you had to use a special Stage1 in the previous version, it isn't necessary any longer, because Stage1 now supports both modes.

How to create a GRUB boot floppy with the menu interface?Edit

  1. Create a filesystem in your floppy disk (e.g. mke2fs /dev/fd0).
  2. Mount the floppy on somewhere, say, /mnt.
  3. Copy the GRUB images to the directory /mnt/boot/grub. Only stage1, stage2 and menu.lst are necessary. You may not copy *stage1_5.
  4. Unmount the floppy.
  5. Run the following commands (note that the executable grub may reside in a different directory in your system, for example, /usr/sbin):

[quote]/sbin/grub --batch --device-map=/dev/null <<EOF device (fd0) /dev/fd0 root (fd0) setup (fd0) quit EOF[/quote]

How to specify a partition? That seems to be very different from the notation in my operating system...Edit

Yes, GRUB's device syntax is very different from others, but somewhat resembles DOS and Windows 98. GRUB doesn't distinguish between IDE and SCSI, so your hard disk drives are represented as (hd%d) (%d is an integer, counted from zero). Likewise, your floppy drives are represented as (fd%d).

The point that confuses the users very much is the partition numbering style. GRUB counts partitions from zero, while almost all operating systems count from one. We will fix the inconsistency someday.

GRUB does not recognize my GNU/Hurd partition.Edit

I don't know why, but the authors of FDISK programs have assigned the partition type 0x63 to GNU Hurd incorrectly. So use 0x83 if the partition contains ext2 filesystem, and use 0xA5 if the partition contains ffs filesystem, whether the partition owner is Hurd or not. We will use 0x63 for GNU Hurd filesystem that has not been implemented yet.

I've installed a recent version of binutils, but GRUB still crashes in the bootstrap.Edit

Please check for the version of your binutils by this command:

$ ld -v

This will show two versions, but only the latter is important. If the version is identical with what you have installed, the installation was not bad.

Well, please try:

$ gcc -Wl,-v 2>&1 | grep "GNU ld"

If this is not identical with the result above, you should specify the directory where you have installed binutils for the script configure, like this:

$ ./configure --with-binutils=/usr/local/bin

If you follow the instructions above but GRUB still crashes, probably there is a serious bug in GRUB. Please report it to the Bug Tracking System.

I can't compile GRUB on Red Hat 7.0.Edit

Have you seen this message? We never support any unreleased version of gcc.

How can I specify an arbitrary memory size to Linux?Edit

Pass a mem= option to your Linux kernel, like this:

grub> kernel /vmlinuz mem=128M

You may pass other options in the same way. See the documentation for Linux, for available options.

10. How to boot Windows (or DOS) from a non-first disk?Edit

Use the command map, to exchange BIOS drives virtually, like this:

grub> map (hd0) (hd1)
grub> map (hd1) (hd0)

11. I have a separate boot partition on GNU/Linux (or another UNIX-like system), and GRUB seems not to handle this situation correctly.Edit

This is often reported as a bug, but this is not a bug really. This is a feature.

Because GRUB is a boot loader and it normally runs under no operating system, it doesn't know where a partition is mounted under your operating systems. So, if you have the partition /boot and you install GRUB images into the directory /boot/grub, GRUB recognizes that the images lies under the directory /grub but not /boot/grub. That's fine, since there is no guarantee that all of your operating systems mount the same partition as /boot.

There are several solutions for this situation:

  1. Install GRUB into the directory /boot/boot/grub instead of /boot/grub. This may sound ugly but should work fine.
  2. Create a symbolic link before installing GRUB, like cd /boot && ln -s . boot. This works only if the filesystem of the boot partition supports symbolic links and GRUB supports the feature as well.
  3. Install GRUB with the command install, to specify the paths of GRUB images explicitly. Here is an example:
grub> root (hd0,1)
grub> install /grub/stage1 d (hd0) /grub/stage2 p /grub/menu.lst


How to uninstall GRUB from my hard disk drive?Edit

There is no concept uninstall in boot loaders, because if you uninstall a boot loader, an unbootable machine would simply remain. So all you need to do is overwrite another boot loader you like to your disk, that is, install the boot loader without uninstalling GRUB.

For example, if you want to install the boot loader for Windows, just run FDISK /MBR on Windows. If you want to install LILO (I can't imagine why you want to do such a thing, though), run /sbin/lilo on GNU/Linux.

GRUB hangs when accessing my large IDE disk.Edit

If your disk is bigger than 32GB, probably updating your mainboard BIOS will solve your problem. This bug is well-known and most vendors should provide fixed versions. For example, if you have ASUS-P3BF, upgrading the BIOS to V1007beta1 or later can fix it. Please ask your vendor, for more information.

GRUB hangs when accessing my SCSI disk.Edit

Check if you have turned on the support for INT 13 extension (LBA). If so, disable the support and see if GRUB can now access your SCSI disk. This will make it clear that your SCSI BIOS sucks.

For now, we know the following doesn't provide working LBA mode:

  • Adaptec AIC-7880

In the case where you have such a SCSI controller unfortunately, you cannot use the LBA mode, though GRUB still works fine in the CHS mode (so the well-known 1024 cylinders problem comes again to you).

I installed GRUB, but it just hangs up.Edit

There are many possibilities, but it is likely that there is something wrong in your device map file. Take a look at the file /boot/grub/device.map. The format is well-documented in the manual.

If there is something wrong, modify the file appropriately and re-run grub-install.

If you still have a problem or you don't know how you should modify it, it would be easier to install GRUB with a boot floppy rather than to stick to grub-install.

Why doesn't Linux (FreeBSD, NetBSD, etc.) become Multiboot-compliant?Edit

Please ask the maintainers. If all free kernels were Multiboot-compliant, the world would be an utopia...

Use with external mediaEdit

Some Debian users store Debian on external media, because of the risk of partitioning an internal one. In this case, you must ensure that the drive is connected and turned on when the computer is turned on, or GRUB will return an error.

LinksEdit

ReferencesEdit

  1. http://www.gnu.org/software/grub/grub-faq.html
Advertisement | Your ad here

Around Wikia's network

Random Wiki