What is Linux? ============== Linux is an operating system written by the Finnish programmer Linus B Torvalds. It looks like the Unix operating system, and the source of the entire system is available. Binaries and source can be distributed freely under the terms of the GNU Public License. See README. Programs from the various System V and BSD versions of Unix should compile and run under Linux with few changes. Linux aims to conform as closely as it can to the various POSIX, ISO, and ANSI standards. Linux runs only on machines which have processors compatible with the Intel 386 or 486. If you intend to run Linux, your computer must have appropriate hardware and sufficient resources: - You must have at least 2 Mb of memory to run Linux. For good performance, you need at least 4 Mb of memory, and the X window system performs slowly without at least 8 Mb. - Linux requires an ISA or EISA bus. It runs on systems with a local bus architecture, such as VESA. At present it does not support the MCA bus architecture; this means that is does not run on PS/2 machines. - Linux supports AT standard (16-bit) hard disk controllers, including IDE, ESDI, MFM, and RLL controllers. It supports generic XT controllers (8 bit hard disk controllers with MFM or RLL). It also supports many SCSI controllers and CD ROMs, including Adaptec 1542 (but not 1522), Adaptec 1740 in extended mode (not in 1542 compatible mode), Seagate ST-01 and ST-02, NCR-5380, PAS-16, Trantor T128, T128F, and T228, Future Domain 1680, TMC-850, any board based on the TMC-950 chip, TMC-1660 and 1680, Ultrastor 14F, 24F, and 34F, and WD7000. Clones of these SCSI controller cards should also work with Linux. - You will need disk space for swapping (or paging) and for file systems. A small installation can share a 40 Mb disk with DOS, but a full installation including the X window system may require 60 Mb or more. See README.prepare. - Linux supports several Ethernet cards. The `official' kernel currently contains code for NE1000, NE2000, NE2100, SMC Ultra, 3c501, 3c503, 3c509, 3c579, HP PCLAN, AT1500, AT1700, DEPCA, D-Link DE600, AT-LAN-TEC/RealTek, and Western Digital 8003 and 8013 cards. Patches for other cards are available, and will eventually be included in the `official' kernel. The most common cards in Manchester are RM Ethernet cards. Some of these can be modified to work as NE2000 cards: AT cards with serial numbers above 20000. We have been unable to get RM Ethernet cards to work reliably with Linux, and Research Machines have been unwilling to supply information which could help us to get their cards working, or only if we sign a non-disclosure agreement. - Text mode supports VGA, EGA, CGA, and Hercules cards. Linux supports graphics and X11 with EGA, normal VGA, some SVGA cards (ET3000, ET4000, Paradise, and some Trident chips), some S3 cards (but not Diamond Stealth), 8514/A, Mach32, Mach8, and monochrome video boards such as Hercules. Detailed information about currently supported hardware is published in the Linux hardware HOWTO. See README.docs. Among the features of Linux are the following: - It is a multi-tasking system: several programs can run at the same time. You can run several programs simultaneously on several virtual consoles, in several windows, or by logging in remotely. - It is a multi-user system: several users can use the same machine at the same time. - Linux runs in 386 protected mode. Different processes are isolated from each other, so that one program cannot bring the system down. - Executable files are demand-loaded, so that parts of a program are in memory only when those parts are being executed. - Compiled programs are linked with dynamically loaded shared libraries to reduce disk and memory usage. - Executables share memory pages. Even a data page is shared until one program writes to it. This increases speed and decreases memory use. - Programs access virtual memory which is paged to disk. You may allocate up to 16 swap areas, each up to 16 Mb in size. This memory forms a pool which all running processes share. - Physical memory is organised into a unified memory pool or "cache", which changes in size depending on the system load. - The kernel can emulate a maths coprocessor if you have none. If you have a coprocessor, you can recompile the kernel without the emulation code to save memory. - The kernel supports multiple virtual consoles, which allow several independent login sessions on the system console. - The kernel supports several file systems, including its own extended and extended version 2 file systems, MINIX, XENIX, and DOS compatible file systems, and a special "proc" file system for getting information about running processes. Linux cannot access DOS 6 compressed partitions. - Linux supports TCP/IP networking, including ftp, telnet, NFS, and other protocols. The software which is distributed in the MCC Interim versions of Linux comes from a variety of sources. Much of it comes from the GNU project, some of it is taken from the published BSD sources, and some has been written specifically for Linux. The source code for every single binary and library is available with the MCC distribution. See README.ftp. Moreover, the optional patches package contains all patches applied to these sources to make the MCC distribution. *WARNING:* Linux is an operating system which is very different from DOS. It requires a certain minimal amount of attention if it is to work well. In particular, you must *never* simply turn off a machine on which Linux is running. For more information about using Linux safely, see the next section of this document. Using Linux *********** Caring for your Linux system ============================ Linux is an operating system which must be handled more carefully than DOS, or at least more carefully than older versions of DOS. There are some important facts about Linux which will help you to have fewer problems and get more out of your system. Linux has several file systems, but all of the `native' Linux file systems have one feature in common: they require special care which a DOS file system does not. First, information is not written to disk as soon as it becomes available, but it is flushed at regular intervals (every 30 seconds by default). This improves performance. But you must *never* switch off a PC which is running Linux, since some data may not get written to disk, and will be lost, and the data describing the file system may become inconsistent, putting the files in the system at risk of corruption. To shut Linux down safely, there are two methods you might use: 1. Reboot the system either by pressing `CTRL-ALT-DEL', or by giving the command `shutdown -r time'. 2. Stop the system by giving the command `shutdown -h time'. The `shutdown' command can only be given by the user `root'. The format of the time argument is discussed in the manual page for `shutdown'; `now' is a common example. Floppy disks may be corrupted if you remove them from the drive before unmounting them, since they too might not be up-to-date at the time. Should this happen, you can repair them with the command `fsck', unless they contain an msdos file system. MCC Interim distributions are configured to run `fsck' on all mounted file systems at boot time. Since both minix and ext2 file systems now have `clean flags' set when they are cleanly unmounted, the `shutdown' command should not ordinarily be given the `-f' option. There are a few files, system logs and such, which grow without limit. The logs in `/var/adm', particularly the file `messages', are restarted whenever the system is booted, so they should not cause problems unless you leave the system running for long periods, or when the file system is nearly full. But the file `/var/adm/wtmp' will grow constantly, and you may need to shorten it. To do this, log in as root and give the command > /var/adm/wtmp If you install networking software and connect your machine to the outside world, you may be exposing yourself to unscrupulous hackers. Be careful to set passwords, particularly for the root user, using the command `passwd'. The superuser `root' has very great powers, and can easily damage or delete the entire system. It is a good idea to do most of your work as `user' (or as some other user name), and to become root only when you need to run one of the commands which only root can give. For example, you can make a file read-only by using the `chmod' command, so that a simple `rm' command will not delete it, but `rm' does not normally ask the root user for confirmation before deleting such a file. To learn more about Unix systems, get a good book, read it, and follow some of the advice it gives. Some recommendations can be found in Linux Installation and Getting Started; for further information, see README.docs. The msdos file system ===================== The msdos file system provides the most convenient way of accessing DOS floppies and hard disk partitions from Linux. It allows you to mount a DOS disk or partition as part of the Linux directory tree, using the command mount -t msdos *options device directory* Here is a particular example of a `mount' command: mount -t msdos -o ro,uid=100,umask=027,conv=text /dev/hda1 /mnt There are some special options to the `mount' command which apply to the msdos file system, and which are not included in the man page for `mount'. Among these are the following: `uid=nnn' When an msdos file system is mounted, its files and directories have no `owner' as Linux understands it, so they are given, by default, the owner `root'. If you wish to access these systems from another user name, it is convenient to pretend that another user owns everything in the mounted system. To do this, use `uid=nnn', where `nnn' is the user's ID number from `/etc/passwd'. `umask=nnn' When an msdos file system is mounted, its files have only the `write' permission (if they are not read-only files), and its directories have no permissions at all. Permissions are set on the files and directories using the mounter's `umask'. To change this, you may set the permissions by specifying an explicit `umask' on the `mount' command line. `conv=*conversion*' DOS text files and Unix text files have different conventions for terminating lines. By default, msdos file systems are mounted in such a way that no conversion is done. This may be inconvenient if you are editing files on a DOS partition. The option `conv=t' or `conv=text' converts all line terminators when files are read from or written to the mounted DOS file system. This may lead to corruption of binary files. A safer (but still risky) option is `conv=a' or `conv=auto', which tries to guess whether a file is a text file or a binary from its extension. (I counted 36 extensions in `linux/fs/msdos/misc.c' which are treated as marking binary files. All other files are treated as text.) Special commands for DOS floppies and partitions ================================================ "Mtools" is a public domain collection of programs to allow Unix systems to read, write, and manipulate files on a DOS file system. The DOS file system itself is usually a more convenient way to access DOS file systems, but then mtools provide the ability to format and label DOS partitions, and they can allow non-root users to access floppy disks if you change the permissions on the `/dev/fd*' files. The following DOS commands are emulated: mattrib ATTRIB change DOS file attribute flags mcd CD change DOS directory mcopy COPY copy DOS files to/from Unix mdel DEL/ERASE delete a DOS file mdir DIR display a DOS directory mformat FORMAT put DOS file system on a formatted disk mlabel LABEL make a DOS volume label mmd MD/MKDIR make a DOS subdirectory mrd RD/RMDIR remove a DOS subdirectory mread COPY low level read (copy) a DOS file to Unix mren REN/RENAME rename an existing DOS file mtype TYPE display contents of a DOS file mwrite COPY low level write (copy) a Unix file to DOS Note that the `mformat' command does not do a low-level format of the disk. For this you must use the command `fdformat'. The above commands should not be used on mounted DOS file systems, since the kernel may not recognise that changes have been made without using the usual file system interface. The pattern matching routine more closely resembles Unix than DOS. For example, `*' matches all DOS files; it is not necessary to use `*.*'. The use of wildcards (or the '\' separator) requires the names to be enclosed in quotes, so that the shell does not expand them. For example, mcopy "a:*.c" . copies all files on the A: disk with the extension `.C' to the current Unix directory. On the other hand, mcopy *.c a: copies all files with the extension `.c' in the current Unix directory to the A: drive. This time you *want* the shell the expand the `*.c'. The original programs have been modified so that the device configuration is read at run-time from a file `/etc/mtools'. Moreover a check is performed to detect incorrect FAT type settings. The configuration file `/etc/mtools' defines the mapping of DOS drives to Unix devices. An entry in /etc/mtools can have any of the following formats: drive device drive device fat drive device fat cylinders heads sectors drive device fat cylinders heads sectors offset drive is the DOS drive letter, device is the name of the device on Unix, fat is the number of bits a FAT entry has (either 12 or 16), cylinders, heads, and sectors describe the disk geometry. On hard disks, the geometry parameters should all be zero. offset specifies how many bytes should be skipped when accessing the device. This is necessary when using non-standard disk configurations. The abbreviated entries are valid only on systems for which mtools can `guess' the disk parameters by looking at the Unix device name. If this is not possible, an error message is issued. Here is a sample configuration file: # /etc/mtools - mtools device definitions A /dev/fd0 12 80 2 15 # A: 5.25" HD A /dev/fd0 12 40 2 9 # A: 5.25" B /dev/fd1 12 80 2 18 # B: 3.5" HD B /dev/fd1 12 80 2 9 # B: 3.5" C /dev/hda1 16 0 0 0 # C: 30 MB HD partition A portable entry for floppies can be created by using `0 0 0' for the disk geometry: # /etc/mtools - portable mtools device definitions A /dev/fd0 12 0 0 0 # any A: B /dev/fd1 12 0 0 0 # any B: This has the slight disadvantage that `mformat' refuses to work. If you wish to use `mformat', you must specify additional entries in the `/etc/mtools' configuration file for the floppy formats you wish to be able to write. These are the entries which I use to format 1.4 Mb floppies in drive 0 and 1.2 Mb floppies in drive 1: E /dev/fd0 12 80 2 18 F /dev/fd1 12 80 2 15 Then I can low-level format a floppy using `fdformat', and add an msdos file system with the command `mformat E:' or `mformat F:'. It is important to set the FAT type right because this parameter can't be computed reliably from other parameters. Mtools tries to detect possibly incorrect settings and issues an error message. If this check should be bypassed, the FAT type has to be specified as a negative number; for example: D /dev/hda2 -16 0 0 0 Determining the correct FAT type is critical for hard disks. Writing to a hard disk with an incorrectly set FAT type will destroy vital information. If you're not sure whether you have a 12 or a 16 bit FAT, you should try reading a text file which is bigger than 8 Kb with the `mtype' command. You can use the commands `mcd' and `mdir' to locate such a file. The FAT type is wrong if `mtype' outputs data from other files after a while. The first few kilobytes are always read correctly, whether the FAT type is good or not. Commands peculiar to Linux ========================== There are several commands peculiar to Linux, or with features peculiar to Linux, of which you ought to be aware. Most of these commands have man pages which give useful information. After the system is installed, I suggest giving particular attention to the following commands: badblocks(8) fsck.ext2(8) mkfs(8) setfdprm(8) clock(8) fsck.minix(8) mkfs.ext2(8) setfont(8) doshell(8) fstab(5) mkfs.minix(8) setserial(8) dumpe2fs(8) halt(8) mklost+found(8) showfont(8) dumpkeys(1) init(8) mkswap(8) shutdown(8) fdformat(8) kbdrate(8) mount(8) swapon(8) frag(8) killall(1) rdev(8) tune2fs(8) fsck(8) mapscrn(8) selection(1) update(8) The command for reading about each of these corresponds to man 5 fstab where the `5' is replaced by the appropriate section number (usually `8' for these commands), and `fstab' is replaced with the name of the command. Most of the manual pages in sections 4 and 5 contain interesting information. For a list, give the command `ls /usr/man/cat[45]'. Recovering from Fatal Disasters =============================== You can use the MCC boot floppy to recover from fatal disasters. What kind of disaster requires such measures? Sometimes people accidentally do things which make the system unbootable. For example, they may edit or delete one of the configuration files in `/etc', or they may delete a fundamental utility, like `/sbin/init' or one of the shared libraries in `/lib'. In some of these cases, the system will still boot in single user mode. To do this you must have installed LILO as your boot loader, even if it is installed in a file system partition and is called by another boot loader, such as the DOS or OS/2 loaders. When LILO boots, you must force it to prompt you. No special action is necessary if you put the `prompt' command instead of the `delay' command in `/etc/lilo.conf'; this forces a prompt in all cases. To force LILO to prompt, you must perform one of the following actions: - Hold the `SHIFT' key down at boot time. - Hold the `CTRL' key down at boot time. - Hold the `ALT' key down at boot time. - Set the `CAPS LOCK' key on at boot time. - Set the `SCROLL LOCK' key on at boot time. When the prompt `boot:' appears, you must type the name of your default kernel followed by the word `single'; for example, boot: linux single If you don't remember the name of your kernel, press the `TAB' key. This causes a list of the available options to be displayed. In very serious cases, when you cannot boot in single user mode, you may use the MCC boot floppy to recover. In the simplest cases, boot from the MCC boot floppy, and give the command `ro root=xxx' at the LILO prompt. If that does not work, boot from the MCC boot floppy, giving the command `ro' at the LILO prompt. Place the root floppy in the drive when you are asked to do so. If the file `/bin/sh' is intact on your hard disk, you can choose `e' from the menu, and this will start a shell after mounting the various partitions. At this point, most of the editors and other utilities should work correctly. The commands `mount' and `umount' do not work at all. Repair the damage, then reboot the system. Do not use `halt', `reboot', or `shutdown' to reboot; type `CTRL-D' or `exit'. In the very worst possible case, for example when `/bin/sh' has been deleted, you can re-install Linux from the MCC floppies. As with all MCC upgrades, this creates a special directory named `/backupdirs', into which your existing configuration files are saved; for example, `/etc/passwd' is moved to `/backupdirs/etc/passwd'. It is not possible -- or desirable -- to leave such files if they exist, since the newly installed system might not boot. You will need to install LILO boot code again before rebooting. Use the command ROOT=/root;lilo If you recompile your kernel, or if you use one of the smaller MCC kernels, you may wish to customise the MCC boot floppy. Assuming that you have your kernel in `/boot/vmlinuz' and the matching data file `/etc/psdatabase', mount a `standard' MCC boot floppy in write mode from drive 0 on `/mnt'. Then give these commands: cp -p /boot/vmlinuz /mnt tar cf - /etc/psdatabase|gzip -9 >/mnt/psdata.tgz lilo -C /mnt/lilo.conf umount /mnt This should produce a recovery system that will boot your own kernel (so that the `ps' commands all work) and reinstall your own kernel if you install Linux from the floppy.