LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-17-2008, 10:23 AM   #1
tcnm
Member
 
Registered: Aug 2005
Location: Fanwood, NJ
Distribution: Ubuntu 15.10
Posts: 33

Rep: Reputation: 0
Linux reinstallation


I have Windows installed on one disk and Linux (Fedora Core 3)installed on a second disk.

Recently I reloaded Windows, in which process I reformatted the disk containing Windows. Reformatting that disk apparently wiped out the Master Boot Record and thus destroyed my access to Linux.

Is there any way I can restore my access to Linux without reloading the entire Linux system and thereby destroying all my files contained on Linux?

Thank you very much.
 
Old 11-17-2008, 10:31 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Boot with a rescue disk or CD to recover Grub or Lilo back to the MBR. But then again, you're using FC3 which is really old, maybe this would be a good opportunity to install a newer version, of course after getting your data from it before reinstalling which you can also do from a rescue CD or disk.
 
Old 11-17-2008, 10:31 AM   #3
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
Sounds like you just need to reinstall the boot loader (grub or lilo).
 
Old 11-17-2008, 09:50 PM   #4
okos
Member
 
Registered: May 2007
Location: California
Distribution: Slackware/Ubuntu
Posts: 609

Rep: Reputation: 38
I am not sure about grub but lilo is pretty easy.

What I did before is pop in a live cd.
mkdir myhdd (for your mount point to mount your linux partition.)
mount /dev/hdc? /myhdd (or something similar)
chroot /myhdd (I think you chroot the mount point as I recall)
lilo

That should work to reinstall the mbr
 
Old 11-21-2008, 01:35 PM   #5
tcnm
Member
 
Registered: Aug 2005
Location: Fanwood, NJ
Distribution: Ubuntu 15.10
Posts: 33

Original Poster
Rep: Reputation: 0
Thanks for your answers, but they don't solve the problem.

I know that I have to reinstall the boot loader, but I don't know how to do it.

First, I tried using my installation disk to reinstall GRUP into the Master Boot Record. The installation disk seemed to do so with no problems, but, when I rebooted the machine, only Windows came up, and there was no indication that any other selection could be made.

Second, following a procedure I found on the Internet, I used the linux rescue mode of the installation disk to put GRUP into the /boot partition of the Linux disk and then used dd to copy the first 512 bytes of the /boot partition onto a floppy in a file called 'linux.bin'. Then in Windows I copied file linux.bin into directory C:\, and I modified the file 'boot.ini' in that directory to add the line c:\linux.bin="Linux".
With this change rebooting the computer brought up a menu offering a choice between Windows and Linux. The Windows selection brought up Windows, but the Linux selection brought up only a black screen with a small cursor in the upper left corner.

Finally, my understanding is that LILO is not included in Fedora Core 3.

I really hope somebody can help. Having access to Linux is very important to me. Thank you.

tcnm
 
Old 11-21-2008, 04:12 PM   #6
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
You are close, but not getting at it. BTW it is GRUB, not GRUP. One letter can make a huge difference. Try again. Boot from a live CD.

Then Okos' instructions:

Code:
mkdir myhdd (for your mount point to mount your linux partition.)
mount /dev/hdc? /myhdd (or something similar)
chroot /myhdd (I think you chroot the mount point as I recall)
now you are actually running the OS which is below the /myhdd mount point
Then:
grub-install /dev/hdc?
Then while you are chrooted, use a command line editor (vi, joe, nano) to edit you menu.list in /myhdd/boot/grub/menu.list and take care that Windows will boot as well by entering a boot option for that. (Google for that if you forgot how to do it)

It is VERY important that you confirm carefully which partition you are booting from. In the example I used /dev/hdc? (emphasized in red), but it could be equally well /dev/hda1 or /dev/sda1.

It should work like that, I did it a hundred times. The trick is that you use grub-install from your current linux install, that you correctly point to the boot partition, and that you let grub install into the correct root directory. You do this by NOT specifying the root directory, since you just chrooted into the root directory and grub does this by default.

There is NO need to re-install, Linux is still safely there.

jlinkels
 
Old 11-21-2008, 09:42 PM   #7
okos
Member
 
Registered: May 2007
Location: California
Distribution: Slackware/Ubuntu
Posts: 609

Rep: Reputation: 38
Quote:
Then while you are chrooted, use a command line editor (vi, joe, nano) to edit you menu.list in /myhdd/boot/grub/menu.list and take care that Windows will boot as well by entering a boot option for that. (Google for that if you forgot how to do it)

Please correct me if Im wrong, since I don't use grub, but I don't think you will need to edit anything on the menu.list. If everything in linux was left as is. I think that once you chroot... all you have to do is grub-install /dev/hdc?

Also as jlinkels said,
Quote:
It is VERY important that you confirm carefully which partition you are booting from. In the example I used /dev/hdc? (emphasized in red), but it could be equally well /dev/hda1 or /dev/sda1.
One way to verify all partitions and device types as root is to type the following command,
fdisk -l
 
Old 11-22-2008, 06:06 AM   #8
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by okos View Post
Please correct me if Im wrong, since I don't use grub, but I don't think you will need to edit anything on the menu.list. If everything in linux was left as is. I think that once you chroot... all you have to do is grub-install /dev/hdc?
Grub-install does not create or edit menu.lst. You are right that if everything was left as is, no editing should be needed. But it is my recommendation to double-check.

Altough GRUB is more forgiving than LILO, with GRUB you can edit the boot parameters while booting so it is virtually impossible to end up with an unbootable system.

jlinkels
 
Old 11-23-2008, 01:29 PM   #9
okos
Member
 
Registered: May 2007
Location: California
Distribution: Slackware/Ubuntu
Posts: 609

Rep: Reputation: 38
tcnm,

Were you successful?

You should post what you learned and also rename the thread so others with the same need could find this thread to resolve their issues.

Rename it to something like, "how to reinstall bootloader grub"
 
Old 11-23-2008, 02:59 PM   #10
tcnm
Member
 
Registered: Aug 2005
Location: Fanwood, NJ
Distribution: Ubuntu 15.10
Posts: 33

Original Poster
Rep: Reputation: 0
Thank you all for your comments, especially jlinkels and okos. Unfortunately, I still don't get it. Let me tell you exactly what I have done; perhaps then you can spot some problem.

I have two disks: disk 0 (/dev/sda) containing Windows XP Pro and disk 1 (/dev/sdb) containing Linux (Fedora Core 3). On disk 1 the / partition is /dev/sdb1 and the /boot partition is /dev/sdb3. Using the first installation disk, at the prompt I entered 'linux rescue'. The installation software then found my linux system and mounted it on /mnt/sysimage. I then executed 'chroot /mnt/sysimage'. Now my root directory appeared with all the expected subdirectories, one of which is /boot, on which the /boot partition is mounted. The /boot partition is the active partition on the disk, and it definitely appears that Linux boots from the /boot partition. I then executed 'grub-install /dev/sdb3', which put, or revised, a number of files in the /boot directory. I then mounted a floppy disk on /media/floppy and executed the command 'dd if=/dev/sdb3 of=/media/floppy/linux.bin bs=512 count=1 to copy the first 512 bytes from /dev/sdb3 to the floppy. I then unmounted the floppy, exited, and rebooted Windows. On Windows I copied the file linux.bin from the floppy to c:\ and edited the file c:\boot.ini to add the line c:\linux.bin="Linux". Result: On rebooting a menu appears presenting a choice between Windows and Linux. The Window choice works, but the Linux choice only produces a black screen.

I previously tried using the installation disk to put grub into the Master Boot Record on disk 0, but that had no detectable effect whatsoever.

Incidentally, I did not find any file called menu.lst in directory /boot/grub, but Windows boots with no problem.

I'm sorry to go on like this, but I don't know what else to do. I suppose I could try running 'grub-install /dev/sdb1', but that just seems like a wild guess that might do harm.

Thanks for your help.

tcnm
 
Old 11-23-2008, 04:23 PM   #11
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
well seeing as you did install grub to sdb3 you really don't want to put a second one in sda1
after you run
Code:
chroot /mnt/sysimage
 -- run --
cd /boot/grub
nano guub.conf
and look where the image is
something like this ( my grub.conf)
Quote:
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd1,2)
# kernel /vmlinuz-version ro root=/dev/sdb7
# initrd /initrd-version.img
#boot=/dev/sdb3
default=0
timeout=5
splashimage=(hd1,2)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.27.5-41.fc9.i686)
root (hd1,2)
kernel /vmlinuz-2.6.27.5-41.fc9.i686 ro root=UUID=bc0c8dfc-ab23-4ca6-9274-e7410fa6796b rhgb quiet
initrd /initrd-2.6.27.5-41.fc9.i686.img
title Fedora (2.6.27.5-37.fc9.i686)
root (hd1,2)
kernel /vmlinuz-2.6.27.5-37.fc9.i686 ro root=UUID=bc0c8dfc-ab23-4ca6-9274-e7410fa6796b rhgb quiet
initrd /initrd-2.6.27.5-37.fc9.i686.img
title Fedora (2.6.26.6-79.fc9.i686)
root (hd1,2)
kernel /vmlinuz-2.6.26.6-79.fc9.i686 ro root=UUID=bc0c8dfc-ab23-4ca6-9274-e7410fa6796b rhgb quiet
initrd /initrd-2.6.26.6-79.fc9.i686.img
title WindowsXP
rootnoverify (hd0,0)
chainloader +1
(hd1,2) is my sdb3 partition
seeing as you but grub in the same place it should be that
also seeing as fedora 3 has NO support for MS windows ntsf you are stuck using a flopy to copy frdora.bin(linux.bin) to C:\\
i have posted a lot about this and here is a copy of my small (text only) how to

Quote:
-----------------------------
chroot /mnt/sysimage
/* root login */
root
( my password)
mkdir /mnt/windows
mount -t ntfs-3g /dev/sda1 /mnt/windows
dd if=/dev/sd?? of=/fedora.bin bs=512 count=1
/* ?? is where the boot is */
cp /fedora.bin /mnt/windows
/* or run */
dd if=/dev/sd?? of=/mnt/windows/fedora.bin bs=512 count=1
nano /mnt/windows/boot.ini
/* and add C:\fedora.bin= " Fedora "
(ctrl+o ) and <enter> to save*/


you can not do some of this do to the fact that there is no ntfs support in f3
but you could format the flopy to fat32 then copy fedora.bin to it

recap
Code:
chroot /mnt/sysimage ( login as root)
cd /
dd if=/dev/sdb3 of=/fedora3.bin bs=512 count=1
-- pop in floppy --
mkdir /mnt/floppy
mount -t vfat /dev/fd0 /mnt/floppy
cp /fedora3.bin /mnt/floppy
 
Old 11-24-2008, 11:54 AM   #12
tcnm
Member
 
Registered: Aug 2005
Location: Fanwood, NJ
Distribution: Ubuntu 15.10
Posts: 33

Original Poster
Rep: Reputation: 0
Thank you John VV.

Unfortunately, I believe that I am doing exactly what you recommend, but it doesn't work. The only difference is that, instead of copying the first 512 bytes of /dev/sdb3 to /fedora3.bin and then recopying /fedora3.bin to a mounted floppy, I copy the first 512 bytes of /dev/sdb3 directly to a mounted floppy with the command dd if=/dev/sdb3 of=/media/floppy/linux.bin bs=512 count=1. Then file linux.bin on the floppy goes into Windows as c:\linux.bin, and c:\boot.ini is modified to add the line c:\linux.bin = "Linux".

Also my file /boot/grub/grub.conf looks much like yours. Mine is

# grub.conf generated by anaconda
#
#Note that you do not have to rerun grub after making changes to this file
# NOTICE: ]You have a /boot partition.This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd1,2)
# kernel /vmlinuz-version ro root=/dev/sdb1
# initrd /initrd-version.img
#boot=/dev/sda
default=2
timeout=5
splashimage=(hd1,2)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.9-1.667smp)
root (hd1,2)
kernel /vmlinuz-2.6.9-1.667smp ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-1.667smp.img
title Fedora Core-up (2.6.9-1.667)
root (hd1,2)
kernel /vmlinuz-2.6.9-1.667 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-1.667.img
title Windows
rootnoverify (hd0,1)
chainloader +1

Finally, if it can shed any light on the situation, my file linux.bin, as viewed by od -x linux.bin is as follows:

0000000 48eb 0090 0000 0000 0000 0000 0000 0000
0000020 0000 0000 0000 0000 0000 0000 0000 0000
*
0000060 0000 0000 0000 0000 0000 0000 0000 0203
0000100 00ff 8000 c758 0052 0800 80fa 80ca 53ea
0000120 007c 3100 8ec0 8ed8 bcd0 2000 a0fb 7c40
0000140 ff3c 0274 c288 be52 7d79 34e8 f601 80c2
0000160 5474 41b4 aabb cd55 5a13 7252 8149 55fb
0000200 75aa a043 7c41 c084 0575 e183 7401 6637
0000220 4c8b be10 7c05 44c6 01ff 8b66 441e c77c
0000240 1004 c700 0244 0001 8966 085c 44c7 0006
0000260 6670 c031 4489 6604 4489 b40c cd42 7213
0000300 bb05 7000 7deb 08b4 13cd 0a73 c2f6 0f80
0000320 f084 e900 008d 05be c67c ff44 6600 c031
0000340 f088 6640 4489 3104 88d2 c1ca 02e2 e888
0000360 f488 8940 0844 c031 d088 e8c0 6602 0489
0000400 a166 7c44 3166 66d2 34f7 5488 660a d231
0000420 f766 0474 5488 890b 0c44 443b 7d08 8a3c
0000440 0d54 e2c0 8a06 0a4c c1fe d108 6c8a 5a0c
0000460 748a bb0b 7000 c38e db31 01b8 cd02 7213
0000500 8c2a 8ec3 4806 607c b91e 0100 db8e f631
0000520 ff31 f3fc 1fa5 ff61 4226 be7c 7d7f 40e8
0000540 eb00 be0e 7d84 38e8 eb00 be06 7d8e 30e8
0000560 be00 7d93 2ae8 eb00 47fe 5552 2042 4700
0000600 6f65 006d 6148 6472 4420 7369 006b 6552
0000620 6461 2000 7245 6f72 0072 01bb b400 cd0e
0000640 ac10 003c f475 00c3 0000 0000 0000 0000
0000660 0000 0000 0000 0000 0000 0000 0000 0000
*
0000760 0000 0000 0000 0000 0000 0000 0000 aa55
0001000

I'm still looking for help. Thank you all,

tcnm
 
Old 11-24-2008, 12:58 PM   #13
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
i would suggest that you pull off all important data off that drive and copy it to a dvd .then install fedora 9 ,or in a week or 3 ,Fedora 10 .
 
Old 11-24-2008, 06:18 PM   #14
okos
Member
 
Registered: May 2007
Location: California
Distribution: Slackware/Ubuntu
Posts: 609

Rep: Reputation: 38
If it is necessary to keep all of your info in tact, I suggest to use the GAG bootloader. It is nonintrusive and works quite well. It is easy to install and remove. I know because I used it before.

See here
http://gag.sourceforge.net/

okos
 
Old 11-24-2008, 08:33 PM   #15
centguy
Member
 
Registered: Feb 2008
Posts: 627
Blog Entries: 1

Rep: Reputation: 48
may it is too late to provide any help. But there is a nice article that
help with a similar to situation to others.

http://www.stoltenow.com/archives/20...alling_wi.html
 
  


Reply

Tags
installation



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Reinstallation With Existing Linux partition soulxcavtor General 3 06-11-2006 09:44 PM
Linux GLIBC reinstallation mkrishnanand Linux - Software 1 03-21-2004 06:07 AM
Reinstallation of Linux is happening at an alarming rate moses Linux - General 13 11-25-2002 04:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:04 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