Home > Slackware Linux Essentials > Slackware Linux Essentials - Chapter 7 Booting

Slackware Linux Essentials - Chapter 7 Booting

January 5th, 2009

Warning: file_get_contents(http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=1TJ8QTQ6ZFCVAJ3X1T02&AssociateTag=ii0c3-20&Operation=ItemSearch&SearchIndex=Books&ResponseGroup=Small,Images&Keywords=pop) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home/manusia2/public_html/wp-content/plugins/amazonfeed/php/amazonfeed.class.php on line 271

The process of booting your Linux system can sometimes be easy and sometimes be difficult. Many users install Slackware on their computer and that’s it. They just turn it on and it’s ready to use. Othertimes, simply booting the machine can be a chore. For most users, LILO works best. Slackware includes LILO and Loadlin for booting Slackware Linux. LILO will work from a hard drive partition, a hard drive’s master boot record, or a floppy disk, making it a very versatile tool. Loadlin works from a DOS command line, killing DOS and invoking Linux.

Another popular utility for booting Linux is GRUB. GRUB is not included or officially supported by Slackware. Slackware holds to the “tried and true” standard for what gets included inside the distribution. While GRUB works well and includes some features that LILO does not, LILO handles all the essential tasks of a boot loader reliably with a proven track record. Being younger, GRUB hasn’t quite lived up to that legacy yet. As it is not included with Slackware, we do not discuss it here. If you wish to use GRUB (perhaps it came with another Linux OS and you want to use it to dual-boot) consult GRUB’s documentation.

This section covers using LILO and Loadlin, the two booters included with Slackware. It also explains some typical dual booting scenarios and how you could go about setting it up.


7.1 LILO

The Linux Loader, or LILO, is the most popular booter in use on Linux systems. It is quite configurable and can easily be used to boot other operating systems.

Slackware Linux comes with a menu-driven configuration utility called liloconfig. This program is first run during the setup process, but you can invoke it later by typing liloconfig at the prompt.

LILO reads its settings from the /etc/lilo.conf(5) file. It is not read each time you boot up, but instead is read each time you install LILO. LILO must be reinstalled to the boot sector each time you make a configuration change. Many LILO errors come from making changes to the lilo.conf file, but failing to re-run lilo to install these changes. liloconfig will help you build the configuration file so that you can install LILO for your system. If you prefer to edit /etc/lilo.conf by hand, then reinstalling LILO just involves typing /sbin/lilo (as root) at the prompt.

When you first invoke liloconfig, it will look like this:

Figure 7-1. liloconfig

If this is your first time setting up LILO, you should pick simple. Otherwise, you might find expert to be faster if you are familiar with LILO and Linux. Selecting simple will begin the LILO configuration.

If kernel frame buffer support is compiled into your kernel, liloconfig will ask which video resolution you would like to use. This is the resolution that is also used by the XFree86 frame buffer server. If you do not want the console to run in a special video mode, selecting normal will keep the standard 80×25 text mode in use.

The next part of the LILO configuration is selecting where you want it installed. This is probably the most important step. The list below explains the installation places:

Root

This option installs LILO to the beginning of your Linux root partition. This is the safest option if you have other operating systems on your computer. It ensures that any other booters are not overwritten. The disadvantage is that LILO will only load from here if your Linux drive is the first drive on your system. This is why many people chose to create a very small /boot partition as the first drive on their system. This allows the kernel and LILO to be installed at the beginning of the drive where LILO can find them. Previous versions of LILO contained an infamous flaw known as the “1024 cylinder limit”. LILO was unable to boot kernels on partitions past the 1024th cylinder. Recent editions of LILO have eliminated this problem.

Floppy

This method is even safer than the previous one. It creates a boot floppy that you can use to boot your Linux system. This keeps the booter off the hard disk entirely, so you only boot this floppy when you want to use Slackware. The flaws with this method are obvious. Floppies are notoriously fickle, prone to failures. Secondly, the boot loader is no longer self-contained within the computer. If you loose your floppy disk, you’ll have to make another to boot your system.

MBR

You will want to use this method if Slackware is the only operating system on your computer, or if you will be using LILO to choose between multiple operating systems on your computer. This is the most preferred method for installing LILO and will work with almost any computer system.

Warning

This option will overwrite any other booter you have in the MBR.

After selecting the installation location, liloconfig will write the configuration file and install LILO. That’s it. If you select the expert mode you will receive a special menu. This menu allows you to tweak the /etc/lilo.conf file, add other operating systems to your boot menu, and set LILO to pass special kernel parameters at boot time. The expert menu looks like this:

Figure 7-2. liloconfig Expert Menu

Whatever your system configuration is, setting up a working boot loader is easy. liloconfig makes setting it up a cinch.


7.2 LOADLIN

The other booting option that comes with Slackware Linux is LOADLIN. LOADLIN is a DOS executable that can be used to start Linux from a running DOS system. It requires the Linux kernel to be on the DOS partition so that LOADLIN can load it and properly boot the system.

During the installation process, LOADLIN will be copied to root’s home directory as a .ZIP file. There is no automatic setup process for LOADLIN. You will need to copy the Linux kernel (typically /boot/vmlinuz) and the LOADLIN file from root’s home directory to the DOS partition.

LOADLIN is useful if you would like to make a boot menu on your DOS partition. A menu could be added to your AUTOEXEC.BAT file that would allow you to pick between Linux or DOS. A choice of Linux would run LOADLIN, thus booting your Slackware system. This AUTOEXEC.BAT file under Windows 95 will provide a sufficient boot menu:

   @ECHO OFF
   SET PROMPT=$P$G
   SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\
   CLS
   ECHO Please Select Your Operating System:
   ECHO.
   ECHO [1] Slackware Linux
   ECHO [2] Windows 95
   ECHO.
   CHOICE /C:12 "Selection? -> "
   IF ERRORLEVEL 2 GOTO WIN
   IF ERRORLEVEL 1 GOTO LINUX
   :WIN
   CLS
   ECHO Starting Windows 95...
   WIN
   GOTO END
   :LINUX
   ECHO Starting Slackware Linux...
   CD \LINUX
   LOADLIN C:\LINUX\VMLINUZ ROOT=<root partition device> RO
   GOTO END
   :END

You will want to specify your root partition as a Linux device name, like /dev/hda2 or something else. You can always use LOADLIN at the command line. You simply use it in the same manner as it is in the example above. The LOADLIN documentation comes with many examples on how to use it.


7.3 Dual Booting

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.


7.3.1 Windows

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.


7.3.1.1 Using LILO

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.


7.3.1.2 Using LOADLIN

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:

BootGUI=0

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.


7.3.1.3 Deprecated Windows NT Hack

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.

  1. Install Windows NT

  2. Install Linux, making sure LILO is installed to the superblock of the Linux partition

  3. Get the first 512 bytes of the Linux root partition and store it on the Windows NT partition

  4. 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:

C:\bootsect.lnx="Slackware Linux"

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.


7.3.2 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.

Tags: pop, slackware, Slackware Linux Essentials

Related posts

Slackware Linux Essentials ,

  1. No comments yet.
  1. No trackbacks yet.