GRUB Legacy - ArchWiki
GRUB Legacy - ArchWiki
org/title/GRUB_Legacy
GRUB Legacy
GRUB Legacy (https://www.gnu.org/software/grub/grub-legacy.html) is a multiboot (https://w Related articles
ww.gnu.org/software/grub/manual/multiboot/) boot loader previously maintained by the GNU
Project. It was derived from GRUB, the GRand Unified Bootloader, which was originally designed Arch boot process
and implemented by Erich Stefan Boleyn. General
troubleshooting#Boot
Briefly, the boot loader is the first software program that runs when a computer starts. It is problems
responsible for loading and transferring control to the Linux kernel. The kernel, in turn, Kernel parameters
initializes the rest of the operating system.
Warning: GRUB Legacy is no longer maintained upstream and is not officially supported in Arch (see the news here (https://arch
linux.org/news/grub-legacy-no-longer-supported/)). Users are recommended to switch to GRUB2 or Syslinux instead. See
#Upgrading to GRUB2.
Note: GRUB legacy does not support GPT disks, Btrfs filesystem and UEFI firmwares.
Warning: File systems can have new features not supported by GRUB Legacy, making them unsuitable for /boot unless
disabling incompatible features. This can be typically worked around by using a separate /boot partition with a universally
supported file system such as FAT32.
2 Installation
GRUB Legacy can be installed from the grub-legacy (https://aur.archlinux.org/packages/grub-legacy/)AUR package.
Additionally, GRUB must be installed to the boot sector of a drive or partition to serve as a boot loader. This is covered in #Boot
loader installation.
3 Upgrading to GRUB2
However, as any other packages which are not supported anymore, bugs are unlikely to be fixed. So you should consider upgrading
to GRUB version 2.x, or one of the other supported Boot loaders.
3.3 Differences
▪ There are differences in the commands of GRUB Legacy and GRUB. Familiarize yourself with GRUB commands (https://www.gn
u.org/software/grub/manual/grub.html#Commands) before proceeding (e.g. "find" has been replaced with "search").
▪ GRUB is now modular and no longer requires "stage 1.5". As a result, the boot loader itself is limited -- modules are loaded from
the hard drive as needed to expand functionality (e.g. for LVM or RAID support).
▪ Device naming has changed between GRUB Legacy and GRUB. Partitions are numbered from 1 instead of 0 while drives are still
numbered from 0, and prefixed with partition-table type. For example, /dev/sda1 would be referred to as (hd0,msdos1) (for
MBR) or (hd0,gpt1) (for GPT).
▪ GRUB is noticeably bigger than GRUB legacy (occupies ~13 MB in /boot ). If you are booting from a separate /boot partition,
and this partition is smaller than 32 MB, you will run into disk space issues, and pacman will refuse to install new kernels.
# mv /boot/grub /boot/grub-legacy
1 of 11 2/14/25, 11:54 AM
GRUB Legacy - ArchWiki https://wiki.archlinux.org/title/GRUB_Legacy
Backup the MBR which contains the boot code and partition table (replace /dev/sdX with your actual disk path):
Only 446 bytes of the MBR contain boot code, the next 64 contain the partition table. If you do not want to overwrite your partition
table when restoring, it is strongly advised to backup only the MBR boot code:
Note: This option works only on BIOS systems, not on UEFI systems.
For example:
/boot/grub/menu.lst
default=0
timeout=5
/boot/grub/grub.cfg
If you forgot to create a GRUB /boot/grub/grub.cfg configuration file and simply rebooted into GRUB Command Shell, type:
Boot into Arch and re-create the proper GRUB /boot/grub/grub.cfg configuration file.
# mv /boot/grub /boot/grub.nonfunctional
Warning: This command also restores the partition table, so be careful of overwriting a modified partition table with the old one.
It will mess up your system.
2 of 11 2/14/25, 11:54 AM
GRUB Legacy - ArchWiki https://wiki.archlinux.org/title/GRUB_Legacy
4 Configuration
The configuration file is located at /boot/grub/menu.lst . Edit this file to suit your needs.
▪ timeout # -- time to wait (in seconds) before the default operating system is automatically loaded.
▪ default # -- the default boot entry that is chosen when the timeout has expired.
An example configuration (with /boot on a separate partition) is provided with the package (https://aur.archlinux.org/cgit/au
r.git/tree/menu.lst?h=grub-legacy).
Note: GRUB defines storage devices differently than conventional kernel naming does.
▪ Hard disks are defined as (hdX); this also refers to any USB storage devices.
▪ Device and partitioning numbering begin at zero. For example, the first hard disk recognized in the BIOS will be defined as (hd0).
The second device will be called (hd1). This also applies to partitions. So, the second partition on the first hard disk will be
defined as (hd0,1).
If you are unaware of the location of /boot , use the GRUB shell find command to locate the GRUB files. Enter the GRUB shell as
root by:
# grub
The following example is for systems without a separate /boot partition, wherein /boot is merely a directory under / :
GRUB will find the file, and output the location of the stage1 file. For example:
(hd0,0)
This value should be entered on the root line in your configuration file. Type quit to exit the shell.
/boot/grub/menu.lst
title Windows
rootnoverify (hd0,0)
makeactive
chainloader +1
Note:
▪ If you are attempting to dual-boot with Windows 7, you should comment out the line makeactive .
▪ Windows 2000 and later versions do NOT need to be on the first partition to boot (contrary to popular belief). If the Windows
partition changes (i.e. if you add a partition before the Windows partition), you will need to edit the Windows boot.ini file to
reflect the change (see this article (https://vlaurie.com/computers2/Articles/bootini.htm)[dead link 2024-07-30 ⓘ] for details
on how to do that).
If Windows is located on another hard disk, the map command must be used. This will make your Windows install think it is
actually on the first drive. Assuming that your Windows partition is on the first partition of the second drive:
/boot/grub/menu.lst
title Windows
map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd1,0)
3 of 11 2/14/25, 11:54 AM
GRUB Legacy - ArchWiki https://wiki.archlinux.org/title/GRUB_Legacy
makeactive
chainloader +1
/boot/grub/menu.lst
Note: There may be other options that are required, and an initial RAM disk may not be used. Examine the other distribution's
/boot/grub/menu.lst to match boot options, or see #chainloader and configfile (recommended).
▪ The chainloader command will load another boot loader (rather than a kernel image); useful if another boot loader is installed
in a partition's boot sector (GRUB, for example). This allows one to install a "main" instance of GRUB to the MBR and distribution-
specific instances of GRUB to each partition boot record (PBR).
▪ The configfile command will instruct the currently running GRUB instance to load the specified configuration file. This can be
used to load another distribution's menu.lst without a separate GRUB installation. The caveat of this approach is that other
menu.lst may not be compatible with the installed version of GRUB; some distributions heavily patch their versions of GRUB.
For example, GRUB is to be installed to the MBR and some other boot loader (be it GRUB or LILO) is already installed to the boot
sector of (hd0,2) .
---------------------------------------------
| | | | % |
| M | | | B % |
| B | (hd0,0) | (hd0,1) | L % (hd0,2) |
| R | | | % |
| | | | % |
---------------------------------------------
| ^
| chainloading |
-----------------------------
The chainloader command can also be used to load the MBR of a second drive:
/boot/grub/menu.lst
Selecting this entry at boot will load the other distribution's GRUB2 menu assuming that the distribution is installed on /dev/sda3
.
4 of 11 2/14/25, 11:54 AM
GRUB Legacy - ArchWiki https://wiki.archlinux.org/title/GRUB_Legacy
# cp -a /usr/lib/grub/i386-pc/* /boot/grub
Note: Do not forget to mount the system's boot partition if your setup uses a separate one! The above assumes that either the boot
partition resides on the root filesystem or is mounted to /boot on the root file system!
▪ Be sure that your GRUB configuration is correct ( /boot/grub/menu.lst ) before proceeding. Refer to Finding GRUB's root to
ensure your devices are defined correctly.
▪ GRUB must be installed on the MBR (first sector of the hard disk), or the first partition of the first storage device to be recognized
by most BIOSes. To allow individual distributions the ability to manage their own GRUB menus, multiple instances of GRUB can be
used, see #chainloader and configfile.
▪ Installing GRUB may need to be done from within a chroot ed environment (i.e. from installed environment via a separate
medium) for cases like RAID configurations or if you forgot/broke your GRUB installation. You will need to Change root from a
LiveCD or another Linux installation to do so.
First, enter the GRUB shell:
# grub
Use the root command with the output from the find command (see #Finding GRUB's root) to instruct GRUB which partition
contains stage1 (and therefore, /boot ):
Tip: The GRUB shell also supports tab-completion. If you type 'root (hd' then press Tab twice you will see the available storage
devices, this can also be done for partitions. Tab-completion also works from the GRUB boot menu. If there is an error in your
configuration file you can edit in the boot menu and use tab-completion to help find devices and partitions. See #Edit GRUB
entries in the boot menu.
After running setup , enter quit to exit the shell. If you chrooted, exit your chroot and unmount partitions. Now reboot to test.
5 of 11 2/14/25, 11:54 AM
GRUB Legacy - ArchWiki https://wiki.archlinux.org/title/GRUB_Legacy
Note: This procedure is known to be less reliable, the recommended method is to use the GRUB shell.
Use the grub-install command followed by the location to install the boot loader. For example to install GRUB to the MBR of the
first drive:
# grub-install /dev/sda
GRUB will indicate whether it successfully installs. If it does not, you will have to use the GRUB shell method.
On Wikipedia, there is a list of extended framebuffer resolutions (i.e. beyond the ones in the VBE standard).
If the desired resolution does not work with the codes obtained from the table, it usually is because the graphics card
manufacturers are free to choose any number they wish, as this is not part of the VBE 3 standard. These codes may change from
one card to the other (possibly even for the same manufacturer).
Instead of using that table, use one of the tools mentioned below to get the correct code:
On the kernel line, specify that the kernel should ask you which mode to use.
Now reboot. GRUB will now present a list of suitable codes to use and the option to scan for even more.
You can pick the code you would like to use (do not forget it, it is needed for the next step) and boot using it.
Now replace ask in the kernel line with the correct one you have picked.
6.1.2 hwinfo
1. Install the hwinfo (https://archlinux.org/packages/?name=hwinfo) package.
2. Run hwinfo --framebuffer as root.
3. Pick up the code corresponding to the desired resolution.
4. Use the 6 digit code with 0x prefix in vga= kernel option in menu.lst . Or convert it to decimal to avoid the use of 0x prefix.
Example output of hwinfo:
6.2.1 By Label
If you alter (or plan to alter) partition sizes from time to time, you might want to consider defining your drive/partitions by a label.
You can label ext2, ext3, ext4 partitions by:
The label name can be up to 16 characters long but cannot have spaces for GRUB to understand it. Then define it in your menu.lst
:
6 of 11 2/14/25, 11:54 AM
GRUB Legacy - ArchWiki https://wiki.archlinux.org/title/GRUB_Legacy
6.2.2 By UUID
The UUID (Universally Unique IDentifier) of a partition may be discovered with blkid or ls -l /dev/disk/by-uuid . It is
defined in menu.lst with either:
or:
This will start in single-user mode (init 1), i.e. you will end up to a root prompt without being asked for password. This may be
useful for recovery features, like resetting the root password. However, this is a huge security flaw if you have not set any
#Password protection for grub.
First, choose a password you can remember and then encrypt it:
# grub-md5-crypt
Password:
Retype password:
$1$ZOGor$GABXUQ/hnzns/d5JYqqjw
Then add your password to the beginning of the GRUB configuration file at /boot/grub/menu.lst (the password must be at the
beginning of the configuration file for GRUB to be able to recognize it):
# general configuration
timeout 5
default 0
color light-blue/black light-cyan/blue
Note: Remember that Grub uses the standard QWERTY layout for input.
Then for each operating system you wish to protect, add the lock command:
Warning: If you disable booting from other boot devices (like a CD drive) in the BIOS's settings and then password protect all
your operating system entries, it could be difficult to re-enable booting back into the operating systems if the password is
forgotten.
It is always possible to reset your BIOS settings by setting the appropriate jumper on the motherboard (see your motherboard's
manual, as it is specific to every model). So in case other have access to the hardware, there is basically no way to prevent boot
breakthroughs.
/boot/grub/menu.lst
7 of 11 2/14/25, 11:54 AM
GRUB Legacy - ArchWiki https://wiki.archlinux.org/title/GRUB_Legacy
# general configuration:
timeout 10
default 0
color light-blue/black light-cyan/blue
# (0) Arch
title Arch Linux
root (hd0,1)
kernel /boot/vmlinuz-linux root=/dev/disk/by-label/ARCH ro
initrd /boot/initramfs-linux.img
# (1) Windows
title Windows XP
rootnoverify (hd0,0)
makeactive
chainloader +1
Arch is the default (0). We want to restart in to Windows. Change default 0 to default saved -- this will record the current
default in a default file in the GRUB directory whenever the savedefault command is used. Now add the line savedefault 0
to the bottom of the Windows entry. Whenever Windows is booted, it will reset the default to Arch, thus making changing the
default to Windows temporary.
Now all that is needed is a way to easily change the default manually. This can be accomplished using the command
grub-set-default . So, to reboot into Windows, enter the following commands:
# grub-set-default 1
Then reboot.
For ease of use, you might to wish to setup sudo and add /sbin/grub-set-default amongst the commands the user is allowed
to issue without supplying a password.
Note: Removing lilo (https://aur.archlinux.org/packages/lilo/)AUR will not remove LILO from the MBR if it has been
installed there; it will merely remove the lilo (https://aur.archlinux.org/packages/lilo/)AUR package. LILO installed
to the MBR will be overwritten when GRUB (or another boot loader) is installed over it.
# fdformat /dev/fd0
# mke2fs /dev/fd0
# cp /boot/grub/menu.lst /mnt/fl/boot/grub/menu.lst
# umount /mnt/fl
Now you should be able to restart your computer with the disk in the drive and it should boot to GRUB. Make sure that your floppy
disk is set to have higher priority than your hard drive when booting in your BIOS first, of course.
8 of 11 2/14/25, 11:54 AM
GRUB Legacy - ArchWiki https://wiki.archlinux.org/title/GRUB_Legacy
hiddenmenu
7 Troubleshooting
The first check to do is to unplug any external drive. Seems obvious, but sometimes we get tired ;)
If your partition table gets messed up, an unpleasant "GRUB error 17" message might be the only thing that greets you on your next
reboot. There are a number of reasons why the partition table could get messed up. Commonly, users who manipulate their
partitions with GParted -- particularly logical drives -- can cause the order of the partitions to change. For example, you delete
/dev/sda6 and resize /dev/sda7 , then finally re-create what used to be /dev/sda6 only now it appears at the bottom of the
list, /dev/sda9 for example. Although the physical order of the partitions/logical drives has not changed, the order in which they
are recognized has changed.
Fixing the partition table is easy. Boot from your Arch CD/DVD/USB, login as root and fix the partition table:
# fdisk /dev/sda
Once in disk, enter e[x]tra/expert mode, [f]ix the partition order, then [w]rite the table and exit.
You can verify that the partition table was indeed fixed by issuing an fdisk -l . Now you just need to fix GRUB. See #Boot loader
installation.
Basically you need to tell GRUB the correct location of your /boot then re-write GRUB to the MBR on the disk.
For example:
# grub
# fdisk -l /dev/sda
This will show you the partition table for /dev/sda . So check here, whether the "Id" values of your partitions are correct. The
"System" column will show you the description of the "Id" values.
If your boot partition is marked as being "HPFS/NTFS", for example, then you have to change it to "Linux". To do this, go to fdisk,
# fdisk /dev/sda
change a partition's system id with t , select you partition number and type in the new system id (Linux = 83). You can also list all
available system ids by typing L instead of a system id.
If you have changed a partitions system id, you should [v]erify your partition table and then [w]rite it.
To fix this you will need to use the Windows Recovery Console for your Windows release. Because many computer manufacturers
do not include this with their product (many choose to use a recovery partition) Microsoft has made them available for download. If
you use XP, look at this page (https://web.archive.org/web/20120218152530/http://tips.vlaurie.com/2006/05/recovery-console-fo
r-those-without-an-xp-disk/) to be able to turn the floppy disks to a Recovery CD. Boot the Recovery CD (or enable Windows
Recovery mode) and run fixboot to repair the partition boot sector. After this, you will have to install GRUB again---this time, to
9 of 11 2/14/25, 11:54 AM
GRUB Legacy - ArchWiki https://wiki.archlinux.org/title/GRUB_Legacy
See Dual boot with Windows#Restoring a Windows boot record for more information.
to force GRUB to recheck the device map, even if it already exists. This may be necessary after resizing partitions or adding/
removing drives.
default saved
in /boot/grub/menu.lst .
7.7 GRUB fails to find or install to any virtio /dev/vd* or other non-BIOS devices
I had trouble installing GRUB while installing Arch Linux in an virtual KVM machine using a virtio device for hard drive. To install
GRUB, I figured out the following: Enter a virtual console by typing Ctrl+Alt+F2 or any other F-key for a free virtual console. This
assumes that your root file system is mounted in the folder /mnt and the boot file system is either mounted or stored in the folder
/mnt/boot .
1. Assure that all needed GRUB files is present in your boot directory (assuming it is mounted in /mnt/boot folder), by issuing the
command:
# ls /mnt/boot/grub
2. If the /mnt/boot/grub folder already contains all the needed files, jump to step 3. Otherwise, do the following commands
(replacing /mnt , your_kernel and your_initrd with the real paths and file names). You should also have the menu.lst file
written to this folder:
# grub --device-map=/dev/null
4. Enter the following commands. Replace /dev/vda , and (hd0,0) with the correct device and partition corresponding to your
setup.
5. If GRUB reports no error messages, then you probably are done. You also need to add appropriate modules to the ramdisk. For
more information, please refer to QEMU#Preparing an Arch Linux guest.
8 See also
▪ GNU GRUB (https://www.gnu.org/software/grub/)
▪ GRUB Grotto (https://www.troubleshooters.com/linux/grub/index.htm)
▪ Boot debugging - Debugging with GRUB, set module values
▪ Boot with GRUB (https://www.linuxjournal.com/article/4622) legacy
10 of 11 2/14/25, 11:54 AM
GRUB Legacy - ArchWiki https://wiki.archlinux.org/title/GRUB_Legacy
11 of 11 2/14/25, 11:54 AM