April 23, 2019

Getting Some GRUB For Linux - page 4


  • April 26, 2004
  • By Carla Schroder
Once again, excellent readers come with useful stuff. A couple of readers wrote to clear up the confusion over root devices, and root filesystems. Here is a typical menu.lst entry:

title ����� Libranet GNU/Linux, kernel 2.4.21
root �����(hd0,5)
kernel �����/boot/vmlinuz-2.4.21 ro root=/dev/hda6

The root device is the location of the boot images: stage1 and stage2, the kernel, and other boot files. These are in the /boot directory. /dev/hda6, on the kernel line, is the path to the root filesystem. The root device is a GRUB argument, so it needs GRUB nomenclature. The root filesystem is a kernel argument, so it needs kernel nomenclature.

These are most commonly on the same filesystem. However, they do not have to be — you can have your /boot directory and root filesystem on different partitions. For example, if you have a separate boot partition.

Installing GRUB Without A Floppy Disk

An increasing number of systems are shipping without floppy drives, especially notebooks. How to install GRUB without a floppy drive? First, install or upgrade GRUB on your system. Then open a root shell, and open GRUB's command shell:
root@windbag:/# grub
Probing devices to guess BIOS drives. This may take a long time.

GNU GRUB version 0.94 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ]


Now run these three commands:

grub> root (hd0,0)
grub> setup (hd0)
grub> quit

Reboot, and you will be greeted by the GRUB command shell. Note that the root value is variable, depending on where GRUB is installed on your system. (See "The Dog Ate lilo.conf" in part 1 for how to find root devices from the GRUB command line.) setup (hd0) installs GRUB to the MBR (master boot record), and quit exits GRUB.

Restoring GRUB From A Knoppix CD

Having a GRUB floppy disk is the fastest way to fix boot problems. However, if you have no floppy drive, that doesn't really do you a lot of good. Fear not, for the endlessly useful Knoppix bootable Linux CD will take care of things. To restore GRUB to the MBR, boot up Knoppix and open a shell. Then su to root (there is no password), and run the same commands as above.

Most Popular LinuxPlanet Stories