LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - Installation
User Name
Password
Slackware - Installation This forum is for the discussion of installation issues with Slackware.

Notices



Reply
 
Search this Thread
Old 01-24-2008, 02:03 AM   #1
andreas_skw
Member
 
Registered: Jan 2008
Location: Indonesia, tanah air beta
Distribution: Knoppix v5
Posts: 97

Rep: Reputation: 15
Slackware's LILO overwrite XP's MBR


Hello eveyone, yesterday, i suceed installed Slacware 12. When i tried to XP, it error "NTLDR has gone". What should i do? How i can restore XP?
 
Old 01-24-2008, 04:17 AM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 5,393

Rep: Reputation: Disabled
You can add an entry to start your Windows to the LILO boot screen. USually you would do that during installation of Slackware at the step where you configure LILO and one of the questions is "Add a Windows FAT or NTFS partition to the LILO config".
You can still fix this by starting Slackware and running the command
Code:
liloconfig
and make sure that this time your Windows partition gets added to /etc/lilo.conf . The liloconfig program should be able to detect your Windows partition and advise you to add it as an entry to the boot selection.

Eric
 
Old 01-24-2008, 04:51 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,499

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Seems like he already has a XP entry - presumably pointing to the wrong partition. @andreas_skw, enter these commands from a terminal, and post all the output
Code:
grep -v /etc/lilo.conf
/sbin/fdisk -l
 
Old 01-24-2008, 03:50 PM   #4
Erik_FL
Member
 
Registered: Sep 2005
Location: Boynton Beach, FL
Distribution: Slackware
Posts: 801

Rep: Reputation: 247Reputation: 247Reputation: 247
To restore the "standard" Windows MBR code, you can use the Recovery Console. That will allow Windows XP to boot (using NTLDR) but not Linux. Normally one would only do this when uninstalling Linux.

To restore the Windows MBR, boot from your Microsoft Windows XP Setup CD. If you have only a CD from Gateway, Dell, etc. then you can download a set of floppy disks from the Microsoft site. Boot from the CD or floppy disks and select the options to use the Recovery Console (not automatic repair).

Enter this command to restore the Windows Master Boot Record.

fixmbr

You do not have to install LILO to the Master Boot Record. You can install LILO to the partition boot sector for the Linux root partition. If you want LILO to boot first instead of Windows NTLDR then use the "fdisk" or "cfdisk" program in Linux to change which partition is the active "Boot" partition. To boot Linux first, make the Linux partition the "Boot" partition and remove the "Boot" designation from the Windows partition. Since you can't boot Linux until you do this, use a Linux boot CD to run "cfdisk" or "fdisk".

As mentioned in the previous post, you can add Windows to the LILO boot menu. You can also add LILO to the Windows boot menu, though it is more complicated. The advantage is that you can boot Windows NTLDR first and then select LILO. Depending on which partition is the "Boot" partition you can have either LILO or Windows NTLDR start first.

Here are the steps involved in adding Linux to the Windows XP boot menu.

Boot Linux and make a copy of the Linux root partition boot sector after installing LILO. You will have to repeat the following steps every time you change your LILO boot configuration or kernel image. I've found that GRUB is a little easier to deal with since you only have to do these steps once.

This is the Linux command to copy the Linux boot sector to a file.

dd if=/dev/hda2 of=/tmp/bootsect.lnx bs=512 count=1

Replace the "hda2" with the correct device name for your Linux root partition.

Next you have to transfer the file "bootsect.lnx" to your Windows XP partition's root directory. One way to do that is using a floppy disk. Another way is to use a partition such as FAT32 that both operating systems can access.

If your Linux partition is on the first hard disk (not first drive letter!) then you don't have to modify the file. If Linux is not on the first hard disk, then you have to change the drive identifier in the file.

Add the Linux boot sector file to your Windows boot menu. Remove the read-only attribute from the file "boot.ini" in the Windows root directory. That's a hidden file, so turn on the option in the folders to show hidden and system files. Use notepad to edit "boot.ini".

[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP" /fastdetect /NoExecute=OptOut
C:\BOOTSECT.LNX="Slackware Linux"

I showed the lines that you add or change in bold. The timeout can be any number of seconds, and 0 will not display any menu (you have to press F8 for the menu).

How can you patch the boot sector file for a different drive ID?
One way is to edit the file with the "debug" program in Windows.
Use this command to start the debug program.

debug bootsect.lnx

Then use the (lower case L) "l" command to load the data into memory.

l

Use the "e" command with an offset to enter new data for the drive ID. The offsets start at 100 hex, so offset 0 in the sector is offset 100 in the debug program.

After you are done editing the data, write it back to the boot sector file and exit the debug program.

w
q


Drive IDs are 0x80 for the first hard disk, 0x81 for the second hard disk, etc. And, I do mean hard disk, not drive letter. If letters C, D and E are all on the first hard disk then you use 0x80 for all of them and do not need to patch the boot sector.

Unfortunately the byte that you patch depends on the version of LILO. In some cases you may not even need to patch it because it may be correct. If you want you can try the boot sector file and then patch it if it doesn't work for Linux on some other hard disk.
 
Old 01-27-2008, 08:09 AM   #5
andreas_skw
Member
 
Registered: Jan 2008
Location: Indonesia, tanah air beta
Distribution: Knoppix v5
Posts: 97

Original Poster
Rep: Reputation: 15
thanks everyone, i'll try this @ home.
 
  


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
Does a Windows XP repair install overwrite the MBR? BigFoot13 Linux - General 11 05-06-2007 02:40 PM
Slackware's LILO was overwritten by Vector's LILO ic_torres Slackware 9 02-26-2007 04:59 AM
Windows 2000 *didn't* overwrite the MBR vharishankar General 5 12-13-2006 09:30 PM
Windowze will overwrite my MBR purefan Linux - Newbie 5 09-09-2003 07:47 PM
Can't overwrite MBR Elmo Linux - General 2 03-13-2003 02:24 PM


All times are GMT -5. The time now is 09:45 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration