Many users set up their computers to boot Slackware Linux and another operating system. We've described several typical dual boot scenarios below, in case you are having difficulty setting up your system.
Setting up a computer with both MS Windows and Linux is probably the most common dual boot scenario. There are numerous ways you can setup the booting, but this section will cover two.
Often times when setting up a dual boot system, a person will devise a perfect plan for where everything should go but mess up the installation order. It is very important to understand that operating systems need to be installed in a certain order for a dual boot setup to work. Linux always offers control over what, if anything, gets written to the Master Boot Record. Therefore, it's always advisable to install Linux last. Windows should be installed first, since it will always write its booter to the Master Boot Record, overwriting any entry Linux may have put there.
Most people will want to use LILO to chose between Linux and Windows. As stated above, you should install Windows first, then Linux.
Let's say you have a 40GB IDE hard disk as the only drive in your system. Let's also say that you want to give half of that space to Windows and half of that space to Linux. This will present a problem when trying to boot Linux.
20GB Windows boot (C:) 1GB Linux root (/) 19GB Linux /usr (/usr)
You would also want to set aside an adequate amount of space for a Linux swap partition. The unwritten rule is to use twice the amount of RAM you have in disk space. A 64MB system would have 128MB of swap, and so on. Adequate swap space is the discussion of many flames on IRC and Usenet. There's no truly “right” way to do it, but sticking with the rule above should be sufficient.
With your partitions laid out, you should proceed to install Windows. After that is set up and working, you should install Linux. The LILO installation needs special attention. You will want to select the expert mode for installing LILO.
Begin a new LILO configuration. You will want to install it to Master Boot Record so that it can be used to choose between the two operating systems. From the menu, add your Linux partition and add your Windows (or DOS) partition. Once that's complete, you can install LILO.
Reboot the computer. LILO should load and will display a menu letting you select between the operating systems you have installed. Select the name of the OS you wish to load (these names were selected when you setup LILO).
LILO is quite a configurable boot loader. It's not just limited to booting Linux or DOS. It can boot just about anything. The man pages for lilo(8) and lilo.conf(5) provide more detailed information.
What if LILO doesn't work? There are instances where LILO just won't work on a particular machine. Fortunately, there is another way to dual boot Linux and Windows.
This method can be used if LILO doesn't work on your system, or if you just don't want to set up LILO. This method is also ideal for the user that reinstalls Windows often. Each time you reinstall Windows, it will overwrite the Master Boot Record, thus destroying any LILO installation. With LOADLIN, you are not subject to that problem. The biggest disadvantage is that you can only use LOADLIN to boot Linux.
With LOADLIN, you can install the operating systems in any order desired. Be careful about installing things to the Master Boot Record, you do not want to do that. LOADLIN relies on the Windows partition being bootable. So during the Slackware installation, make sure you skip the LILO setup.
After installing the operating systems, copy the loadlinX.zip (where X is a version number, such as 16a) file from root's home directory to your Windows partition. Also copy your kernel image to the Windows partition. You will need to be in Linux for this to work. This example shows how to do this:
# mkdir /win # mount -t vfat /dev/hda1 /win # mkdir /win/linux # cd /root # cp loadlin* /win/linux # cp /boot/vmlinuz /win/linux # cd /win/linuz # unzip loadlin16a.zip
That will create a C:\LINUX directory on your Windows partition (assuming it's /dev/hda1) and copy over the necessary stuff for LOADLIN. After doing this, you will need to reboot into Windows to setup a boot menu.
Once in Windows, get to a DOS prompt. First, we need to make sure the system is set to not boot into the graphical interface.
C:\> cd \ C:\> attrib -r -a -s -h MSDOS.SYS C:\> edit MSDOS.SYS
Add this line to the file:
Now save the file and exit the editor. Now edit C:\AUTOEXEC.BAT so we can add a boot menu. The following provides an example of what a boot menu block in AUTOEXEC.BAT would look like:
cls echo System Boot Menu echo. echo 1 - Linux echo 2 - Windows echo. choice /c:12 "Selection? -> " if errorlevel 2 goto WIN if errorlevel 1 goto LINUX :LINUX cls echo "Starting Linux..." cd \linux loadlin c:\linux\vmlinuz root=/dev/hda2 ro goto END :WIN cls echo "Starting Windows..." win goto END :END
The key line is the one that runs LOADLIN. We tell it the kernel to load, the Linux root partition, and that we want it mounted read-only initially.
The tools for these two methods are provided with Slackware Linux. There are numerous other booters on the market, but these should work for most dual boot setups.
This is the least common dual booting situation. In the days of old, LILO was unable to boot Windows NT, requiring Linux users to hack NTLDR, which presented several more problems than dual booting between Windows 9x and Linux. Understand that the following instructions are deprecated. LILO has been able to boot Windows NT/2000/XP/2003 for many years now. If you are using a legacy machine though, you may need to use just such a hack.
Install Windows NT
Install Linux, making sure LILO is installed to the superblock of the Linux partition
Get the first 512 bytes of the Linux root partition and store it on the Windows NT partition
Edit C:\BOOT.INI under Windows NT to add a Linux option
Installing Windows NT should be fairly straightforward, as should installing Linux. From there, it gets a little more tricky. Grabbing the first 512 bytes of the Linux partition is easier than it sounds. You will need to be in Linux to accomplish this. Assuming your Linux partition is /dev/hda2, issue this command:
# dd if=/dev/hda2 of=/tmp/bootsect.lnx bs=1 count=512
That's it. Now you need to copy bootsect.lnx to the Windows NT partition. Here's where we run into another problem. Linux does not have stable write support for the NTFS filesystem. If you installed Windows NT and formatted your drive as NTFS, you will need to copy this file to a FAT floppy and then read from it under Windows NT. If you formatted the Windows NT drive as FAT, you can simply mount it under Linux and copy the file over. Either way, you will want to get /tmp/bootsect.lnx from the Linux drive to C:\BOOTSECT.LNX on the Windows NT drive.
The last step is adding a menu option to the Windows NT boot menu. Under Windows NT open a command prompt.
C:\WINNT> cd \ C:\> attrib -r -a -s -h boot.ini C:\> edit boot.ini
Add this line to the end of the file:
Save the changes and exit the editor. When you reboot Windows NT, you will have a Linux option on the menu. Choosing it will boot into Linux.
Yes, people really do this. This is definitely the easiest dual boot scenario. You can simply use LILO and add more entries to the /etc/lilo.conf file. That's all there is to it.