LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Using and editing Grub or boot with System Rescue cd (https://www.linuxquestions.org/questions/linux-newbie-8/using-and-editing-grub-or-boot-with-system-rescue-cd-390283/)

loninappleton 12-07-2005 05:22 PM

Using and editing Grub or boot with System Rescue cd
 
Hello again,

I have an installed version of Mepis Linux on a hard drive. If I move the drive from one plug to another I get the
kernel panic error.

I would like to salvage what is on that drive and need to either successfully edit grub or in some way such as System Rescue cd.. recue the drive and tell it where to boot from.

I used Esc to get out of the grub splash screen to edit the needed line and was lost. While I could 'e' to\edit line, I did not see how to save it anywhere. The grub manual was to complex. I just want to be able to restart the drive and have it recognize where it is with no kernel panics. Grub
manual mentioned a fall back routine so that if the drive is not found in one place it will look in another.

So i need step by step instructions to do this.

Below is the detailed info I have copied out:

Mepis at hdb3, kernel 2.6.12
Memtest

> esc

Line 1: Kernel (Hd0,2)/boot/vmlinuz-2.6.12 roor=/dev/hdb3 nomce quiet splash= (more read off end of screen)

Line 2:initrd(hd0,2)/boot/initrd.splash


A test of running System Rescue Cd and
running Qtparted in that showed that the actual location hdd was recognized as where the drive is installed.

I need help in being able to define in the bootloader where the drive is and
how to boot it there.

What happens when the drive is cold booted is the following message:

Kernel Panic: not synching: VFS: Unable to mount root fs on unknown- block (0,0)

And remember to say how to save it.


lon

jailbait 12-08-2005 11:54 AM

"I have an installed version of Mepis Linux on a hard drive. If I move the drive from one plug to another I get the kernel panic error."

When you move a drive you need to edit /boot/grub/grub.menu.lst and /etc/fstab. You will also have to run grub-install after you edit /boot/grub/grub.menu.lst so that the MBR points to the new /boot/grub/grub.menu.lst.

To do the editing you boot a rescue CD. Then mount your Mepis partition (/dev/hdb3). Some rescue CDs mount every partition as read only when they book so you should umount a partition before you mount it in case it is already mounted read only. So mounting Mepis from a rescue system would look something like this:

umount /dev/hdb3
mkdir /fixMepis
mount -t ext3 /dev/hdb3 /fixMepis

Then use an editor to edit /fixMepis/boot/grub/grub.menu.lst and /fixMepis/etc/fstab. grub uses relative addressing. If you have added a second hard drive to /dev/hda then your drive on /dev/hdb is called hd1 by grub. If you still have only one hard drive then the drive on /dev/hdb is still called hd0 by grub. The two lines that you quoted from menu.lst should be changed to:

Line 1: Kernel (hd1,2)/boot/vmlinuz-2.6.12 root=/dev/hdb3 nomce quiet splash= (more read off end of screen)

Line 2:initrd(hd1,2)/boot/initrd.splash


Once the two files are set up correctly then you need to run grub-install to fix the MBR. Remove the rescue CD. Assuming that you are booting from /dev/hda the commands are:

chroot /fixMepis
/sbin/grub-install /dev/hda
shutdown -r now

--------------------
Steve Stites

loninappleton 12-08-2005 02:54 PM

I see that I still have a long way to go.

:-/

Thanks for answering.


Can you address the "fallback" procedure in grub to have a way to find the drive on other channels?

sundialsvcs 12-08-2005 05:17 PM

When you've got a Rescue CD up and running, you're in a complete Linux environment. But none of your hard-drives are mounted as a root filesystem, so you can edit them at will. And you've got a lot of tools with which to do it, although they're probably not GUI-graphics programs.

So, as you saw, you create a mount-point directory and mount one of the drives onto it. That'll give you access to, say, the boot partition (probably #1), the regular root-partition (maybe #3), and so on.

There will be a learning curve to go through; that's unavoidable and it's steep the first time. Maybe the best way to approach it is to shut-down a working-well system, boot up a rescue-CD, and then (carefully) look around. See what's on it. Much better to do that when you know that you can simply reboot, than to wait until ... :rolleyes: ... the point at which, I daresay, every single one of us did wait-until ... to actually stick the CD into a drive and try it out.

loninappleton 12-08-2005 05:31 PM

I noticed that the System Rescue Cd starts out with a nice menu of stuff but then is anxious to dump the user off into the command line where it's very difficult to know what's going on.


Do you have a preferred rescue cd program to do these operations?


Is there a scripted fall back routine that can find and boot a drive on any channel?


Why is this not part of the grub bootloader in the first place?

jailbait 12-08-2005 06:19 PM

"Do you have a preferred rescue cd program to do these operations?"

If you are asking about a command line editor I prefer mp. I doubt that your rescue CD has mp so try vi or vim. Almost all rescue CDs provide vi or vim.

"Is there a scripted fall back routine that can find and boot a drive on any channel?"

Not that I know of.

"Why is this not part of the grub bootloader in the first place?"

Boot loaders run in a very primitive programming environment. Programming without having an underlying operating system is painstakingly slow. So I guess that nobody has ever become enthusiastic enough about these ideas to go through all of the work necessary to create such functions in grub. Perhaps you would like to do so.

------------------
Steve Stites


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