LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-25-2005, 03:58 AM   #1
Mickaletto
Member
 
Registered: Nov 2005
Posts: 32

Rep: Reputation: 15
replace lilo loader with windows loader


Hello,
yesterday I installed Mandrake 9.0. I choose default installation ad it didn't aske me where to place bootloader, so lilo loader is automatically placed in MBR. My question is how to enable windows to boot linux. This way Linux loader gives me option to boot windows, but I want exactly opposite. I want this, because, probably I'll move to newer distribution of linux, so I assume there will be problem if I want to remove linux. If I remove it I'll need to reinstall winows. Is there any way to remove linux, and yet not to reinstall windows when bootloader is lilo?
Thanks
 
Old 11-25-2005, 05:04 AM   #2
BinJajer
Member
 
Registered: Sep 2005
Location: Warsaw, Poland
Distribution: Slackware 10.2, Caldera OpenLinux 3.1, Corel Linux (Thanks xhi!), Debian GNU/HURD etc...
Posts: 296
Blog Entries: 1

Rep: Reputation: 30
Yay.
1.There is no such possibility fo microsoft's osloader to load linux.
2. Do not remove, upgrade. If you have a newer version of Mandrake/Mandriva
you just press upgrade on install prompt.
3.If you will want to move to another distro, you will not need windows. You will have no regrets after trashing it

For tutorial: Email me.

Peace
Binjajer
 
Old 11-25-2005, 05:08 AM   #3
migs
LQ Newbie
 
Registered: Nov 2005
Location: Manila, Philippines
Distribution: Slackware
Posts: 11

Rep: Reputation: 0
bootloader

well, if you want to remove linux eventually, you can:

a: if on winXP

boot from the install cds, and do a fixmbr from one of the console options from the cd (dont ask me which, i didnt stay around long enough for win XP).

b: any lower version of windows

make a bootdisk from windows, boot from it, and do an fdisk /mbr.

now if you want to use the windows bootloader, thats a bit more involved, see this for details. http://www.tprthai.net/bootmgr.htm

it was done on rh 8, but should still apply.

---> oh, but since the bootloader is already lilo, just stick with that for now.

Last edited by migs; 11-25-2005 at 05:11 AM.
 
Old 11-25-2005, 06:00 AM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
migs instruction is for restoring the Windows MBR and will destroy the current multi-boot facility, rendering the Linux inaccessible.

The information is slightly inaccurate too because the two methods produce the same end result. I go against the tide by using a DOS floppy to restore a XP's MBR and using a XP installation CD to restore a DOS MBR (run 3 Dos and 4 Windows in my box) but never met any resistance.

What Mickaletto needs is to use NTldr, available as Win2k and XP own boot loader, to boot Linux. The method is well published in many sites and this is one.

The NTldr is about 5 times more effort than Lilo for multi-booting because it needs each Linux installed first so than part of its bootloader can be copied into XP or Win2k directory.

If a new distro is installed then the existing Lilo, if retained, can boot it by editing its /etc/lilo.conf.

You can make Lilo to boot a maximum of 15 systems. NTldr can do 10 but Grub, the other Linux boot loader installable in Mandrake, has no limit.
 
Old 11-25-2005, 07:00 AM   #5
10xOXR
Member
 
Registered: Nov 2003
Location: Scotland
Distribution: Gentoo 2005.0
Posts: 49

Rep: Reputation: 15
* Step1 Install your favourite linux
* step2 On installation DONT install your linux on your MBR, install it in the bootsector of your linux partition
* step3 After installation boot linux using the linux rescure disks.
* step4 login as root, open a terminal window and enter the following CODE

Code:
dd if/dev/hdd1 of /temp/boot.lnx bs=512 count=1
p.s. in this CODE example i installed linux on my 4th hd (thats why its hdd ), on partition 1
p.s.s. if you got a SCSI hd the code should look like some thing like this:

Code:
dd if/dev/sda1 of /temp/boot.lnx bs=512 count=1
as you can see instead of hdd1 i typed sda1

Meaning 1st SCSI hd (hd =IDE hd's) sd = SCSI hd's

so if ya install linux on your 1st hdd (aka hd A) replace the D with the A ;-), same counts for the number ;-)

* step5 Now you copy "/tmp/boot.lnx' to your floppy disk using the following command

Code:
mcopy /tmp/boot.lnx a:
* step6 Boot windows (using NTLDR)
* step7 Copy the boot.lnx to your c:\ directory
* step8 Open your boot.ini (its hidden so ya have to make it visable ;-) )
* step9 Add under Operating systems the following line

Code:
c:\boot.lnx="Linux"
* step10 Now quit the file, safe it and your done
* step11 1 thing though --> wenn updating your linux kernel, ya have to redo this step because boot.lnx will other whise still containing the OLD kernel.
* step12 these steps will be only possible when NOT installinx GRUB/LILO on your MBR, yet in your linux boot dir

what advantage??: Windows is allowed to overwrite your MBR, so you dont have 2 be afraid that your linux wont boot ;-)

