LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-06-2007, 06:09 AM   #1
matsyuf
Member
 
Registered: Mar 2007
Posts: 97

Rep: Reputation: 15
Lost BOOT LOADER


Hello There

I had one unformatted Partition on HDD, I inserted my WIN XP CD to created a partition, Before this whole process i had win xp on one partition and Debian on another (These partitions existed ) after working on the 3rd partition (One that wasn't formatted) I lost a Boot loader and now when i restart my computer it skips the boot loader and instead takes me to Windows yet earlier on it would stop at boot loader for me to choose OS to use.

Please help me, I want to use linux
 
Old 04-06-2007, 06:15 AM   #2
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Depends on if you used LILO or GRUB or what as your bootloader; for GRUB you could simply boot a Linux live distribution (or a "rescue mode" from an install disc) and run as root grub-install which reinstalls GRUB (as a parameter you specify the harddisk into which it installs; I believe it has a man-page with the information: man grub-install).

I suggest you first boot from the Linux installation disc and see if it offers you a rescue boot; if you don't have the discs anymore or there is no such option (should be, though), you can use probably any live-cd/dvd around: Knoppix, Ubuntu, Mepis, ...
 
Old 04-06-2007, 06:55 AM   #3
matsyuf
Member
 
Registered: Mar 2007
Posts: 97

Original Poster
Rep: Reputation: 15
Thanx, lets me try it and see what happens
 
Old 04-09-2007, 03:24 AM   #4
matsyuf
Member
 
Registered: Mar 2007
Posts: 97

Original Poster
Rep: Reputation: 15
Hi

I got a live CD (knoppix)but i dont know where/how to find the rescue boot option, so am still stuck with boot loader problem.

Last edited by matsyuf; 04-09-2007 at 04:36 AM.
 
Old 04-09-2007, 07:37 AM   #5
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
You don't need to find the rescue option in Knoopix.

Knoopix has both Lilo and Grub and you can activate its Grub by command
Code:
grub
as a root user. (i.e just type "su" at the terminal mode)

You need to know the /boot partition of the Debian which you could do with Grub's help. Type this command after Grub prompt
Code:
geometry (hd0)
and Grub will list all the partitions in the 1st hard disk hd0. The first partition with type 83 is likely to be the /boot of your Debian or / partition if you have only a single partition. Say this is (hd0,1) then these two lines will restore Grub in (hd0,1) into the MBR of disk (hd0)
Code:
root (hd0,1)
setup (hd0)
You can restore any boot loader any number of times. Take a look at the last link of my signature for explanation and commands.

Last edited by saikee; 04-09-2007 at 07:58 AM.
 
Old 04-09-2007, 02:28 PM   #6
matsyuf
Member
 
Registered: Mar 2007
Posts: 97

Original Poster
Rep: Reputation: 15
Hi,

I did what Saikee advised me to do, but maybe I didnt explain my situation well. I have 2 HDD, on one HDD i have 2 partitions one partition i have winxp and other just logical, and on another second HDD I have still 2 partitions, one partition with Linux and other NTFS logical partiton, these 2 HDDs are on one BUS in one PC, one (HDD1) primary another (HDD2) secondary.

Below is how my partition look like;

knoppix@1[knoppix]$ su
root@1[knoppix]# sudo fdisk -l

Disk /dev/hda: 255 heads, 63 sectors, 9726 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 2432 19535008+ 7 HPFS/NTFS
/dev/hda2 2433 9726 58589055 f Win95 Ext'd (LBA)
/dev/hda5 2433 9726 58589023+ b Win95 FAT32
omitting empty partition (5)

Disk /dev/hdb: 255 heads, 63 sectors, 4998 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 1 4997 40138371 f Win95 Ext'd (LBA)
/dev/hdb5 1 3493 28057428 83 Linux
/dev/hdb6 3494 4551 8498353+ 7 HPFS/NTFS
root@1[knoppix]#

And when this is what I did as directed and it didnt work.

#grub
grub>
geometry (hd1)
drive 0x81: C/H/S = 65535/16/63, The number of sectors = 80293248,
/dev/hdb
Partition num: 5, Filesystem type is ext2fs, partition type 0x
83
Partition num: 6, Filesystem type unknown, partition type 0x7

grub>
root (hd1,5)
Filesystem type is ext2fs, partition type 0x83

grub>setup (hd1)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd1)"... 16 sectors are
embedded.
succeeded
Running "install /boot/grub/stage1 (hd1) (hd1)1+16 p (hd1,5)/boot
/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.

