Jump to content


Photo

How do restore the Linux boot in a multiboot environment


  • Please log in to reply
4 replies to this topic

#1 babusa

babusa

    stranger

  • Members
  • 3 posts

Posted 09 December 2003 - 07:31 AM

I have installed Win98 and Linix 9 on my system, both are running well.
It happened to reinstall win98 on my system.Now, I am unable to find out the Linux boot screen.As I am new to Linux, don't know how to restore the multiboot login screen. Please help me out to resolve this

Thanks in advance

Rgds
Babu

#2 Admiral LSD

Admiral LSD

    old hand

  • Members
  • 991 posts

Posted 09 December 2003 - 07:53 AM

If you created a boot disk when you first set Linux up you can simply use that to boot your system and then restore your boot loader by logging in as root and, at a terminal, typing lilo to restore LILO. If you use GRUB though it's a little more complicated as you need to know the hard drive and partition numbers of your boot partition (the one with the /boot directory on it. It's become quite common to mount this in its own partition these days even though this isn't strictly necessary). Once you have that info, you can simply start the GRUB shell by typing grub at the prompt and then typing the following (assuming GRUB is installed into the MBR):

Code:
root (hdx,y)
setup (hdx)


where x represents the hard drive number (GRUB numbers hard drives from 0 starting at the first HDD in the system. If you only have one drive though, it'll always be 0) and y represents the number of the boot partition (like hard drives, GRUB numbers the partitions starting from 0 and employs the same numbering scheme that Linux does so 0-3 represent your 4 primary partitions and 5 upward represent logical drives. A quick rule of thumb is the GRUB number will be the Linux number subtract one so if your boot partition is /dev/hda5, it'll be (hd0,4) in GRUB).

edit: I forgot to mention that if you don't have a boot disk for your system you're going to need to find an alternative way to get into your system in order to run the requisite lilo or grub commands to restore the bootloader. For this, you're going to need to get your hands on a "Live" type distribution such as Knoppix that'll let you mount your existing Linux partitions, chroot into your installed Linux environment and restore the bootloader.

#3 babusa

babusa

    stranger

  • Members
  • 3 posts

Posted 09 December 2003 - 08:30 AM

Hi,
Thanks for your detailed reply on my query.Unfortunately I ddidn't create the boot floppy during the installtion.
Can I have the details how to go ahead to get activate the Linux?

thanks & Rgds
babu

Quote:
If you created a boot disk when you first set Linux up you can simply use that to boot your system and then restore your boot loader by logging in as root and, at a terminal, typing lilo to restore LILO. If you use GRUB though it's a little more complicated as you need to know the hard drive and partition numbers of your boot partition (the one with the /boot directory on it. It's become quite common to mount this in its own partition these days even though this isn't strictly necessary). Once you have that info, you can simply start the GRUB shell by typing grub at the prompt and then typing the following (assuming GRUB is installed into the MBR):

Code:
root (hdx,y)
setup (hdx)


where x represents the hard drive number (GRUB numbers hard drives from 0 starting at the first HDD in the system. If you only have one drive though, it'll always be 0) and y represents the number of the boot partition (like hard drives, GRUB numbers the partitions starting from 0 and employs the same numbering scheme that Linux does so 0-3 represent your 4 primary partitions and 5 upward represent logical drives. A quick rule of thumb is the GRUB number will be the Linux number subtract one so if your boot partition is /dev/hda5, it'll be (hd0,4) in GRUB).

edit: I forgot to mention that if you don't have a boot disk for your system you're going to need to find an alternative way to get into your system in order to run the requisite lilo or grub commands to restore the bootloader. For this, you're going to need to get your hands on a "Live" type distribution such as Knoppix that'll let you mount your existing Linux partitions, chroot into your installed Linux environment and restore the bootloader.


#4 Admiral LSD

Admiral LSD

    old hand

  • Members
  • 991 posts

Posted 10 December 2003 - 11:29 AM

It's going to be a tad difficult without knowing a little more about your setup but I'll try and be as general as I can. First, you need to get yourself a "Live" type distro on a bootable CD that has the "mount" and "chroot" commands. I don't know about Knoppix but I know the Gentoo stage 1 LiveCDs have those commands as they're essential in installing Gentoo. Once you have the CD and have booted into whatever environment it sets you up in you're going to have to mount the Linux partitions on your hard disk. Before you can do that though you're more than likely going to have to create a "container" directory for the mounted Linux filesystem.

To do that, launch a shell (it's important this all be done as root btw, make sure whatever LiveCD you use gives you this capability. The Gentoo CDs do but I'm not sure about anything else), change to the /mnt directory and then create your container directory (I usually name it according to what distro gets mounted there, a habit from installing Gentoo, but for simplicity I'm just going to call it linux) using the mkdir command. To summarise:

Code:
cd /mnt
mkdir linux


Now, to mount the partitions type:

Code:
mount /dev/hdxy /mnt/linux/mountpoint


where x represents the drive the partition is located on, y represents the number of the partition and mountpoint is the directory that partition normally gets mounted into (such as /home, /usr etc. / just gets mounted into /mnt/linux and should be mounted first).

Once you have your partitions mounted, use the chroot command to "enter" your Linux installation:

Code:
chroot /mnt/linux /bin/bash


and from there you can run the commands to restore your bootloader. Once you've finished, type exit to exit the chroot shell and then unmount your partitions (from last to first making sure you're not in any of the directories your trying to unmount) using the umount command on their mount points. To unmount a partition you use the umount command. So, for example to unmount the /mnt/linux directory you type:

Code:
umount /mnt/linux


Once all that's done, you can shutdown the LiveCD and hopefully your bootloader will be restored allowing you to boot into your existing Linux installation (just remember to remove the LiveCD from your drive and/or set the BIOS up to boot from your hard drive first!).

#5 Maillion

Maillion

    enthusiast

  • Members
  • 213 posts

Posted 04 January 2004 - 05:24 AM

Or you can reinstall Linux and let it undo Win98's meddling... wink




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

IPB Skin By Virteq