LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   The file /boot/grub/stage1 not read correctly. (http://www.linuxquestions.org/questions/linux-general-1/the-file-boot-grub-stage1-not-read-correctly-419841/)

snowsquirrel 02-26-2006 04:25 PM

The file /boot/grub/stage1 not read correctly.
 
Distro Kubuntu.
somehow my mbr got borked. So I booted up knoppix, and did the following:
# mount /dev/hda1 /mnt/hda1
# mount /dev/hda2 mnt/hda1/var
# mount /dev/hda5 mnt/hda1/tmp
# chroot /mnt/hda1 bash
# grub-install /dev/hda

But I get this error message: The file /boot/grub/stage1 not read correctly.

Any ideas?

Thanks,

~S

jomen 02-26-2006 05:28 PM

assuming
/dev/hda1 is / including /boot and everything which belongs there (kernel-image, directory "grub" with grub's files and menu.lst)
/dev/hda2 contains everything from /var (it is mounted to /var)
/dev/hda5 contains everything from /tmp
Is the file /boot/grub/stage1 there?
if yes ->
it should go like this:
mount -t proc none /mnt/hda1/proc -> mount /proc to /mnt/hda1/proc - which is going to be /proc when chroot is done
mount -o bind /dev /mnt/hda1/dev -> mount the /dev directory to /mnt/hda1/dev - which is otherwise empty
chroot /mnt/hda1 /bin/bash
cp /proc/mounts /etc/mtab -> adjust the list of mounted filesystems - because it is needed for grub-install to find the right devices
grub-install /dev/hda

snowsquirrel 02-26-2006 05:41 PM

Everything you say makes sense now that I read it. But I still get the same error.

mount now gives:
Code:

rootfs on / type rootfs (rw)
/dev/root.old on / type ext2 (rw)
/proc on /proc type proc (rw)
/dev/pts on /dev/pts type devpts (rw)
/dev/scd0 on /cdrom type iso9660 (ro)
/dev/cloop on /KNOPPIX type iso9660 (ro)
/ramdisk on /ramdisk type tmpfs (rw)
/proc/bus/usb on /proc/bus/usb type usbdevfs (rw)
automount(pid863) on /mnt/auto type autofs (rw)
/dev/hda1 on / type ext3 (rw)
/dev/hda2 on /var type ext3 (rw)
/dev/hda5 on /tmp type ext2 (rw)
none on /proc type proc (rw)
/dev/root.old on /dev type ext2 (rw)

I still get "The file /boot/grub/stage1 not read correctly."

Upon further investigation:
Code:

# grub
grub >
  root (hd0,0)
Error 21: Selected disk does not exist

I notice in the output of 'mount' that I have '/' used as a mount point twice. Would this be my problem? I wonder if I can unmount '/' first? I doubt Knoppix would let me... hmmm. Maybe a different boot disk is in order....

Any thoughts jomen?

~S

jomen 02-26-2006 06:28 PM

instead of cp /proc/mounts /etc/mtab
do:
grep -v rootfs /proc/mounts > /etc/mtab
this will eliminate the line:
rootfs on / type rootfs (rw)
I don't think that this a problem though...
maybe this is:
Quote:

Is the file /boot/grub/stage1 there?
if yes ->
If it's not there - or anyway - because the error says so - reinstall grub
(however this is done in kubuntu - probably apt-get -install ?)

snowsquirrel 02-26-2006 07:39 PM

yes, of course I check that the file existed. Ok, breifly looking at the script '/sbin/grub-install' shows that it creates a log, then greps the log for errors. So I looked that the log. The error it is getting, is the same one I am getting, when I do "root (hd0,0)" --> "The selected disk does not exist". So once I fix this error, grub-install should work. (not that much of a suprise really). But atleast I know that the problem really isn't with /boot/grub/stage1, but with not being able to see /dev/hda, and that I should be googling for "The selected disk does not exist", instead of "stage1 not read properly." Talk about shoddy error reporting...

It is interesting to note that running grub from knoppix (outside my chroot), the root (hd0,0) command does not fail, and gives this:
Code:

root (hd0,0)
Filesystem type is ext2fs, partition type 0x83

can I use my /boot/grub/menu.lst outside of my chroot? outside of my chroot, "grub-install --root-directory=/mnt/hda1 /dev/hda" seems to work. Booting now does bring up the grub menu. But I am unable to boot back into (k)ubuntu. But it seems that this may be the topic for another thread.

Thanks,

~S

jomen 02-27-2006 02:10 AM

Quote:

can I use my /boot/grub/menu.lst outside of my chroot
You can run grub also directly from the boot-screen it is showing you.
Press "c" for ("command-line") to get to a command-line-interface, when you see the screen.
There you enter:

root (hd0,0)
setup (hd0)
then eighter:
configfile (hd0,0)/boot/grub/menu.lst -> which gets you to your boot-menu
or
kernel (hd0,0)/the_name_or_press_TAB_for_autocompletion
boot
which you can always use as long as you see a grub-screen...even without any working setup (wrong config-file for example)

snowsquirrel 02-27-2006 07:18 AM

thanks, I tried that out to test a few different settings. Turned out the reason I couldn't boot was because RESUME= was pointing to the wrong partition in my /etc/mkinitrd/mkinitrd.conf file. Generating a new mkinitrd file fixed that. So now I am booting.

Thanks for all the help.

~S


All times are GMT -5. The time now is 12:36 AM.