Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On a Debian Linux box, I'm running into a very strange situation where after power-on, GRUB fails with the error "no such partition", but if I then hit the reset button, it boots normally. I'm trying to diagnose the situation, and I realized that I don't know which versions of what bootloaders are installed where? How can I find out? That is, how can I find out what bootloader is installed on the MBR of each of my disks, and how can I find out which second-stage bootloaders are installed on the various partitions?

If I can't find out exactly what I have, I'd settle for being able to find out just which version of GRUB is installed where.

share|improve this question
    
Have you pressed the "Esc" key (to display Grub's boot menu) before the error message appears? –  sawdust Aug 25 '12 at 1:45
    
@sawdust we don't get as far as a menu. Just "Grub loading; Welcome to Grub;" and then the error. Normally I would expect a menu and then autoboot after a timeout of 10s. But I'm not getting that far. Hence the question about "how do I figure out what is there." Maybe my job is just to reinstall everything :-( –  Norman Ramsey Aug 25 '12 at 1:48

2 Answers 2

up vote 6 down vote accepted

You can see whether GRUB (1 or 2) is installed on the MBR with dd:

dd if=/dev/sda bs=512 count=1 2> /dev/null | grep -q GRUB && echo "GRUB found"

If GRUB signature was found you can then run:

file -s /dev/sda

If the output is something like:

/dev/sda: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3...........

then you have GRUB1 installed on the MBR. If there is no mention of Grub, like this:

/dev/sda: x86 boot sector; partition 1: ID=0x83, active, starthead 32, startsector 2048........

then you have GRUB2 installed on the MBR of that disk.

To find the essential GRUB files ("stages" for GRUB1, "images" for GRUB2):

GRUB1:

configuration file:

find / -name menu.lst

stages:

find / -name stage1

or

find / -name stage2

GRUB2:

configuration file:

find / -name grub.cfg

images:

find / -name core.img

or

find / -name boot.img
share|improve this answer
    
Absolutely brilliant. It seems file(1) has everything these days. –  Norman Ramsey Aug 25 '12 at 22:49

You can use http://bootinfoscript.sourceforge.net which gives you detailed information about your boot status and tells you which bootloader is installed where, combined with lots of detailed other information relevant to booting. It's available in debian as package boot-info-script.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.