Lilo Common Problems, Swap and PATH Setup in Linux

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

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

what is swap in Linux?

How can I change the PATH?

     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 looks like this:

append=" mem=96M"
append=" mem=96M failsafe"

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


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 &


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

Add or adjust the line



what is swap in Linux?

Swap is an extension of the physical memory of the computer. Most likely, you created a swap partition during the initial RedHat setup. You can verify the amount of swap space available on your system using:

cat /proc/meminfo

The general recommendation is that one should have: at least 4 MB swap space, at least 32 MB total (physical+swap) memory for a system running command-line-only, at least 64 MB of total (physical+swap) memory for a system running X-windows, and swap space at least 1.5 times the amount of the physical memory on the system.

If this is too complicated, you might want to have a swap twice as large as your physical (silicon) memory, but not less than 64 MB.

If you ever need to change your swap, here are some basics.

Swap files

Swapping to files is usually slower than swapping to a raw partition, so this is not the recommended permanent swapping technique. Creating a swap file, however, can be a quick fix if you temporarily need more swap space. You can have up to 8 swap files, each with size of up to 16 MB. Here are the steps for making a swap file:

- Create a file with the size of your swap file:

dd if=/dev/zero of=/swapfile bs=1024 count=8192

This physically creates the swap file /swapfile, the block size is 1024 bytes, the file contains 8192 blocks, the total size is about 8 MB. [The dd command copies files. In the example above, the input file (if) was /dev/zero, the output file (of) was /swapfile . You cannot use the cp (copy) command for creating a swap file because the swap file must be physically continuous on the hard drive.]

- Set up the file with the command:

mkswap /swapfile 8192

- Force writing the buffer cache to disk by issuing the command:


- Enable the swap with the command:

swapon /swapfile

When you are done using the swap file, you can turn it off and remove:

swapoff /swapfile

rm /swapfile



      How can I change the PATH?

The PATH is the list of directories which are searched when you request the execution of a program. You can check your PATH using this command:
echo $PATH

which, on my system , shows the PATH for the user "yogin" to be:


The ":" is a separator, therefore the above PATH represents a list of directories as follows:


Here is the output from the command "echo $PATH" run on my system on the account "root":


You can change the PATH for all users on the system by editing the file /etc/profile and adjusting (as root) the line starting with "PATH=". I do it using the pico editor (as root):

pico -w /etc/profile

(The option -w turns off the wrap of long lines.)
Re-login for the change to take effect. To set up the PATH for an individual user only, edit the file /home/user_login_name/.bash_profile (please note the dot in front of the filename--files starting with a dot are normally invisible, you have to use ls -a to see them).
If you really want to have the current directory on your PATH, add "." (dot) to your PATH. When used in the place when directory name is expected, a dot means "the current directory". The specification for the path in /etc/.bash_profile may then look like this:

export PATH

This command takes the contents of the environmental variable called PATH (as set for all users in /etc/profile), and appends to it the name of your home directory as set by the variable HOME with an attached "/bin" and then a dot. Finally, the command assigns the resulting string back to the variable called PATH. It is necessary to use the command "export" after modifying PATH or any other user-environment variable, so that the variable is visible outside of the script that sets it.

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.