% Linux Installation and Getting Started    -*- TeX -*-
% postinstall.tex
% Copyright (c) 1992-1994 by Matt Welsh <mdw@sunsite.unc.edu>
%
% This file is freely redistributable, but you must preserve this copyright 
% notice on all copies, and it must be distributed only as part of "Linux 
% Installation and Getting Started". This file's use is covered by the 
% copyright for the entire document, in the file "copyright.tex".

\subsection{Problems after installing Linux}
\namedlabel{sec-install-probs-postinstall}{Problems after installing Linux}

\index{installation!problems!postinstallation|(}

You've spent an entire afternoon installing Linux. In order to make space 
for it, you wiped your MS-DOS and OS/2 partitions, and tearfully 
deleted your copies of SimCity and Wing Commander.
You reboot the 
system, and nothing happens. Or, even worse, {\em something\/} happens, but 
it's not what should happen. What do you do?

In Section~\ref{sec-install-probs-booting}, we covered some
of the most common problems that can occur when booting the Linux
installation media---many of those problems may apply here. In addition,
you may be victim to one of the following maladies.

\subsubsection{Problems booting Linux from floppy}

\index{installation!problems!booting}
\index{booting!problems}
If you are using a floppy to boot Linux, you may need to specify 
the location of your Linux root partition at boot time. This is 
especially true if you are using the original installation floppy itself,
and not a custom boot floppy created during installation.

While booting the floppy, hold down \key{shift} or \key{ctrl}. This should
present you with a boot menu; press \key{tab} to see a list of available
options. For example, many distributions allow you to type
\begin{tscreen}
boot: {\em linux hd=\cparam{partition}}
\end{tscreen}
at the boot menu, where \cparam{partition} is the name of the
Linux root partition, such as {\tt /dev/hda2}. Consult the documentation
for your distribution for details.

\subsubsection{Problems booting Linux from the hard drive}

\index{installation!problems!booting}
\index{booting!problems}
If you opted to install LILO, instead of creating a boot floppy, then
you should be able to boot Linux from the hard drive. However, the
automated LILO installation procedure used by many distributions 
is not always perfect. It may make incorrect assumptions about your
partition layout, in which case you will need to re-install LILO to
get everything right. Installing LILO is covered in 
Chapter~\ref{chap-sysadm-num}. 

\begin{itemize}
\item {\bf System reports ``{\tt Drive not bootable---Please insert system 
disk.}''} 
You will get this error message if the hard drive's master
boot record is corrupt in some way.
In most cases, it's harmless, and everything
else on your drive is still intact. There are several ways around this:

\begin{enumerate}
\item While partitioning your drive using {\tt fdisk}, you may have deleted
the partition that was marked as ``active''. MS-DOS and other operating 
systems attempt to boot the ``active'' partition at boot time (Linux pays
no attention to whether the partition is ``active'' or not). You may be able
to boot MS-DOS from floppy and 
run {\tt FDISK} to set the active flag on your MS-DOS
paritition, and all will be well.

Another command to try (with MS-DOS 5.0 and higher) is
\begin{tscreen}
FDISK /MBR
\end{tscreen}
This command will attempt to rebuild the hard drive master boot record
for booting MS-DOS, overwriting LILO. If you no longer have MS-DOS on your 
hard drive, you'll need to boot Linux from floppy and
attempt to install LILO later.

\item If you created an MS-DOS partition using Linux's version of {\tt fdisk},
or vice versa, you may get this error. You should create MS-DOS 
partitions only using MS-DOS's version {\tt FDISK}. (The same applies to
operating systems other than MS-DOS.) The best solution
here is either to start from scratch and repartition the drive correctly,
or to merely delete and re-create the offending partitions using the 
correct version of {\tt fdisk}.

\index{installation!problems!LILO}
\index{LILO!problems installing}
\item The LILO installation procedure may have failed. In this case, you
should either boot from your Linux boot floppy (if you have one), or from the
original installation media. Either of these should provide options for
specifying the Linux root partition to use when booting. Hold down 
\key{shift} or \key{ctrl} at boot time, and press \key{tab} from the
boot menu for a list of options. 

% If all else fails you can just boot Linux from floppy until you have the
% system configured to the extent where you can attempt to re-install LILO.

\end{enumerate}

\item {\bf When booting the system from the hard drive, MS-DOS (or 
another operating system) starts instead of Linux.} First of all, be
sure that you actually installed LILO when installing the Linux software.
If not, then the system will still boot MS-DOS (or whatever other
operating system you may have) when you attempt to boot from the hard
drive. In order to boot Linux from the hard drive, you will need to install 
LILO (see Chapter~\ref{chap-sysadm-num}). 

On the other hand, if you {\em did\/} install LILO, and another
operating system boots instead of Linux, then you have LILO configured to 
boot that other operating system by default. While the system is booting,
hold down \key{shift} or \key{ctrl}, and press \key{tab} at the boot prompt.
This should present you with a list of possible operating systems to boot;
select the appropriate option (usually just ``{\tt linux}'') to boot Linux.

If you wish to select Linux as the default 
operating system to boot, you will need to re-install LILO. See
Chapter~\ref{chap-sysadm-num}. 

It also may be possible that you attempted to install LILO, but the 
installation procedure failed in some way. See the previous item.

\end{itemize}


\subsubsection{Problems logging in}

\index{installation!problems!logging in}
\index{logging in!problems}
After booting Linux, you should be presented with a login prompt, like so:
\begin{tscreen}
linux login:
\end{tscreen}
At this point, either the distribution's documentation or the system itself
will tell you what to do. For many distributions, you simply login as
{\tt root}, with no password. Other possible usernames to try are 
{\tt guest} or {\tt test}. 

Most newly-installed Linux systems should not require
a password for the initial login. However, if you are asked to enter a 
password, there may be a problem. First, try using a password equivalent
to the username; that is, if you are logging in as {\tt root}, use
``{\tt root}'' as the password. 

If you simply can't login, there may be a problem. First, consult your
distribution's documentation; the username and password to use may be
buried in there somewhere. The username and password may have been
given to you during the installation procedure, or they may be printed
on the login banner. 

One cause of this may be a problem with installing the Linux login 
and initialization files. If this is the case, you may need to reinstall
(at least parts of) the Linux software, or boot your installation media
and attempt to fix the problem by hand---see Chapter~\ref{chap-sysadm} for
hints. 

\subsubsection{Problems using the system}

If login is successful, you should be presented with a shell prompt
(such as ``{\tt \#}'' or ``{\tt \$}'') and can happily roam around your
system. However, there are some initial problems with using the system
that sometimes creep up.

The most common initial configuration problem is incorrect file or directory
permissions. This can cause the error message
\begin{tscreen}
Shell-init: permission denied
\end{tscreen}
to be printed after logging in (in fact, any time you see the message
``{\tt permission denied}'' you can be fairly certain that it is a problem
with file permissions). 

\index{permissions!problems}
\index{installation!problems!file permissions}
In many cases, it's a simple matter of using
the {\tt chmod} command to fix the permissions of the appropriate files or
directories. 
For example, some distributions of Linux once
used the (incorrect) file mode 0644 for the root directory ({\tt /}).
The fix was to issue the command
\begin{tscreen}
\# {\em chmod 755 /}
\end{tscreen}
as {\tt root}. However, in order to issue this command, you needed to
boot from the installation media and mount your Linux root filesystem by 
hand---a hairy task for most newcomers. 

As you use the system, you may run into places where file and directory
permissions are incorrect, or software does not work as configured. Welcome
to the world of Linux! While most distributions are quite trouble-free, 
very few of them are perfect.
We don't want to cover all of those problems here.
Instead, throughout the book we help you to solve many of these configuration
problems by teaching you how to find them and fix them yourself. In
Chapter~\ref{chap-intro-num} we discussed this philosophy in some detail.
In Chapter~\ref{chap-sysadm-num}, we give hints
for fixing many of these common configuration problems. 

\index{installation!problems!postinstallation|)}
