Part 4: Linux Newbie Administrator FAQ



LINUX NEWBIE ADMINISTRATOR GUIDE
ver. 0.194 2003-06-04 by Stan, Peter and Marie Klimas
The latest version of this guide is available at http://linux-newbie.sunsite.dk.
Copyright (c) <1999-2003> by Peter and Stan Klimas. Your feedback, comments, corrections, and improvements are appreciated. Send them to linux_nag@canada.com This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0, 8 or later http://opencontent.org/openpub/ with the modification noted in lnag_licence.html.

4.1: Startup Issues (LILO and GRUB)


Contents of this section:
4.1 Startup  issues (LILO and GRUB)
   4.1.0 LILO and GRUB
   4.1.1 Linux cannot detect all my memory
   4.1.2 LILO displays only LI (or LIL) and hangs
   4.1.3 How can I change the operating system that LILO boots on default?
   4.1.4 The LILO prompt stays too short (or too long) on the screen during the bootup
   4.1.5 Uninstalling Linux

4.1.0  LILO and GRUB

Both the newer GRUB and the older LILO are boot loaders. They make it possible for you to select the operating system to boot at the boot time. Most (all?) of the booting problems described in this section can likely be overcome by installing the most recent Linux kernel and the latest GRUB boot loader.  GRUB is better than LILO because LILO relies on the absolute hard drive addresses to find the boot image, while GRUB understands the filesystems and looks for a file containing the boot image.  We recommend using GRUB when given a choice during the installation.
The main GRUB configuration file is /boot/grub/menu.lst (or grub.conf, on my system one is a symbolic link to the other).  Here are some comments on the items found in this file:
# Lines starting with the # mark are comments.
timeout 5
# the above setting starts booting the default operating system after 5 seconds unless a key is pressed
default 0
# the above setting makes the default operating system to be the first found in the menu list. I could use "default 3" to have the 4th menu item the default.
#
title linux
kernel (hd0,2)/boot/vmlinuz root=/dev/hda3  mem=64M hdc=ide-scsi
# The above two lines define a boottime menu item, and set the boot action for this item.
# The first line names the menu item "linux".
# The second line specifies that the kernel is located on the first  physical hard drive (hd0),  the third partition (2), the boot image is the file  /boot/vmlinux
# Also on the second line, the following options are passed to the kernel:
# root=/dev/hda3  (i.e., make the root partition the 3d partition on the first hard drive (hda) ),
# mem=64M (i.e., force using 64 megabytes of physical memory.).
# hdc=ide-scsi (use SCSI emulation on my CD ROM, because it is a CD writer).
#
initrd /boot/initrd-2.4.17-custom.img
# define the file which contains the modules needed at the boot time, as the modules load to the "initial ram disk" (initrd).
# I had to re-create mine (because I recomplied the kernel) using  mkinitrd /boot/initrd-2.4.7-10custom.img 2.4.7-custom

Good documentation for GRUB is available using info grub

4.1.1 Linux cannot detect all my memory

If you have more than 64 megabytes of physical memory, Linux kernel ver. 2.0.36 or lower will use, by default, only the first 64 MB. To see how much memory Linux uses on your system, type:
cat /proc/meminfo
or
free
You can check your version of Linux kernel with:
uname -a
The last popular kernel with the "memory problem", 2.0.36, comes with RedHat 5.2.  My RedHat 6.0 came with kernel 2.2.5-15 so it does not have the "memory problem" any more.

To get more than 64 MB memory recognized on RH5.2, you have to edit (as root) the file /etc/lilo.conf, and add a line like this just before your first "image=" statement:
append="mem=80M"