Example of boot.ini before add of linux
Code:
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /NoExecute=OptIn
Example of Boot.ini after add of linux

Code:
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /NoExecute=OptIn
c:\boot.lnx="linux"
 
Old 11-25-2005, 08:15 AM   #6
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Step 4 & 5 may be commbined
Quote:
dd if=/dev/sda1 of=/dev/fd0/boot.lnx bs=512 count=1
there should be a "=" after input file (if) and output file (of) too.

Also there is no need to use Linux rescue CD, any Linux Live CD can do it.
----------------------------------------------------------

Howver as an example to show how easy it can be done in Grub

Step (1)

Make a bootable Grub floppy (that can boot any system in a PC) following Chapter 3.1 of [url=http://www.gnu.org/software/grub/manual/grub.html]Grub Manual], requiring 2 lines of dd command in Linux.

Step (2)

Boot into Mandrake, log is as root and replicate its boot loader inside its root partition ( assuming it is hda2 but adjust partition reference to suit your circumstance)

lilo -b /dev/hda1

Step (3)

reboot with Grub floppy and boot the system manually with these 3 lines

root (hd0,0)
chainloader +1
boot

for Windows in hda1. To boot Mandrake in hda2 change first line to

root (hd0,1)

If you want to type the minimum the 1st and 2nd line can be combined into

chainloader (hd0,0)+1

The same Grub floppy can boot any of my 60+ systems in my box, using exactly the above 3 lines by altering the partition reference. For M$ systems I need a couple extra lines to hide unwanted partitions in front of a "C" drive and re-map the disks on-the-fly if needed.

The booting by Grub can be automated in any distro, that has Grub installed, with its /boot/grub/menu.lst that can be put in a floppy, a CD or the MBR.

Personally I prefer one method to boot all DOS, Windows, Linux, BSD and Solaris. Only the simplest is the best.

I wouldn't shoot down WIn2k/XP's NTldr as I use it in my army of bootloaders in the box too but it is rather messy by the Linux standard. Also it doesn't seem to to able to manage 3 Dos and 4 Windows from its own camp even before I add BSD, Linux and Solaris to it.


Last edited by saikee; 11-25-2005 at 08:36 AM.
 
Old 11-25-2005, 09:05 AM   #7
Mickaletto
Member
 
Registered: Nov 2005
Posts: 32

Original Poster
Rep: Reputation: 15
Thank you guys for your help.
Now I want to check to make sure I understood procedure correctly.
For, now please, forget that I want to upgrade, it will happen in near future, but not now.

Since, I already installed linux with automatic installation it palced lilo in MBR
(it didn't ask me). Linux is installed on second hard drive (hdb) but I assume
lilo is on hda (MBR is on hda, right?)

1. I'll find terminal window and type this:
Code:
dd if/dev/hda1 of /temp/boot.lnx bs=512 count=1
(I assume loader is on hda)

2. I'll copy it to floppy by typing this:
Code:
mcopy /tmp/boot.lnx a:
3. I'll put win XP installation CD in cdrom, boot from it and use fixmbr
and eventually copy NTLDR and NTDETECT.COM from winXP cd to C:

4.After doing that, I assume, I'll be able to boot windows using NTLDR boot loader
(At this time, I'll have no chance to boot linux since NTLDR is placed in MBR)

5.I'll copy boot.lnx from floppy to c:

6. In boot.ini I'll add line:
Code:
c:\boot.lnx="Linux"
7. So, eventually boot.ini will look like this:
Code:
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /NoExecute=OptIn
c:\boot.lnx="linux"
8. After restarting computer, hopefully, win loader will give me opportunity to choose between
windows XP and linux

Is this the right algorithm? Remember, I alredy have windows XP and Mandrake 9.0 linux installed,
just lilo is placed on MBR because of automatic installation nad I'm trying to achive that instead
of lilo I use NTLDR loader.

Now, here, I see one potential problem. I need to somehow transfer lilo from hda (from MBR) to hdb
to be able to boot linux from NTLDR. I assume I'll need one more step between steps 1 and 3.
Can you help me here?
 
Old 11-25-2005, 10:37 AM   #8
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
You are right in thinking that something is missing between Step 1 and 3. That step is to have Lilo in the "proper" location which is the boot sector of Manddrake partition. Every partition, be it a primary or a logical, is always created with the entire sector 0 reserved for the boot loader and the filing system always starts from sector 1. Therefore in the Step 2 of my Post #6 I ask you to replicate Lilo in Mandrake's root partition so that you have a copy to play around with.

If you have put Mandrake in a second disk called hdb then there is a good chance Mandrake's root "/ "is hdb1 and so

lilo -b /dev/hdb1

will leave Lilo permantly inside Mandrake partition. If you want a bomb-proof job then drop in a floppy and repeat the above statement with "hdb1" substituted by "fd0" so that you can boot to the floppy to your current situation after Lilo has gone.

NTldr chainloads a Linux in exactly the same way Lilo (or Grub) chainloads a Windows, except in a messier manner. While Linux's way only the partition number needs to be identified NTldr has to copy Lilo's first 512 bytes in to the "C" drive of the Windows.

Thus the command

dd if=/dev/hdb1 of=/dev/fd0/boot.lnx bs=512 count=1

instructs Mandrake to write natively on device floppy0 an output file called boot.lnx using the input from device partition hdb1, using one count of a block size 512 bytes. (MBR is 512 bytes large)

You then proceed to nuke Lilo in the MBR by overwriting it with XP installation CD, boot to it, drop into the recovery console and type fixmbr.

For your information this is a snobbish method because the same can be achieved by booting a DOS floppy and type fdisk /mbr.

Normally in an XP installation NTLDR and NTDETECT.COM should have been installed in your "C".

After nuking Lilo with XP's MBR you should boot to XP but without access to Lilo. You can still boot to Mandrake using the Lilo floppy I suggested. Mandrake is always accessible by booting to any Live CD and change root to it.

You will now copy the first 512 bytes of Lilo, from file boot.lnx off the floppy, into the C drive. This is necessary for XP because the bugger does not support Linux and has no ability to mount Mandrake's partition to chainload Lilo, so it chainloader Lilo's first 512 byes and leaves Lilo to do the rest to pull up Mandrake.

You will need to unhide boot.ini, by altering its attributes, and this must be done in command prompt by editor, as boot.ini is a protected system file.

In boot.ini you'll add line:

c:\boot.lnx="Mandrake"

You will save the file, hide it again by restoring the original attributes.

On reboot you can have Mandrake as the additional choice.

The reason I say NTldr is messy because

(a) You need to unhide and hide boot.ini everytime.
(b) you need to repeat the full exercise everytime you add a new system
(c) You need to repeat the full exercise everytime you alter Lilo within Mandrake
(d) Lilo boots a Linux by absolute address in the hard disk so any shifting of its partition will render Lilo booting to a wrong position with a full screen of 99 and Lilo will has to be replicated again. That need a repeated exercise with boot.ini

In Lilo's way you can edit /etc/lilo.conf, which is the equivalent to XP's boot.ini, in Mandrake's desktop or if you prefer even from any Linux booted from a Live CD. There is no boot loader to be copied around in Lilo too.


Last edited by saikee; 11-25-2005 at 10:41 AM.
 
Old 11-25-2005, 03:59 PM   #9
Mickaletto
Member
 
Registered: Nov 2005
Posts: 32

Original Poster
Rep: Reputation: 15
Here is my lilo.conf copy:
Code:
boot=/dev/hda
map=/boot/map
vga=normal
default=WindowsXP
keytable=/boot/croat.klt
prompt
nowarn
timeout=200
message=/boot/message
menu-scheme=wb:bw:wb:bw
image=/boot/vmlinuz
	label=linux
	root=/dev/hdb1
	initrd=/boot/initrd.img
	append="quiet devfs=mount hdc=ide-scsi"
	vga=788
	read-only
image=/boot/vmlinuz
	label=linux-nonfb
	root=/dev/hdb1
	initrd=/boot/initrd.img
	append="devfs=mount hdc=ide-scsi"
	read-only
image=/boot/vmlinuz
	label=failsafe
	root=/dev/hdb1
	initrd=/boot/initrd.img
	append="failsafe devfs=nomount hdc=ide-scsi"
	read-only
other=/dev/hda1
	label=WindowsXP
	table=/dev/hda
other=/dev/fd0
	label=floppy
	unsafe
I can conclude from this that lilo is placed to MBR, so first I need to copy it to other drive (hdb) with lilo -b /dev/hdb1
and then to do the rest.
Am I right?
 
Old 11-25-2005, 06:26 PM   #10
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
If your PC boot to Lilo then Lilo must be in the first bootable drive's MBR.

Putting Lilo in hdb isn't exactly the same as in hdb1 because the former refers to the MBR of the 2nd disk and MBR holds only the stage 1 of a boot loader. The latter means the complete boot loader of stage 1 and stage 2 of Lilo is be inside hdb1 partition which is the root of your Mandrake, as confirmed by your Lilo.conf.

Your XP is in hda1

So go ahead. As you have the instructions to boot both systems with

(1) NTldr
(2) Lilo in a floppy
(3) Grub in a floppy
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
LILO Boot Loader drumstick Linux - Software 1 05-20-2005 03:18 AM
Removing Lilo, restoring to windows boot loader seeker131 Linux - Newbie 7 03-01-2005 05:26 PM
LILO Loader disappeared !!~~ AoiSora Linux - Newbie 4 01-21-2004 12:28 AM
NEED your help! cannot startup LILO loader vwhk Linux - General 13 10-11-2002 07:24 PM
LILO ate my NT loader - Help, please feaz Linux - Software 3 04-27-2002 12:22 AM


All times are GMT -5. The time now is 08:14 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration