LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-03-2006, 04:06 AM   #16
tramni1980
Member
 
Registered: Jul 2006
Location: Köln, Germany
Distribution: Slackware64-14.2 & -current, DragonFly BSD, OpenBSD
Posts: 819

Original Poster
Rep: Reputation: 55

And something else, prior to installing the lilo the MBR of /dev/hda, I should probaly uninstall it from the mbr of /dev/hdb, where it currently is. How shall I do that? What commands?
The algorithm so long as I comprehend is as follows:
1. uninstall lilo and remove it from the mbr of /dev/hdb.
2. backup the mbr of /dev/hda issuing the command you suggested.
3. running "liloconfig" to install lilo in the mbr of /dev/hda.
4. in case something goes wrong, booting with the slackware cd1 and writing back the backup file to the mbr of /dev/hda?
Tell me if I miss some step, pls.
 
Old 08-03-2006, 11:25 AM   #17
ciotog
Member
 
Registered: Mar 2004
Location: Canada
Distribution: Slackware current
Posts: 728
Blog Entries: 2

Rep: Reputation: 43
You don't have to bother with clearing the mbr of /dev/hdb - in fact, if the BIOS is instructed to boot from /dev/hda but it can't, it will then try /dev/hdb. If it does boot from /dev/hda then what's on the mbr of hdb makes no difference.

Same as if you had a bootable cd in your optical drive, but boot from the HDD first.

