GRUB Command Line

This is how to use GRUB to find information that will allow you to boot. Grub From the Ground Up by Steve Litt has this and more information. Use either a GRUB floppy or GRUB on your MBR. Prior to the default boot taking place, type 'c' for 'command line'. This will give you the prompt for GRUB 'grub>'

  • First find partitions that are likely to have Linux on them:

grub> find /sbin/init

     (hd0,6)
     (hd0,10)

Two partitions have been found which are most likely /dev/hda6 and /dev/hda11. hd0 is not necessarily /dev/hda. That depends on how the system is mapped and whether your drives are IDE or SCSI.

  • Try to find a kernel on these drives:

grub> find (hd0,10)/vml

    grub> find (hd0,10)/boot/vml

Hit the TAB key after typing 'vml' and you will get an autocompletion along with a listing of the files beginning with 'vml'. I used (hd0,10) here, because I am pretty sure that what I'm interested in is the second partition listed. I had 3 kernels listed when I did the second command. There was nothing listed with the first command. Some systems will have the kernel in / rather than /boot; so the first command will produce results. Among my results was vmlinuz-2.6.8.

  • Check for initrd.img:

grub> find (hd0,10)/boot/init

Again use TAB to complete and you will get a listing of files beginning with init. Among the results was initrd.img-2.6.8.

  • Look at files if you need to with 'cat'. For example to see /etc/fstab or /boot/grub/device.map:

grub> cat (hd0,10)/etc/fstab

  grub> cat (hd0,10)/boot/grub/device.map
  • Boot using the info you have gathered:

grub> root (hd0,10)

  grub> kernel /boot/vmlinuz-2.6.8  root=/dev/hda11
  grub> initrd /boot/initrd.img-2.6.8
  grub> boot

You may or may not need initrd, but if you find it in /boot, use it. You may need to look at device.map to see what the device is that is mapped to hd0 (hd1 or whatever turns up as the place where Linux is located). That will determine what you put for root=/dev/… in the kernel command. Simply add 1 to the second number to get the partition: (hd0,10) becomes /dev/hda11, etc.

/home/www/LinuxBasics.org/data/pages/tutorials/advanced/grub_command_line.txt · Last modified: 2008/07/20 21:08 (external edit)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0