Click to See Complete Forum and Search --> : Rescue Linux Machine


redhy
April 4th, 2003, 08:54 AM
Hello Brothers,

I had posted the following post as an aswer to a question regarding linux installation.
But still there are a few who don't know what to do when a linux machine crashes.

Here is a tutorial on Linux Rescue

If by some means u loose ur lilo, follow these steps:
1. Boot with Redhat Cd no.1
2. Type
linux rescue <enter>
3. Follow the instructions (u will have to press enter key twice)
4. After this Redhat searches for redhat installation on the disk and mounts it into /mnt/sysimage
5. u'll get a shell prompt #
6. type
#chroot /mnt/sysimage
7.U r ROOT here
edit ur /etc/lilo.conf
8. run lilo
#lilo -v
9. reboot
(now it should work)

Suppose u don't have a Redhat Installation CD I (Which automatically detects your Redhat Installation and mounts it under /mnt/sysimage) :
But u do have the installation CD of any other popular distribution ( or a rescue CD ),then these are the steps to follow :

1. Here I'll assume that u got the rescue shell prompt
#
2. type
#fdisk -l or
#fdisk /dev/hda then p (to get the partition list)
3. Note down the number of all your linux partition (eg. /dev/hda5)
4. create a directory and mount your / partition (if u know) into this directory.Otherwise do trial and error.If the partition was / partition, the directory will contail etc,bin,sbin,boot etc.
#mkdir test
#mount /dev/hda6 test
#cd test
#ls
if it shows directories etc,boot,bin,sbin, etc then ok.Else try mounting other linux partitions.
Once that is done.
#cd ..
#chroot test
5. But that is not all.If u had a separate /boot partition u should mount that into boot directory.B'coz it is in this directory that your linux kernel resides (eg. vmlinuz )
6. Now make changes to /etc/lilo.conf (if necessory) and run lilo
#lilo -v
#reboot



To install GrUB type
#grub-install /dev/hda



Uninstall lilo
#lilo -u



Uninstall GrUB

There is no provision of uninstalling GrUB in linux (as far as I know). But if ur machine has Win98,type
c:\>fdisk /mbr

But if u have Win2000 or XP
1. Boot with installation CD
2. Enter into recovery console by pressing R when asked
3. there are some more steps before u get the prompt.But i will assume here that u got the prompt
4. Type
fixmbr
5. Reboot

nixkl
April 4th, 2003, 08:45 PM
I'd add "step 0: prevention". Build a lilo floppy while your system is working fine.

redhy
April 23rd, 2003, 09:17 AM
step 0: Creating boot Disk
Though there are lot of boot disk creation method, this should work on all distributions

#dd if=/boot/vmlinuz-<version no.> of=/dev/fd0
#rdev /dev/fd0 /dev/hdax

where x is the partition number of /
u can get the value of x by typing
#df -h

PuReExcTacy
April 23rd, 2003, 10:23 AM
Great post, as a reminder for those people who've upgraded their kernel lately. You might want to re-create you boot diskette as well, so you can boot to your latest kernel.


Thanks,
PuRe

slarty
April 23rd, 2003, 04:15 PM
Another idea: people who upgraded their kernel:

Keep the old kernel around and in the lilo boot menu. It doesn't use up much space (900k mine) and it saves a lot of hassle if you build a broken one (for instance forget the IDE driver when you have IDE discs)

redhy
February 25th, 2004, 07:18 AM
Sometimes grub-install fails even in the rescue mode.

The solution to this is : (change parameters according to your systems settings)
#grub &lt;enter&gt;
grub &gt; install (hd0,6)/boot/grub/stage1 d (hd0) (hd0,6)/boot/grub/stage2 p (hd0,6)/boot/grub/menu.1st

this will change slightly if u have a separate boot partition.
#grub &lt;enter&gt;
grub &gt; install (hd0,6)/grub/stage1 d (hd0) (hd0,6)/grub/stage2 p (hd0,6)/grub/menu.1st

ok the syntax is :
install &lt;path to stage1&gt; d &lt;install device&gt; &lt;path to stage2&gt; p &lt;path to config file&gt;