If you have an amount of memory different than 80 MB, adjust the above line. For any changes in /etc/lilo.conf to take effect, you *must* re-run the program
lilo
(watch if it runs without errors) and reboot. After the reboot, you can check if your adjustment worked using either of these two commands:
cat /proc/meminfo
free
For testing purposes, or if you are having problems, the option of specifying the amount of memory at the LILO prompt is useful:
[type at LILO prompt during bootup] linux "mem=16M"
Occasionally, I hear the advice to skip the upper few megabytes if you have problems enabling all your memory, or the machine locks up. E.g., enable only 78 out of your 80 MB. This is apparently the case for some SCSI controllers that use the very upper chunk of the main memory. Take it for what it's worth.
Occasionally on some systems, Linux recognizes only 16 MB of memory. This is usually linked to the setting "memory hole at 15-16 MB" enabled in the BIOS setup (the solution is to disable this BIOS setting). It is probably a good idea to disable all "advanced" features in your BIOS setup anyway (for example, the BIOS virus detection seems to be a common source of problems ).
Mixture of memory chips with different timings can also lead to memory recognition problems or to system crashes (the solution is to replace the memory chips so that the timing of all memory chips is the same).

4.1.2 LILO displays only LI (or LIL) and hangs

I quote from my good handbook "Red Hat Linux Unleashed" by Kamran Hussain, Timothy Parker, et al., published by SAMS Publishing:
"When LILO loads itself, it displays the word LILO. Each letter is printed before or after performing some specific action. If LILO fails at some point, the letters printed so far can be used to identify the problem. [...]
LI [...] This is caused either by geometry mismatch or by moving /etc/lilo/boot.b without running the map installer.
LIL [...] This is typically caused by media failure or geometry mismatch."
The geometry means the number of sectors/heads/cylinders used in the hard drive configuration of your BIOS. Hope this helps!
It is a very good idea to have a handbook for Linux or at least a general UNIX handbook. Handbooks for Windows are useless, handbooks for Linux are great!  "Red Hat Linux Unleashed" is a very good handbook but I am sure there are many other equally good ones.
With a LILO error like above, you can boot your machine using a Linux or DOS boot floppy. There seems to be several general possibilities to correct such a LILO error, depending on what is wrong:
1. If LILO simply got corrupted (does not seem very common), you can remove and re-install it. You can remove LILO by running under Linux:
lilo -u /dev/hda
or, under DOS:
FDISK/MBR
which rewrites the hard drive master boot record (MBR), in which LILO resides, and replaces it with "clean" DOS stuff. You will lose access to Linux if you rebooted your computer after removing LILO (if this happened, you can boot Linux from the floppy and re-install LILO on top of the DOS MBR).

To re-install LILO, simply re-run the command lilo (as root).

2. Specify the option
linear
at the top of your /etc/lilo.conf file. This is particularly useful for large drives (>8 GB). See man lilo.conf for details. The option "linear" is safe--it should not affect a properly working system, so you can specify this option is any case.

You may also want to play with the method by which BIOS accesses your harddrive. Fore example, turn the LBA ("linear or large block access") mode on/off in your BIOS to see if this helps.

Instead of the option "linear" you may try specifying the option (helpful to overcome the 1024 cylinder limit with larger harddrives and newer BIOSes):
lba32

This is a new option so it won't work with the stock LILO supplied with RH6.1 or lower. Use the latest Mandrake or RedHat if having the "LI" kind of problems--hard drives are bigger and bigger, and BIOS makers put new tricks to support them.

3. Look into your BIOS setup and figure out how the specified hard drive geometry does not match your hard drive. From under Linux, you can display the hard drive geometry using (for example, for the first IDE hard drive):
hdparm -g  /dev/hda

You can typically easily find the recommended manufacturer geometry on the web using Google to search for your harddrive model number.

 
4. Put LILO on another partition (different hard drive) and, using fdisk, make this partition bootable (if your system supports booting from another drive). Or swap your harddrives so that the one that is better supported by your old BIOS comes as the first hard drive on your first IDE interface (DOS drive "C").
5. Maybe you prefer to use "loadlin" instead of "lilo". From under DOS, locate your CDROM and see the program /dosutils/loadlin.exe.  It boots Linux from DOS.

