LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Grub is gone, how to get it back? (https://www.linuxquestions.org/questions/linux-general-1/grub-is-gone-how-to-get-it-back-298961/)

infornography 03-07-2005 09:57 PM

Grub is gone, how to get it back?
 
I just installed Zen Linux (100% Debian unstable compatible) to my hard drive on hda3, replacing Ubuntu. I also have a Windows partition on hda1, and a fat partition on hda2.

Anyway after installing Zen, grub no longer comes up and I can't boot into any OS (using live CD now.) How can I boot into my new Zen (Debian) install so I can then reinstall grub? The CD doen't seem to have an option for it.

Any help would be appreciated.

btmiller 03-07-2005 10:24 PM

In the LiveCD, mount your root partition, chroot into it and run grub-install /dev/hda (assuming you're using /dev/hda, replace as appropriate). This should give you your grub back.

infornography 03-07-2005 10:33 PM

Thanks for the help so far, I just have some follow up questions.

My root partition is an ext3 partition on /dev/hda3. What is the command to mount it?

Also, I don't understand what you mean by "chroot into it" can you tell me that command too?

Thanks again.

KimVette 03-07-2005 10:59 PM

From the man page:
NAME
chroot - run command or interactive shell with special
root directory

SYNOPSIS
chroot NEWROOT [COMMAND...]
chroot OPTION


So, if your normal root is, say, /dev/hda3, and after booting from CD/DVD you mounted it on /mnt/myhdd do this:

chroot /mnt/myhdd grub-install

or just chroot /mnt/myhdd and then run grub-install

--Kim

infornography 03-07-2005 11:12 PM

Ok, I have got that far, but when I run grub-install /dev/hda I get this error:

/dev/hda does not have any corresponding BIOS drive.

I usually install grub to the MBR, does that have anything do so with this?

btmiller 03-08-2005 12:15 AM

Hmmm ... can you do a "ls -l /dev/hda" and make sure that the result is the same as in your "real" /dev directory on the CD. It should be, but worth a check.

infornography 03-08-2005 12:52 AM

Yeah they are the same.

I did do some more googling though and found out that the error was because I didn't have the line "(hd0) /dev/hda" in my /boot/grub/device.map file. Once I added the line I got a new error though:

df: Warning: cannot read table of mounted filesystems: No such file or directory
df: Warning: cannot read table of mounted filesystems: No such file or directory
Could not find device for /boot: Not found or not a block device.

Any ideas on this one?

KimVette 03-08-2005 01:07 AM

You need a section similar to this in menu.lst:

Code:

###Don't change this comment - YaST2 identifier: Original name: Linux - UniProcessor###
title Linux - UniProcessor
    kernel (hd1,0)/boot/vmlinuz root=/dev/hdb1 vga=0x31a splash=silent desktop resume=/dev/hdb2 showopts nosmp
    initrd (hd1,0)/boot/initrd

Notice the kernel(hd1,0)/boot/vmlinuz bit -- and root=/dev/hdb1

You need to inform grub where the kernel us, and then use the Linux nomanclature for the HDD device name because the root= portion is a kernel argument.

Why GRUB uses a different device naming scheme, I have no idea. Maybe they're trying to copy one of Windows' bad ideas? I mean, come on! If you refer to /dev/hda in Linux, it's understood that it's the first IDE device, and if you refer to /dev/sda it's understood that it's the first SCSI device, etc. but when referring to drive(0)partartition(0) or in GRUB's case hd(0,0) what exactly is drive 0? Is it the drive hanging off of the controller with the lowest hardware I/O address? Is it the drive reported as being first in the boot sequence by the BIOS? Is it dictated by the phase of the moon and whether you have more mass planted on your left or right buttcheek at the time of installation? (note that was a rhetorical question just to illustrate that it's certainly not intuitive!)

infornography 03-08-2005 01:24 AM

I don't think I'm understanding you correctly. This is the command I type:

grub-install /dev/hda

And then I get this output:

df: Warning: cannot read table of mounted filesystems: No such file or directory
df: Warning: cannot read table of mounted filesystems: No such file or directory
Could not find device for /boot: Not found or not a block device.


I cant even find a menu.lst file at the moment.

Again, thanks for all the help so far all.


All times are GMT -5. The time now is 01:01 PM.