grub> Reboot

And then I removed my Knoppix but still bootloader menu didn't come for me to load my debian.

Thanx in advance and everyone who has given to hints, I will let you guyz know incase am successful in this, am a newbie
 
Old 04-09-2007, 07:16 PM   #7
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
In that case you need to edit the /boot/grub/menu.lst of (hd1,4) in Grub term or hdb5 in Linux term. Grub counts from 0 so (hd1,4) is the 5th partition of the 2nd disk which in the case should be your hdb5.

You can actually boot it manually in Grub prompt and then use the instructions in the menu.lst

your Debian if it is a Sarge can be booted by
Code:
root (hd1,4)
kernel /boot/vmlinuz-2.6.7-1-386 root=/dev/hdb5 ro
initrd /boot/initrd.img-2.6.7-1-386
boot
If you got a different version then just type the kernal statement as
Code:
kernel /boot/vmlinuz-
and follow by the "tap" key, then Grub will find a filename that match it and you can then add
Code:
root=/dev/hdb5 ro
afterward
You do it the same for
Code:
initrd /boot/initrd.img-
and then the tap key to get the rest of the file name and then press enter.

Finish everything by the "boot" command.

Every operating system can be booted manually by Grub.
 
Old 04-10-2007, 02:53 AM   #8
matsyuf
Member
 
Registered: Mar 2007
Posts: 97

Original Poster
Rep: Reputation: 15
Hi,

I am still failing to edit /boot/grub/menu.list, for starters I cant see the folder grub and file menu.list. Below is how my /Boot looks like;

NOTE: am using the knoppix live CD

root@2[knoppix]# cd /boot
root@2[boot]# ls
System.map config-2.6.11 sarge.bmp vmlinuz-2.6.11
System.map-2.6.11 debian.bmp sid.bmp
coffee.bmp debianlilo.bmp vmlinuz
root@2[boot]# vi /boot/grub/menu.list

After using vi, to edit menu list it opens a file with no content and below it says its a new file, my question is, Do i have to creat thie Menu.list file.

Maybe I didnt understand well, am abit confused again, Do i have to be in hdb5 (hd1,4) and if so how can i get there? otherwise what am doing, I just start my live CD and open konsole then i start doing the needful however am still stuck though SAIKEE its also helping me learn something, thanks in advance.

I will be grateful after fixing the problem
 
Old 04-10-2007, 11:00 AM   #9
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
Yep, you guessed it.

The /boot directory you see after booting up Knoppix belongs to Knoppix.

To edit a menu.lst in hdb5 you need root privilege. Complete commands (from Knoppix) are
Code:
su
mkdir /mnt/hdb5
mount /dev/hdb5 /mnt/hdb5
ls /mnt/hdb5/boot/grub
vi /mnt/hdb5/boot/grub/menu.lst
As a Live CD Knoppix will hand down root privilege to you on receiving the command "su"

You basically make a subdirectory in the /mnt directory of Knoppix as /mnt is the designated directory for mounting in most distros.

You then mount the device hdb5 on the newly made subdirectory.

Therefore you can do whatever you want with it.

It is the standard way to mount any file to read/write in Linux. Some distros also use /media directory for the same purpose but /mnt will work in all cases.

Last edited by saikee; 04-10-2007 at 11:01 AM.
 
  


Reply

Tags
help



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RedHatLinux ,Recover lost root password with GRUB boot loader Ruzzell Linux - Security 5 01-07-2011 02:21 PM
Urgent... Lost Boot Loader TheGreenGenie Linux - Newbie 4 11-24-2006 08:03 PM
The boot loader was lost and the CD-ROM broke down. batman74 Linux - Newbie 7 05-08-2006 04:19 PM
Boot loader lost. Need help? BEYAZITTOSUN Linux - General 2 11-15-2003 04:12 PM
Boot loader lost. Need help? BEYAZITTOSUN Linux - Software 1 11-15-2003 02:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration