LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-15-2007, 09:51 AM   #1
cyb3rdawn
LQ Newbie
 
Registered: Aug 2006
Posts: 21

Rep: Reputation: 15
OS boot loader


Hi. i run ubuntu 7.04 and xp on the same machine, and i need to reinstall the windows. the problem is that if i reinstall it the windows os loader will pop up and there is no way that i can choose to run linux.
i've tried several different os loaders(a long time ago, so i don't remember exactly which), and they seemed to be fine with loading windows, but they could not load linux (i ran warty warthog then). should i somehow disable lilo? can you recommend me an os loader that works, or is there any other way?
 
Old 06-15-2007, 10:50 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Windows will take over the MBR when you re-install xp. It should be easy to fix.

After installing xp, boot the Ubuntu install cd. You may see an option to boot from cd or hard drive. Choose one. When Ubuntu is up an running, just run grub-install again to put it back on the MBR and have dual boot.

I haven't done it in quite a while, but I beleive the sequence goes like this:
Open a terminal, and go to the grub prompt: grub <enter>
Then: grub-install /dev/hd0
Exit and re-boot to verify that it worked.

You will probably have to do a sudo to get root authority. Something like 'sudo grub'.

Last edited by bigrigdriver; 06-15-2007 at 10:52 AM.
 
Old 06-15-2007, 03:59 PM   #3
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
Actually the grub-install command is a terminal command to be issued inside the installed Linux and will not work without prior connection with the installed version. As such Grub need to know where the Grub comes from by the use of the "root" statement.

If the Ubuntu has been installed in say (hd0,1) or the 2nd partition of the 1st disk (or sda2 to Ubuntu Linux) then the commands in a Grub shell are
Code:
sudo grub
root (hd0,1)
setup (hd0)
will instruct Grub to "source" the Grub files from (hd0,1) and install itself in the MBR or the whole of the disk sda.

Alternatively without a Grub shell but grub-install one needs to mount the partition first like
Code:
sudo mkdir /mnt/sda2
sudo mount /dev/sda2 /mnt/sda2
sudo chroot /mnt/sda2
grub-install /dev/sda
exit
The red commands above change root from the boot-up CD Linux into the unbootable Ubuntu inside partition sda2. Therefore grub-install is issued "inside" the unbootable Linux.

Both methods work satisfactorily. The latter does not need the original Ubuntu installation CD but any Live CD will do because one boots up the kernel of the Live CD but is actually using the Bash shell of the unbottable Linux. Therefore the same method of using any Live CD can be used to rescue a Lilo whose equivalent command to "grub-install /dev/sda" is just "lilo -b /dev/sda" at the terminal.

Last edited by saikee; 06-15-2007 at 04:03 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
wireless Keyboard not working to select boot options (Grub boot loader) psrini_vasan Fedora 7 12-16-2009 05:45 PM
Create a boot CD (start up disc) to reinstall boot loader Red Hat 9 johnnylinux Linux - Laptop and Netbook 2 08-03-2006 10:19 AM
To load/boot Red Hat Enterprise Linux 4 WS from Microsoft's Boot Loader (NTLDR) dhawal Red Hat 1 09-25-2005 07:08 AM
Grub boot loader menu shows two linux boot options pramos Linux - Newbie 3 09-12-2004 11:40 PM
How to add a boot record which used to startup windows under my Grub boot loader? yunxiang Linux - Newbie 6 02-01-2003 02:22 AM

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

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