6. Get rid of LILO and use GRUB.  Mandrake 7.2 contains GRUB as the default boot loader.

4.1.3 How can I change the operating system that LILO boots on default?

This can be set in the lilo configuration file /etc/lilo.conf .  Mine (lilo version 0.21.5.1-4MDK) looks like this:
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
vga=normal
default=linux
keytable=/boot/us.klt
lba32
prompt
timeout=50
message=/boot/message
menu-scheme=wb:bw:wb:bw
image=/boot/vmlinuz
        label=linux
        root=/dev/hda3
        append=" mem=96M"
        read-only
image=/boot/vmlinuz
        label=failsafe
        root=/dev/hda3
        append=" mem=96M failsafe"
        read-only
other=/dev/hda1
        label=windows
        table=/dev/hda
other=/dev/fd0
        label=floppy
        unsafe

The four "label=" entries define the names of the boot choices. The default operating system to boot is specified by the option "default=" at the top of the file. In the absence of the "default", the first label to appear in /etc/lilo.conf is booted by default.

Don't forget to re-run the command
lilo

after any changes to the /etc/lilo.conf file.

There are also GUI utilities to configure lilo. For example, try, as root, in an X terminal:
klilo &

4.1.4 The LILO prompt stays too short (or too long) on the screen during the bootup

Add or adjust the line
delay=100

right before the first "image=" or "append=" statement in your /etc/lilo.conf file.  (Newer versions of lilo may use a "timeout" option instead.) The number is the time of delay in tenths of a second (0.1 s), so in the example above the delay will be 10 seconds.  Don't forget to re-run lilo after making any changes to the /etc/lilo.conf file, or your changes will not be enabled.

4.1.5 Uninstalling Linux

If you really wanted to "uninstall" Linux, you could run the following two commands  (from under DOS or MS Windows):
LOCK C:
FDISK/MBR
which will get rid of LILO--it overwrites the master boot record (MBR) of your first hard drive, where LILO resides. The "lock" command allows "raw" writing to disk, which is normally disallowed on more recent DOS versions as an antiviral measure. The problem with FDISK/MBR is that it does not report back any success or failure, so it is better to proceed it with the "lock" command. After this you can remove the Linux partitions using the DOS "FDISK" utility to re-claim the hard drive space.

Apparently, MS FDISK does not always cope with removing the Linux partitions. In this case, I may use linux fdisk. The simplest may be to boot from the Linux installation floppy/CD, and to remove the partition using the Linux partitioning tool when it pops up during the "installation" procedure. After that I abort the "installation" and Linux is gone.

If you still have problems, here are the ultimate solutions for zeroing the MBR (after: http://www.linuxgazette.com/issue63/okopnik.html, edited for space):

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Note: The following advice will completely wipe your Master Boot Record (MBR), which contains all your partition information. DO NOT DO THIS unless you know that this is exactly the result you want - it will leave your hard drive in an unbootable state, in effect bringing it back to "factory-fresh", i.e., empty of data and requiring partitioning and formatting.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Linux-based solution. If you can boot Linux - say via boot floppy - you can simply invoke "dd":

dd if=/dev/zero of=/dev/hda bs=512 count=1

This fills up the MBR with zeros. Obviously, you have to be root to do this.

DOS-based solution . Boot with a DOS floppy that has "debug" on it; run

debug

At the '-' prompt, "block-fill" a 512-byte chunk of memory with zeroes:

f 9000:0 200 0

Start assembly mode with the 'a' command, and enter the following code:

mov dx,9000
mov es,dx
xor bx,bx
mov cx,0001
mov dx,0080
mov ax,0301
int 13
int 20

Press <Enter> to exit assembly mode, take a deep breath - and press "g" to execute, then "q" to quit "debug". Your HD is now in a virgin state, and ready for partitioning and installation.

Go to Part: 4.2 - Accessing my drives
Back to Main Page