The only reason why I mentioned being able to boot from a boot disk is in case for some reason you are unable to boot from either HDD (which isn't likely to happen).
 
Old 08-03-2006, 02:17 PM   #18
tramni1980
Member
 
Registered: Jul 2006
Location: Köln, Germany
Distribution: Slackware64-14.2 & -current, DragonFly BSD, OpenBSD
Posts: 819

Original Poster
Rep: Reputation: 55
ok, and what about my other question: do I have the option to supply an absolute path at the "of=./mbr+ptable.hda", something like "of=/mydirectory/./mbr+ptable.hda". hmmm..the "/./" sequence seems odd...This in case something goes wrong and neither /dev/hda, nor/dev hdb boots.
And something else, probably stupid, but I have to ask, in the worst case, does formatting the hard drives clear the MBRs, so that after a fresh installation there is no trace of the previous boot sectors?
 
Old 08-04-2006, 12:32 AM   #19
ciotog
Member
 
Registered: Mar 2004
Location: Canada
Distribution: Slackware current
Posts: 728
Blog Entries: 2

Rep: Reputation: 43
The location of the output could be any directory, and whatever you want to call it. The "./" part of the path just refers to the current directory (just like you run ./configure when you're building from source to run the "configure" script in the current dir). The resulting file can also be copied anywhere.

As for formatting, that depends if you're doing a low level format of the HDD or just formatting the partitions. With the former you should end up with a completely blank drive, in the latter generally you're just marking the area as unused, not even really altering what's there. If you're really interested in clearing the MBR you can just use the dd command and write 0s across it.

For more information about the dd command you might want to read this:
http://wiki.linuxquestions.org/wiki/Dd
 
Old 08-04-2006, 02:27 PM   #20
tramni1980
Member
 
Registered: Jul 2006
Location: Köln, Germany
Distribution: Slackware64-14.2 & -current, DragonFly BSD, OpenBSD
Posts: 819

Original Poster
Rep: Reputation: 55
I am eager to share with you what I found out today. It seems that I finally got the knack of my system, although still I am not quite contented.
So, yesterday I made some mistake and today I had to reinstall. So I decided to get completely certain about the nature of my lilo problem. So I made a fresh Slackware installation and tried to load Windows - success, lilo did it just as I expected. Then I made a backup of the MBR of /dev/hdb:
dd if=/dev/hdb of=./bootsect.hdb count=1 bs=446
Then I loaded Slackware and ran
lilo
as root; rebooted; chose "Windows" at the lilo command prompt - the system froze, just as I had expected. Then I loaded Slackware, and removed the MBR from /dev/hdb:
dd if=/dev/zero of=/dev/hdb count=1 bs=446
Then I wrote there back the backup file:
dd if=./bootsect.hdb of=/dev/hdb count=1 bs=446
Then I rebooted:
reboot
As a result lilo crashed: it only spat a flood of 8s,9s and 0s . So I booted via the Slackware Cd1, logged in as root and typed:
lilo
It said:"Warning : /dev/hdb is not the first drive
Added Slackware *
Added Windows"
Then I rebooted and. The lilo prompt emerged ok, I chose "Windows", and oh, God: Windows loaded. Then I rebooted and chose Slackware:again success.
To be completely sure that this is not a mere matter of chance, as root in Slacware I ran lilo and rebooted. When I chose "windows" at the prompt, the system again froze.
So I repeated the whole procedure again: deleted the mbr of /dev/hdb, wrote there the backup mbr, rebooted, lilo crashed, I rebooted with the Slackware cd, typed "lilo", rebooted, at the prompt I chose "Windows", and everything was ok again.
I tested that procedure without the rebooting after the writing the backup file to the mbr of /dev/hdb, but there was no success-the system froze when I chose "Windows" at the prompt.
Besides I find out that lilo is capable of booting windows if and only if after runing "lilo", lilo warns that "Warning:/dev/hdb is not ypur first drive". If this warning is not present, i.e the message of lilo is simply:"Added Slackware *
Added Windows", Windows cannot be loaded at the lilo prompt at rebooting.
This all sounds quite awkward to me, I have no explanation. Do you have any idea?
One might say that I have solved my problem, but what if I decide to add something to my lilo.conf, which is not automatically added by the slackware installation script? I will then have no reserved boot sector, working ok....It seems to me that the whole issue is that I am trying to boot Windows from the mbr of the slave drive, i.e., lilo is installed not on the master drive, but on the slave. But still, why does it work in the situation I described you above?!
 
Old 08-05-2006, 01:47 AM   #21
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
You still haven't tried any of the things suggested. There are quite a few thousand of us succesfully multi-booting Slackware using any number of methods.
It's not really a great idea to be writing partial sectors.
As I mentioned a warm reboot and cold boot are not the same -in a warm boot some of the info in the BIOS is not flushed.
When multi-booting with MS Windows it best to try and keep windows happy as pertains to two things -partitioning and bootloader.
The bootsector is not part of any partition. When you install windows it writes its' own 512 byte bootsector into the first sector of /dev/hda. Installing lilo under linux normally just replaces that first sector with lilo. Of course it has to be right or your machine is unbootable. That's whay I always run liloconfig and choose to install to floppy. Then when I see that it's okay *manually edit the lilo.conf and change fd0 to hda and rerun lilo* which then installs it to hda

Your BIOS goes in search of devices in order -A,B,C,D -that's fd0, fd1, hda, hdb to lilo and the linux kernel. Most BIOS'es will not let you choose to boot hdb instead of hda, if both are present. You can of course change the search order and cdroms are included, sometimes and somewhere in the list, now USB devices and netboot as well.
Once the BIOS 'sees' a device connected, it tries to load the first sector of the disk into RAM and execute it. If the disk has been installed with Windows the bootcode(446 bytes) tells the BIOS to look for the first *bootable* partition it finds and boot that. This partition info is the other 66 bytes of the first sector. This is why windows is only happy if there is just one bootable partition. This should always be the partition where windows is installed.
 
Old 08-05-2006, 03:53 AM   #22
tramni1980
Member
 
Registered: Jul 2006
Location: Köln, Germany
Distribution: Slackware64-14.2 & -current, DragonFly BSD, OpenBSD
Posts: 819

Original Poster
Rep: Reputation: 55
My BIOS is currently set to boot /dev/hdb first and then /dev/hda. /dev/hda1 and /dev/hdb1 are the bootable partitions. /dev/hdb is slave, and /dev/hda is master. Windows is on /dev/hda and Slackware is on /dev/hdb.
I read carefully what you wrote to me, but still I did not get a clear idea why my lilo behaves so strangely with booting Windows. Do you mean that I should toggle /dev/hdb1 unbootable, so that only /dev/hda1, which is the "C" windows partition, remains bootable? Won`t there be a problem , since BIOS will first try to boot from the slave, which has no bootable partitions? And since lilo is installed in the MBR of the slave, will it run since the slave has no bootable partitions?
 
Old 08-05-2006, 04:53 AM   #23
tramni1980
Member
 
Registered: Jul 2006
Location: Köln, Germany
Distribution: Slackware64-14.2 & -current, DragonFly BSD, OpenBSD
Posts: 819

Original Poster
Rep: Reputation: 55
which of the following statements is not true about lilo:
1. lilo has to be installed on a bootable partition
2. lilo has to be installed on a partition of the master drive
So long as I understand lilo needs to be installed neither on a bootable, nor on a master drive partition. The only thing that is necessary is that the "C" windows partition has to be the only bootable partition, no matter where lilo is installed, which drive is master and which slave and sequence in which BIOS tries to boot the drives?
 
Old 08-05-2006, 06:17 AM   #24
Slim Backwater
Member
 
Registered: Nov 2005
Distribution: Slackware 10.2 2.6.20
Posts: 68

Rep: Reputation: 15
Boot Order

This is how the boot order of a PC works, hopefully you'll see where and why it's going wrong:

1. BIOS
- A modern BIOS chooses a boot drive, usually and traditionally it's always been the primary master IDE drive.
- What does this "choose" mean? Simply it means that the BIOS loads the MBR and executes it. That's it. Something reasonable must exist in the MBR for the BIOS to pass control to.

2. MBR
- There are two major MBR's to consider. The first is the Dos/Windows MBR code (used for years and years and years) and the second is the Linux LILO (or GRUB) MBR code.
- How do they differ? The DOS MBR simply reads the partition table, finds the first partition marked 'bootable' and executes the the "superblock". For a DOS, that's something like the IO.SYS or MSDOS.SYS
- The LILO MBR (and GRUB) behave entirely differently. They are written with more intelligence. LILO presents a menu which actually represents a block offset to load (nothing to do with partitions marked bootable). If you choose a linux partition you are selecting the block offset of the linux kernel. LILO simply starts to load whatever is at that block offset and passes control to it. This is why you have to rerun LILO everytime you change your kernel - It's written to different places on the disk and the Lilo MBR needs to be updated with that pointer.
- When LILO is trying to boot a DOS (or windows) partition, it's pointing to the block of IO.SYS (or MSDOS.SYS), and does the same thing.

3. The O/S Kernel
- Whatever O/S you choose to boot, the bootloader executes the O/S bootstrap. For linux, this is the linux kernel, for Dos/Win it's IO.SYS (or MSDOS.SYS).
- This is where the O/S begins to look for it's drivers and does all it's configuration.
- The Linux Kernel, once loaded, starts looking for it's root filesystem, but it must find it using it's own drivers, it can't use the BIOS or the Bootloader to do that. If you don't have the right drivers for your Root Filesystem compiled into kernel, you'll get the common kernel panic, (along the lines of) "cannot load init". The kernel simply can't see the the root device or the filesystem to continue.
- An alternative to compiling the drivers into the kernel is to create an initrd. This file is a filesystem that is copied into memory (I think by LILO) and the Linux kernel actually boots off that and then after the proper drivers are loaded, it pivots it's root off the initrd to the real root, and continues to boot up.

The fact that you've got your BIOS booting off your Primary/Slave (a non-typical boot method) threw a few people off.

Additionally, you can't switch back and forth, installing LILO to the MBR and/or to the ROOT (SuperBlock), you'll only get really confused because the MBR ALWAYS RUNS FIRST.

So if you do an install and choose the MBR, then do another install and choose the ROOT, when you reboot, the MBR that gets loaded will be the OLD config, and because it contains a pointer to the old install, it won't load.

The only time I know of when you should choose to install LILO to the ROOT instead of the MBR is when you *know* you have a special MBR (Disk translation, etc). Otherwise, you should always install to the MBR.

If you're going to do a reinstall, I'd suggest you swap your master/slave drives (so windows becomes the slave) and update the BIOS to boot off the first disk. Then LILO and the install will have a clear view of your system, (no "hdb is not the first disk" warnings).

They try running liloconf and choose the simple install and install to the MBR of HDA. The simple config will find everything including the Windows partition and on reboot give you a menu with the correct options and current offset markers and everything should work fine.

After that if you want to boot windows, choose the LILO menu option, OR you can change your BIOS boot order to boot from the second disk.

Finally, if you drives are SATA, things get even more confusing because the install sees the drives as the BIOS does (calling them hda), but after you reboot, the kernel loads the SATA drivers and calls them sda and so your FSTAB needs to be updated and it's just more fun.

Once you understand what's going on, anyboot loader will work fine, and it's always predictable and consistent.

Good luck.
 
Old 08-05-2006, 08:23 AM   #25
tramni1980
Member
 
Registered: Jul 2006
Location: Köln, Germany
Distribution: Slackware64-14.2 & -current, DragonFly BSD, OpenBSD
Posts: 819

Original Poster
Rep: Reputation: 55
If swap my drives so that the windows drive becomes slave and the linux master, will I have to reinstall Slackware? Won't just wiping off the MBR of the linux drive and then running liloconfig work?
To be more clear, after the swapping of the drives, what shall I do so that lilo works ok?
Assume I will install lilo to the MBR of the linux drive, which then will be the master.
 
Old 08-05-2006, 11:36 AM   #26
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
lilo doesn't get installed to any partition at all. It gets installed to the first sector of the hard drive which is reseved for the boot code(bytes 0-446) and partition table(bytes 447-512). The bootable code then looks for the indicated boot partition and executes the superblock, which is the first sector of the boot partition.
The bootloader just loads a sector from disk to RAM and executes it. This means you can chain bootloaders together. The safest ways of dual-booting Windows with Linux usually invlove this. I have a mvhine with Win98 and then W2K installed, so it uses the W2K NTLDR bootloader. To boot into linux I placed an entry in the boot.ini which points to a 512 bootsector file which contains the GRUB Stage1. So, NTLDR can either load windows or GRUB. GRUB then can load linux or whatever. One bootloader replaces the other.
 
Old 08-05-2006, 01:00 PM   #27
tramni1980
Member
 
Registered: Jul 2006
Location: Köln, Germany
Distribution: Slackware64-14.2 & -current, DragonFly BSD, OpenBSD
Posts: 819

Original Poster
Rep: Reputation: 55
Ok, since I do not know how to manipulate the windows bootloader, I have no chance to achieve chaining of the bootloaders. My simple question is whether I can proceed with swapping the hard drives master-slave properties and instaling lilo to the MBR of the master without reinstalling Slackware? So long as I can understand, reinstallation is not necessary, I just have to make the primary Windows partition the only bootable one and then install lilo to the MBR of the linux drive, which will be master.
And concerning the master and slaves, I have to ask something that is not quite clear to me. I will adjust the jumpers of the hard drives so that they indicate master and slave respectively. My hard drives are on one and the same ATA cable. Is it necessary that the master is on the first slot of the cable, or the sequence of the drives does not matter? A friend of mine told me that the Windows drive has to be on the first slot, no matter whether it is master or slave. So my question is is the sequence of the hard drives along the ATA cable important, or the quality master-slave is only defined by the jumpers? And is it true that the windows drive has to be on the first slot of the cable?
 
Old 08-05-2006, 02:40 PM   #28
cwwilson721
Senior Member
 
Registered: Dec 2004
Location: In my house.
Distribution: Ubuntu 10.10 64bit, Slackware 13.1 64-bit
Posts: 2,649
Blog Entries: 1

Rep: Reputation: 67
trani-

You almost have it.

A few points:
  • Windows needs to be on the first partition on the bootable hd, no matter which one it is. When that drive boots, Windows will call it 'C:', and then it goes looking for others.
  • Linux doesn't care where it is, it will boot.
  • The bootloader (lilo or grub) needs to be installed on the mbr of hda. Don't 'wipe' the mbr, just install to it. With lilo or grub, you can tell it where the other os is.
Easiest (at least to me) way:
  • In stall Windows to whatever partition, and make sure it boots
  • Install Slackware wherever you wish. Then when it tries to run 'liloconfig (or you can run it yourself if you already have Slackware installed), use the 'expert' mode, follow the list, and install to the mbr of /dev/hda (I think you called it 'Master drive'. Thats a misnomer. The linux conventions make more sense: /dev/hda = Master Primary, /dev/hdb= Slave Primary,/dev/hdc=Master Secondary, /dev/hdd=Slave Secondary, etc...). Just remember that the first os you tell liloconfig, that os is the default boot one.
Example:
/dev/hda1 is WinXP. Installed and bootable.
/dev/hdb1 is Slackware.
I tell liloconfig to use a 5 second pause, select a Linux install, tell it /dev/hdb1, then tell it about Windows on /dev/hda1. I
then install lilo on the mbr of /dev/hda (Try to always install it as mbr on the first harddisk). Reboot, and it should boot to my os of choice, Slackware as first/default, XP second on the list.

OK, now I bought a new hdd, and want XP as disk 3 . Install your new drive,then get a printout of 'fdisk -l' (that will tell you what disk is what filesystem, etc.) Rerun 'liloconfig' again, telling it all the new stuff. (XP=/dev/hdc1, etc...)

Then, try to boot XP. You shouldn't have any problems, except Windows may show different hdd's as different drive letters (D: is now F:, or whatever.) But C: should still be C:

Does this make it any clearer for you? I know it's alot of info, but I tried to keep it to lilo for you, because it is what comes with and is installed by Slackware by default.

Let me know
 
Old 08-05-2006, 03:06 PM   #29
tramni1980
Member
 
Registered: Jul 2006
Location: Köln, Germany
Distribution: Slackware64-14.2 & -current, DragonFly BSD, OpenBSD
Posts: 819

Original Poster
Rep: Reputation: 55
Ok, I think things are clear to me now. Lilo has to be installed to the MBR of /dev/hda, the "C" Windows partition has to be bootable. I do not have to reinstall Slackware linux, I just have to swap the "master-slave" properties of my hard drives, so that the linux drive becomes /dev/hda and the windows becomes /dev/hdb. Then I have to run liloconfig and install lilo to the mbr of /dev/hda. There is no need to wipe the previous lilo installation there. Probably I should toggle the root linux partition, which will then be /dev/hda1 unbootable, so that the "C" Windows partition-/dev/hdb1 remains the only partition, toggled bootable.
The swapping of the "master-slave properties of the two hard drives is done by just setting the jumpers; the sequence of the hard drives along the ATA cable that connects them doesn't matter.
Tell me if I am not correct about something.
Thank you very much in advance.
 
Old 08-05-2006, 03:16 PM   #30
cwwilson721
Senior Member
 
Registered: Dec 2004
Location: In my house.
Distribution: Ubuntu 10.10 64bit, Slackware 13.1 64-bit
Posts: 2,649
Blog Entries: 1

Rep: Reputation: 67
So far, you got the basics. Great!

Unless you are using 'cable select' as the configuration jumper, the position of the drive on the IDE cable does not matter.

The 'Bootable' flag only matters to MS type os's. Linux does not care. You can leave it set if you wish.

Swap your hdd's around, then try to boot linux (if it won't, boot Slackware disk #1, at the 'boot:' prompt, there is a line above it that tells you how to boot your install, starts with 'root=/dev/hda1...). When in linux, run 'liloconfig', use 'expert mode', follow the list, give it a menu delay, and the first os you choose will be the default boot. Install to mbr of /dev/hda, and it should work.(Hey, we are dealing w/Microsoft here...lol)

Let us know.
 
  


Reply



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
Another lilo problem jerryvb Slackware 13 05-09-2006 11:36 AM
Lilo vs Grub - PROBLEM with lilo nelsonnery Linux - Software 2 09-09-2004 11:09 AM
LILO problem ZeroCoolJr Slackware 8 12-09-2003 07:45 PM
LiLo Installation problem ?and (GNOME and KDE problem) hitesh_linux Linux - Software 1 01-01-2002 04:56 AM
Problem with Lilo not updating (yes I ran lilo after changing the conf) webguy Linux - General 2 06-24-2001 07:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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