Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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
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.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
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.
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
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Quote:
Originally Posted by okos
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.
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.
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
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:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.