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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
02-02-2007, 01:51 PM
|
#1
|
Member
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408
Rep:
|
Replacing windows boot loader by GRUB
Hi,
I have a dual boot ubuntu edgy and win xp. After not using win xp for a long time, it crashes so i was forced to reinstall it and now my GRUB doesn't appear when I boot my computer.
I don't know how I can go to rescue mode in ubuntu, whereas in fedora there was such option. Anyhow, I used ubuntu cd live and loaded windows and I mounted my linux partition used grub-install /dev/hda
but it doesn't recognize it.
my windows partition is in /dev/hda1
file system is in /dev/hda2 and swap is in /dev/hda3
Any idea how to get rid off windows boot loader?
|
|
|
02-02-2007, 02:04 PM
|
#2
|
LQ Guru
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094
|
From the live CD do
Code:
mkdir /mnt/temp
mount /dev/hda2 /mnt/temp
chroot /mnt/temp
grub-install /dev/hda
|
|
|
02-02-2007, 02:41 PM
|
#3
|
Member
Registered: Dec 2006
Distribution: Debian (Wheeze)
Posts: 391
Rep:
|
You should prabaly use a live cd distribution such as knoppix or Ubuntu to reinstall grunb and grub shold land on the NBR of /dev/hda.
|
|
|
02-02-2007, 03:49 PM
|
#4
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
I prefer the grub shell method.
You say that Linux is on /dev/hda2---I assume that there is no separate partition for /boot.
do this (as root):
Code:
grub
root (hd0,1) tells grub that "home base" is hda2
setup (hd0) puts grub in the mbr of hda
This should work from any Linux--liveCD, rescue mode, etc.
|
|
|
02-02-2007, 05:34 PM
|
#5
|
Senior Member
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Rep:
|
Either pljvaldez or pixellany proposal would solve the problem.
The reason the grub-install did not work in Post #1 is because it was not issued "inside" hda2.
pljvaldez proposal is to get "inside" hda2. The method will work for any Live CD because it uses the Live CD kernel in combination with Ubuntu's Bash shell (which has Grub inside).
pixellany proposal achieves the same task from "outside" hda2 and looks simpler but it requires a Live CD having Grub inside in order to invoke a Grub shell.
I am here just to offer an explanation and to make a connection between the two proposals.
Where is the response from the Original Poster?
Last edited by saikee; 02-02-2007 at 05:35 PM.
|
|
|
02-02-2007, 07:19 PM
|
#6
|
Member
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408
Original Poster
Rep:
|
Sorry for late reply,
Thank you for your responds, but non of them worked for me.
when I issue command:
root@ubuntu:/# grub-install /dev/hda2
I get the following result
/dev/hda2: Not found or not a block device.
and when I go inside grub program and I write:
root@ubuntu:/# grub-install /dev/hda2
I get following errir:
/dev/hda2: Not found or not a block device.
|
|
|
02-02-2007, 07:41 PM
|
#7
|
Senior Member
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Rep:
|
I don't think you are doing it right.
First of all hda2 is shown up by your Ubuntu after mounting it so it must exist and is a block device.
Secondly I don't think anybody here asking you to do a grub-install in hda2. It is hda or the whole disk which is equivalent to the MBR of hda.
Thirdly when you go inside Grub program "grub-install" doesn't work because it is a Linux script and not a command in a Grub shell.
Obviously my explanation has produced the opposite effect.
Please post here the output of
|
|
|
02-02-2007, 07:45 PM
|
#8
|
Member
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408
Original Poster
Rep:
|
root@ubuntu:/home/ubuntu# fdisk -l
Disk /dev/hda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 1912 15358108+ 7 HPFS/NTFS
/dev/hda2 1913 4736 22683780 83 Linux
/dev/hda3 4737 4864 1028160 82 Linux swap / Solaris
|
|
|
02-02-2007, 08:02 PM
|
#9
|
Member
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408
Original Poster
Rep:
|
By the way, I have followed both posts exactly as they stated; I didn't run grub-install within grub.
|
|
|
02-02-2007, 08:21 PM
|
#10
|
Member
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408
Original Poster
Rep:
|
Any idea how I can add ubuntu entry to windows boot loader so that I can boot my ubunu?
|
|
|
02-02-2007, 08:28 PM
|
#11
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
Quote:
Originally Posted by mohtasham1983
Any idea how I can add ubuntu entry to windows boot loader so that I can boot my ubunu?
|
If you look at the links in Saikee's sig, you will find MANY different ways of setting up dual-boot. Also, search here on "dual-boot NTLDR".
You don't say if you tried my grub-shell method
|
|
|
02-02-2007, 10:22 PM
|
#12
|
Member
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408
Original Poster
Rep:
|
Your commands work actually. I had a mistype when writing them. Now I have grub back but I am not able to boot it due to following error:
/bin/bash can't access tty
|
|
|
02-02-2007, 11:06 PM
|
#13
|
Member
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408
Original Poster
Rep:
|
i got it working by editing grub menu when booting. instead of hda2 it was written hda3 and so on. Thanks for help
|
|
|
02-03-2007, 04:20 AM
|
#14
|
Senior Member
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Rep:
|
I hate to repeat it but it is 10 times harder to get Windows NTLDR to boot a Linux.
Not many users realise that in order for NTLDR to work the Linux must has a working boot loader first so that its first 512 bytes can be copied into Windows "c" because Windows is so lazy or dumb to come out to fetch it from a partition foreign to itself. You then have to find a way to write the boot loader into a NTFS partition, unhide boot.ini to add Linux's entry, hide boot.ini again and it may not even work reliably. If your Linux uses Lilo and you may need to alter Lilo a few times then you will know what I mean by 10 times harder.
|
|
|
All times are GMT -5. The time now is 04:52 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|