Previous Next Table of Contents

5. Sysbuild

You've assembled the machine and DOS boots from floppy. All the devices have been detected, and operate. You've got got the blank boot floppies, (or the disks prepared from your friends PC a working CD-ROM). You've got your netmask ready, You want to install Linux.

Actually, you should have used the BOOT disks to confirm that the devices are detected, using linux to check each device as it was installed.

When the kernel goes through it's initialisation, each driver in the kernel, reports on the device it initialises, confirming it is there, and has the correct IO_ADDR, IRQ, Ethernet MAC address, etc. If these scrolled by too quickly, the text is written to /var/adm/messages (after the disks have been mounted rw). The dmesg command recalls the boot messages, if you can get to a shell to run it. If a driver isn't included in the kernel, it won't report anything! /var/adm/syslog is also used.

This is explained much better in the Linux Getting Started documentation that comes with and on your CD. This may even be readable using a DOS viewer. However at the risk of confusing you even more ...

-NB- this was written before Linux driver MODULES were popular. If a driver is not built into the kernel, it won't be loaded and initialised with the rest of the kernel, but later.

5.1 Documentation

Everybody has to install, as well as here there are documents in:

LDP manual - eg Doctor Linux

        LDP-II          Getting started Chapter 2
        LDP-IV          Sytem Admin Guide - eg swap space
        LDP-VIII        Bootdisk HOWTO
        LDP-XIV         Distribution HOWTO
        LDP-XXII        Installation HOWTO - Mat Welsh 
                        The mini-printed inset with the CDROMS.
        LDR1:/cdrom/HOWTO/*.HOWTO - In text format.
If the printed versions are old, look on the CDROM's or on the net for http://sunsite.unc.edu/mdw/linux.html.

Remember to read through the rest of Raven, before starting. Especially things like formatting the disks (etc). It will make passing references more meaningful as reminders.

5.2 Slackware directories

Slackware(tm) from Patrick Volkerding is arranged to fit on floppy disks, all held under the /cdrom/slakware directory. CDROM distributions include extra things, and it can be confusing to know which directory is which.

Of course things may have changed by the time you are reading this, but you should be able to look for yourself, and annotate this list if things are different.

        /cdrom/slakware - the disks with ./a1/package.tgz
        /cdrom/slaktest - ./a1 disks configured for CD dependence (AVOID)
        /cdrom/slackwar - the installation help texts, dos prgrams etc
        /cdrom/slackwar/source/a1       # the sources to Slackware/a1
        /cdrom/slackwar/contrib - extra stuff (AUIS, IRC, ...)
        /cdrom/slackwar/kernels - should not need - but ... !
#
        /cdrom/slackwar/docs - other stuff which might not be in /usr/doc
        /cdrom/live/usr/doc - InfoMagic duplicates /usr on the CD
        /cdrom/help/booting - and some others
        /cdrom/HOWTO/*.HOWTO - In text format
        /cdrom/viewer/*  - MS-WIN HOWTO viewer (nice)

        /cdrom/utils/FIPS/FIPS.EXE      # shrink a DOS fdisk partition
        /cdrom/utils/RAWWRITE.EXE       # DOS write entire floppy (slowly)

        /cdrom/HTML/ldp/*.html          # Infomagic put it on cdrom #1

5.3 FIPS.EXE shrank my DOS partition

If your disk is already full of DOS, you should get a second disk for Linux. If that is not possible consider a UMSDOS installation (slow), or use DEFRAG then FIPS to reduce the DOS partition, releasing space for Linux. Most people don't need FIPS, It is simple, but not documented here..

        /cdrom/utils/FIPS/FIPS.EXE      # shrink a DOS fdisk partition

5.4 BOOT 'n ROOT

As always, Linux is changing. The new scheme has better RAM-DISK technology, and loadlin.exe can load the RAM-DISK from the CDROM using the DOS driver. IE you might never need a BOOT+ROOT pair! However, you might not have DOS available to you, and you might not have an EIDE CDROM, ie you require a special driver to access the CDROM, which is where all the extra files are!

        /cdrom/utils/RAWWRITE.EXE       # DOS write entire floppy (slowly)
        /cdrom/slackwar/boot144/idecd   # ide hd + ide cd
        /cdrom/slackwar/rootdsks/color.gz # colour menu setup - not tty

Firstly you need to create a pair of diskettes that will boot Linux on your box. The BOOT disk contains the kernel, and (usually) the LILO program to load it. The ROOT disk contains a (compressed) file-system that gets loaded into the RAMDISK, which gets mounted as '/' (ROOT).

The second disk is the easiest to pick. Almost everybody wants the same installation programs (some want text mode - not dialog screen, some want UMSDOS - not performance). I used /cdrom/slakwar/rootdsks/color.img.

        # to copy color.img to a floppy
        # with only DOS access to the E:\ CDROM
        #
        E:
        CD \SLAKWAR\ROOTDSKS
        E:\UTILS\RAWWRITE.EXE   # DOS write entire floppy (slowly)
        #
        # then follow the prompts
        # A:
        # COLOR.IMG

If you have a linux system, you can write out a root floopy with:

        dd if=/cdrom/slakwar/rootdsks/color.img of=/dev/fd0 bs=18k
The bs=18k is optional, but a lot faster, as it writes a complete track in one go (then re-reads it to validate it?). This is why RAWWRITE is so slow! It writes a sector or two, does a full spin, rereads to validate, does a full spin, then writes the next! (Actually Linux has been internally optimised so that this happens anyway, but it used to be true and it still applies to SVR4 and other UNIX's).

The BOOT disk holds the Linux kernel that will be used during the installation process. You must pick the right one.

There are several supplied on the CD, and you have to pick one that is right for your hardware. The kernel drives the hardware, and you will need to pick a kernel that can drive yours - ie the CDROM and the root partition DISK DRIVE.

Other options such as network controllers are probably less relevant to the process of installing Linux base and packages from CD to disk. If the kernel you select doesn't have the correct CD driver, it won't be able to read it. Ditto for the hard disk. If you have an EIDE CD, it uses the same driver as the EIDE hard disk - which is now standard.

If you have a SCSI disk (that you are installing to, or from a SCSI CD), you will need a kernel that can drive your SCSI CONTROLLER. If you have a IDE CD and disk, then the kernel will include the EIDE driver.

If you have a special CDROM, you need a kernel that can drive it (or install some other way).

If you don't have a CDROM, but do have a second machine, you can connect them using ethernet, parallel cables (see plip) or a null modem serial cable. You will then need a boot kernel that can drive your ethernet card, or has plip or pppd or slip built in (or available as a module). Then you boot, and configure TCP/IP on the card. Then you establish NFS or SMB over TCP/IP (SMB is used by windows-for-workgroups, WIN-311, WIN-95, NT, but you might have to convert the WIN-311 from netbios to TCP/IP using a freely downloadable module from microsoft).

With all these methods, you are estabishing local access to the slakware directory, which you configure as the "SOURCE" directory, with the "TARGET" directory being your new Linux root partition.

If your booting system uses MODULES, it is much the same, but the driver is a separate module on the floppy, not built into the kernel. This allows more flexibility, but also more care and attention to detail. Unless you use some really fruity SCSI disk, you needn't worry. It is perfectly OK to use an older kernel to install a newer Linux with.

If it works, it is SO easy. If it doesn't, you will have to work a bit. Use your imagination, you need the CDROM to read the /slakware/a1/files.tgz (etc). But you may be able to pre-load them onto an MSDOS partition, or make them available over NFS or even SMB (or even floppies!). Having a second machine helps, but is not necessary. If the first attempt fails, and it looks like the start of a long session, use LOADLIN to boot the kernel from MSDOS. It is a lot faster (though you will probably have to remove config.sys to get sufficient memory).

BOOT disk

Look in /cdrom/slackwar/boot144, If it's not mouted as /cdrom, use mount(1) or df(1) to see if it's mounted on /var/adm/mount or elsewhere.

You can use DOS and the rawwrite.exe program to read the help texts and create the disk.

Boot from the boot disk and switch to the root disk when prompted.

You will get a prompt BEFORE the kernel is loaded off the boot disk. This enables you to set special options to be passed to the kernel, eg /cdrom=/dev/hdc. The BOOT disks already have a few parameters builtin to the LILO configuration. You probably don't need to type anything here as the kernel can usually 'grope' the hardware to find what it is looking for (if it is there). But it is an option that helps if the kernel doesn't look at the IO_PORT where you installed your hardware, or crashes by probing a device that didn't like being probed, or ...

More modern BOOT+ROOT diskette pairs, may fit onto one floppy! There may even be a third disk (ie soon a second diskette) with a collection of kernel driver modules (and other stuff) on it. This would enable you to boot+root off the first diskette, then mount the utils floppy which you could always customise with any special drivers you need from your supplier (the LAN-CARD, SCSI-CARD or CDROM).

ROOT disk

Look in /cdrom/slackwar/rootdsks.

The ROOT disk gets loaded into a RAM disk, where it is used to complete the boot. It contains programs like /bin/login, /etc/passwd, /bin/sh ... so that you can login. If the 'ls' command is missing, try cd /bin ; echo *

RAM disk

When you use BOOT+ROOT, they are configured to copy the ROOT disk to a RAM-disk (size 1440 K-blocks). This frees up the floppy device, for those who don't have a CD-ROM. During normal system use, you don't have a RAM-disk (unless you want one).

People installing with only 4 MB ram, might have trouble, as the RAM-DISK is eating up their space. In that case establish some swap space as soon as possible.

login as root, run setup

Login as root (there is no password) to get a login shell (an open prompt), type setup to run the Slackware installation program. This program will go through a series of steps to configure your machine.

You could do much of this from the command line. The setup program calls programs, that you could call directly. Doing so will help you understand your machine better, and you will still be able to run the setup program and have it take over. The setup program seems to be quite aware of second-attempt installations, and detects all sort of things (though it can get tedious re-typing in names, and 'y' to obvious options).

REMEMBER: ALT-F2 switches to the second console.

Before or during setup you will

You or setup will edit /etc/fstab on your HARD-DISK (the one on the RAM-DISK evaporates when you reboot). You can mount DOS disks (eg floppies) with:

        mkdir -p /dos/a         # -p does a mkdir /dos first - if required
        mount -t msdos /dev/fd0 /dos/a
        ...
        umount /dos/a

This will enable you to save+load /etc/rc.d/rc.inet1 files when upgrading, but beware of dos filename.ext (8.3) not matching unix long filenames.

BE AWARE

This is UNIX (not). You are the system administrator. You are supposed to know what you are doing, the machine obeys. You say "jump off a cliff", it's gone.

Many commands do include sanity checks, and will notice if a device does not exist or is unusable because it is currently IN USE for something else. But avoid these hand rails, you only have yourself to blame.

Generally, in day-to-day operations, there are sensible checks, but system installation is about doing crazy things, like deleting file-systems, setting up swap sections, and generally setting the indicators that daily operations will check, over-riding any established indicators.

Before pressing return: relax, check the device numbering (eg /dev/hda4 -vs- /dev/hdb4), avoid using > when you meant < . Hopefully, we're building a new system, so any loss is time not data.

If you forget to do something in setup, you can probably reboot and do it later. Look in /var/adm/setup for the scripts. Really, all slackware does is untar the files to the root directory, run a shell script to create sym-links (/install/doinst.sh gets moved to /var/adm/scripts), and runs any special setup-script, to establish an initial configuration.

The brains of slackware is the setup script that does all the /etc/fstab editing (which you can do manually), /etc/lilo.conf editing (ditto), and maintaining a few lists of lists of files and package descriptions, and of course the huge task of integrating a system that works.

If you want to do it manually, you only really need a text editor to prepare /etc/lilo.conf and /etc/fstab so that it will boot. You may find an editor on the cdrom or your old system (I once used PICO the PINE editor, it was very strange, but very simple).

5.5 READ THIS IF NOTHING ELSE

Notes

Do not install more than ONE pre-compiled kernel (q1-q9). The last one in overwrites any previous ones. Maybe it won't boot your machine if you don't have the right disk controller driver! Either cnews or INN (don't mix).

5.6 Won't Boot Independently

I've had sytems installations failing for every reason under the sun. The earlier incidents were from ignorance of Slackware's setup, but many of the other's just happened, and Slackware's simplicity (?) came to the rescue,

EG At one time the Adaptec and BusLogic SCSI controllers confused my 1542 card, Passing the LILO option BusLogic=0 didn't help (no effect!), and the only BOOT kernel with SBPCD on it, also had BusLogic. To get the right kernel driver, I had to boot without SBPCD.

I've installed using a second WIN.311 machine to read the CDROM, feeding the CDROM to a booting slackware diskette over smbfs.o (I needed to copy the .o module file to floppy). I've even recompiled a kernel from the BOOT+ROOT environment. I hope you never have to. With Modular kernels you probably won't have to, you'll just need to get that cd_driver.o onto a floppy so that you can read the other driver.o files.

Note: Slackware helped me, but slackware setup script usually got in the way, eg installing with NFS is easy, as long as you don't have to type in the numbers to the dialog boxes, again, and again ... until you get it right. It's esier to run the commands manually, and install from a "pre-mounted SOURCE directory".

5.7 Using CHROOT to build a kernel from the BOOT diskettes

        chroot /var/adm/mount /bin/sh
#       -----------------------------
        cd /usr/src/linux 
        make config
        make dep
        make
        make zdisk
# NO?#  make modules    
# NO #  make modules-install

The chroot command, makes /var/adm/mount/usr/src/linux appear as /usr/src/linux, and /var/adm/mount/etc/lilo.conf appear as /etc/lilo.conf.

As soon as it runs, sh probably puts out an error message, because it can't find the current working directory (outside the chrooted zone), but cd / soon fixes that.

lilo -r /var/adm/mount uses a similar trick, to allow you to install lilo from /etc/lilo.conf, when that is currently mounted beneath /var/adm/mount.

If you have a pre-installed partition, you can run it's commands with the chroot command. EG if the new partition won't boot, but you can use the BOOT+ROOT disks, you can then get access to the "full" set of utilites, that you have installed (but can't boot to).

Be careful with chroot, and things like mounting a disk twice, or forgetting to unmount it.

        chroot /var/adm/mount /bin/sh
        cd /    # tidies up error message "cannot determine PWD"
        vi /etc/fstab
        vi /etc/lilo.conf
        mount /hda4
        lilo    
        umount /hda4
        exit

Another reason for not being able to boot independently, is that BIOS needs all the boot files to reside below 1024 cylinders. If you forgot, try loadlin.exe from DOS or a boot floppy.

Boots Independently

Don't throw the BOOT+ROOT away (or boot disk creaed with make zdisk), just because you don't NEED them anymore! You can use them as REPAIR disks, for when something goes wrong.

Load the X11R6 base, called XF86_SVGA, not XF86_Mono or XF86_Mach3 unless you have that kind of card. The LAST X11 server installed will override the LINK from X to XF86_SVGA.

Load the X11R6 contrib section (xdvi, xpaint), as well as the xview libraries and apps.

Install all the backward compatibility libs, a.out and X11R5 if you want to. There is still some of it about (PRE-ELF, occasionally pre-POSIX, k+r originals).

Slackware gives you the choice of two kernel sources. Disk3 has others, but slackware arranges them better with symbolic links - which prevents two source trees overlapping. Build a kernel for either ALL your cards, or the minimum to boot (the other devices are supported as modules).

Install as much of the other series of disks, as you wish. DO NOT SELECT ALL TeX fonts or your disk will be full before you start. Ditto for all EMACS gadgets.

Don't install cnews and INN on the same machine! If you don't install either, you can use netscape, pine, knews or skim.

A few packages more ...

Remember that /cdrom/slackwar/contrib contains loads of goodies, like AUIS, which may sound like an X25 protocol, but is actually a very nice X11 wordprocessor, with a spread-sheet / table editor. That is slackwar with a c but no e. Where you found the BOOT disk.

The other disks also contain Arena (an up and coming browser), an archive of kernel increments, apple comms, TCL-TK apps libr (old/new tk), TeX fonts.

Misc Admin (After boot)

Copy the huge /cdrom/ls_lr file from the FIRST disk to /tmp, then you can grep(1) for things like hdparm, to see who has the latest version for you. Ditto for MANIFEST.

When you desperately need space, rm -rf /usr/doc then use the copies on /cdrom/live/usr/doc. If you do delete it, recreate it with mkdir /usr/doc, so that new docs have somewhere to go.

Run updatedb, then locate README.ide

The slackware version of mc-2.0 does not do justice to mc-3.1, one of the finest programs in existence. grep /mc /tmp/ls_lr or ftp it.

add youself as a user with adduer and set passwords with password root and passord user (forget? me? no!)

edit /etc/profile, setting ignoreeof=2, PS1="$LOGNAME@$PS1"

edit /etc/fstab, setting up correct permissions for cdrom, dos-uid, exchangables.

edit /etc/XF86Config, xvidtune, locate README.Cirrus, see X11 configuration.

edit /etc/rc.d/rc.inet1 (and others) with routes to eth0 (explicitly, not the default route, leave that for when you dial Internet).

edit smb.conf, dosemu.conf, /etc/rc.d/*, PPP.HOWTO, README.Tunnel

Get some sleep.

5.8 Formatting the disks ..

You need a Linux partition, a swap partition.

FDISK Splits the disk into (upto) four main partitions.

Any of the 4 partitions can be "extended-partitions" divided into sub-partitions. NB "ext2" also uses the word "extended" - a coincidence. As long as DOS doesn't complain you will be OK, Linux is very flexible.

The FDISK information is written on sector 0, and no-where else on the disk. If you accidentally get it wrong, you can run fdisk again to redraw the partition boundary lines and get your original data back - PROVIDED YOU KNOW WHAT THE ORIGINAL VALUES WERE and HAVE NOT MODIFIED THE DISK IN ANY OTHER WAY.

Use fdisk to create your root, swap, dos and maybe boot partitions. Check that your system will boot from files below 1024 cylinders. Put the correct tag on the swap partition.

If you don't create a swap partition, you can create swap FILEs.

The 4 partitions can have any numbers you choose, not just the sequence on the disk. That is how I created hda4 to boot from, which appears before hda1 (the main partition).

There are two versions of fdisk (as well as the DOS versions). fdisk and cfdisk. cfdisk is supposed to be more friendly (curses menu version), but it can actually be more confusing. The real difficulty with fdisk is knowing how big to make each partition (etc), not with the commands that make fdisk do it! Use fdisk, and accept that it is a boring TTY-text application with simple commands (new partition, delete partition, tag partition, x-tended commands / export mode).

fdisk -l # lists all partitions on all drives.

Each partition has a partition TAG that tells Linux (and DOS) which operating system this partition is intended for, and whether it is a SWAP partition or a file system. fdisk has a list of tags to help you.

See the next chapter for more details on fdisk.

5.9 mke2fs - make ext2 file-system on partition

Creating the partitions, with fdisk, creates raw partitions areas. The information on them is random magnetic junk. A logically structured index of files needs to be written using the 'mke2fs' command. (Make file system). DOS uses the FORMAT command.

Linux understands a number of different fs layouts, the one used for hard disks is the ext2 fs, (they extending the Minix fs for bigger disks producing ext, then they extended the specification to a second version - ext2, you NEVER want plain ext).

The partition device name is the partition number 1-4 on top of the disk device, eg /dev/hda4 on /dev/hda. The mke2fs program is intelligent enough to get the disk size correct, but proceeds IMMEDIATELY to initialise that partition, erasing any files that used to be there (note that the file data blocks are not actually overwritten, but the index is).

The 'superblock' is the root of the index, and you get a few 'backup' copies just in-case. The 'fsck' program knows where to find them. The inode table is the index of the disk. Linux-ext2 actually splits the partition into several zones, each with it's own inode tables - but you don't need to know that.

        mke2fs /dev/hde3        # CHANGE THIS OR DIE

mke2fs won't ask for confirmation. Its effect is immediate (and devastating). Check your typing. It operates with extreme prejudice.

5.10 mkswap - prepare swap partition

Swap space is used as a virtual extension of memory. When running, pages of 4K bytes memory are swapped in and out of RAM to/from disk as needed (or not recently needed). If you don't have a swap partition you can use a plain file -see mkswap(8).-

The swap partition will get overwritten (destroyed slowly) if it isn't really a swap partition. To prevent this, the swapon and mkswap commands check the partition tag, and mkswap puts a marker to indicate that it has prepared a swap partition. The mkswap command is run once during installation, other than the device being CURRENTLY mounted, or nonexistent, mkswap won't check much.

        mkswap /dev/hda5        # change this

        free                    # check that the swap section isn't yet used
        swapon /dev/hda5        # if not in /etc/fstab
        swapon -a               # loads those listed in fstab
        free                    # see the difference

Remember to edit /etc/fstab, otherwise the swap sections won't be loaded when you reboot. eg X11 will freeze mysteriously and totally.

Remember that the /etc/fstab on the hard disk is not the same as /etc/fstab on the RAM-disk!

You don't have to have any swap space, but you won't get any virtual memory. When real memory runs out, malloc and sbrk will return FAIL, and your applications will print error messages and fail gracefully.

Unfortunately XF86_SVGA the X11 server, does not program defensively against running out of memory, and will simply crash your machine. (Try connecting with TCP/IP or a second VDU).

(After some USENET discussions, it seems that there are other problems that make it difficult to correctly predict when FREE space is completely exhausted. Personally, I hope things will get better.)

Without swap space, Linux cannot free up memory pages by writing data pages out to disk. This leaves it fewer pages to cache program binaries in, and it has to reload program pages excessively. If your system seems slow, use the free(1) command to see how much free space you have, and how much swap space is available.

If that seems ok, use the top(1) command to see if any processes are consuming 'too-much' CPU time (locked in a loop), and kill them.

5.11 How to boot with LOADLIN.EXE

If you find yourself booting from the floppies a lot, you can sve yourself some time by booting DOS and then using LOADLIN.EXE to boot Linux.

You can specify all those parameters that LILO also allows, but they can appear one-on-a-line, (which is much neater than /etc/lilo.conf). Copy all the files onto c:/boot1 and create two files:

kestrel.bat

        loadlin @kestrel.txt

kestrel.txt

This is a DOS text file, ie CR-LF, not just LF. Calling it .txt makes it easy to access. Commented-out lines are OK, as are multiple driver config lines

        c:/boot/2-0-7.knl       # the kernel file on C:
        # c:/boot/vmlinuz       # a different kernel
        # root=/dev/fd0         # floppy disk
        # ramdisk=1440          # loaded into RAM
        root=/dev/sda4          # the root partition MUST be specified
        sbpcd=0x320,LaserMate   # saves ages when groping
        # aha1542=0x330,11,4,5  # sample parameters for a card
        # buslogic=0            # bug # cannot diable !!
If you have DOS 6.0, you can edit config.sys to present you a menu of different boot profiles, including a range of Linux options. I don't have DOS 6. If you have System Commander or other, follow it's documentation. (I don't, I use LILO on the MBR and occasionally DOS 5 + WIN.311).

5.12 Mounting disks

Creating disk file-systems does not bring them online. /etc/fstab makes it a lot easier, but you can issue the commands manually (as root).

        mount                           # see what was mounted before
        mkdir /mnt                      # usually already exists
        mount -t ext2 /dev/hda4 /mnt    # bring the disk online 
        mount                           # see that is is mounted
        df                              # shows disk free space
        umount /mnt                     # 

other similar commands (examples)

        mkdir -p /dos/c
        mount -t ext2 /dev/hda1 /dos/c

        mkdir /cdrom
        mount -t is09660 /dev/hdd /cdrom

        mkdir -p /sparrow/cdrom
        mount -t nfs sparrow:/cdrom /sparrow/cdrom # requires working TCP/IP

        mount -t ext2 /dev/hda5 /mnt            # possibly a root disk
        mount -t ext2 /dev/hda6 /mnt/boot       # boot partition

        # Slackware setup may use /var/adm/mnt or other

The /etc/fstab on the hard disk is not the fstab on the RAM-disk. This can cause confusion that wastes a lot of time! Slackware setup will help you setup a working /etc/fstab on your hard disk. Then you can use much simpler commands like:

        mount /cdrom
        mount /sparrow/cdrom
        mount /hdc2             # I choose dir names similar to the device 

/sbin/e2fsck

If an ext2 partition isn't unmount'ed cleanly (eg you pressed reset mid flight), you won't be able to mount the partition fully until the e2fsck has had a look at it.

        /sbin/e2fsck /dev/hda1 

You should be able to mount the partition readonly, either by booting in single user mode, or from the BOOT+ROOT pair, using

        mount -r -t ext2 /dev/hda1 /mnt

This is how the boot process runs e2fsck from the disk that is being checked! A risky thing to do, but for a list of reasons, it usually works! This is also an option if the disk or the interface is faulty.

If you did boot single user mode, and have to fsck the disk from itself, you can either reboot, or remount the partition (rw) with the command

        mount -n -o remount,rw /

5.13 /etc/inittab

Normally when the system boots, you select the disk partition to boot as the 'root' partition '/' by configuring the LILO parameters (or LOADLIN.EXE). The kernel mounts the root partition read-only (initially) to prevent a sick system trashing the disk.

After loading and initialising, the kernel starts the one program it knows about: /etc/init. This has to be on the root partition! /etc/init then goes about it's job of bringing the system up. This includes mounting all the disks, and remounting the root partition (rw). /etc/init is a program and not part of the kernel. It reads the parameters from the kernel and /etc/inittab, and decides what to do - ie run /etc/rc.d/rc.S, then /etc/rc.d/rc.M and the getty's. The files in /etc/rc.d are all shell scripts.

rc.S runs fsck on the root disk and remounts it writable (rw), and fsck's the other disks and mounts them - according to /etc/fstab. It also runs the swapon -a command, which reads /etc/fstab.

You do not need to edit /etc/inittab, except when you want to tell /etc/init to start a 'getty' on a serial line, or boot into a different run level (eg xdm).

If you need to add /sbin/kerneld to your rc.S file, add it before it is needed, eg just after the fsck part.

5.14 /etc/fstab

This file tells Unix what disk partitions to mount, and what partitions are easily available later. This is an example, you MUST tailor this to your system! You can put comment lines in


        /dev/hda1       /            ext2        defaults   1   1
        none            /proc        proc        defaults   1   1

        /dev/hdb1       swap         swap        defaults       0
        /dev/hdc1       swap         swap        defaults       0

        /dev/cdrom      /cdrom      iso9660     defaults,noauto,ro,user 2 0

        /dev/hda4       /hda4        ext2        defaults   1   1
        /dev/hdb2       /hdb2        ext2        defaults   1   1
        /dev/hdc2       /hdc2        ext2        defaults   1   1

        pigeon:/cdrom   /pigeon/cdrom nfs       defaults,timeo=14,intr,noauto 0 0
        crow:/          /crow        nfs        timeo=14,intr,noauto

        /dev/fd0    /dos/a   msdos defaults,noauto,noexec,user
        /dev/hdb3   /dos/c   msdos defaults,umask=001,uid=1016,noexec   0 2
        /dev/hdb3   /dos/x  umsdos defaults,umask=001,uid=1016,noexec,noauto    0 2

The root partition MUST have the correct /dev/hda1 device name. It will still work with the wrong value in /etc/fstab (the actual value used is determined by LILO, eg with root=/dev/hda1), but everyone gets confused if it's wrong, so make sure they agree.

The root partition MUST be first. Any lines before it WONT get mounted properly (a bug maybe).

The swap lines should be in the file, and should be correct, otherwise the system won't have enough virtual memory, and may crash inside X11 or other. There is a safety margin, that the swap partition has an fdisk TAG that indicates that it is swap. swapon -a tests that tag.

The /cdrom line does not have to be there, and slackware works without it, by having a specific mount command in /etc/rc.d/somewhere. You should add it. You may also need to run a command like

        ln -sf /dev/hdd /dev/cdrom      # ie cdrom -> hdd
to indicate the real device for cdrom is the fourth ide disk. After that you won't need to reconfigure workman, workbone or /etc/fstab (unless you have more than one CDROM or a jukebox!)

Then you can change disks with:

        umount /cdrom
        mount /cdrom
provided, of course, that the disk is not is use, eg programs running from it, or pwd says that it is in use by the current shell (or on a different shell, different console, or parent shell!).

The lines like /hda4 use rather un-imaginative names for the mount points, but I like this scheme, since it is what it is. In practise each additional disk has several roles. When I want decent names I use symbolic links, eg:

        /usr/andrew     -->     /hdc2/andrew    # shared by old+new
        /usr/local      -->     /hdc2/local     # beware of tar, check the link 
        /home/gps       -->     /hdc2/gps       # lots of ftp files there
        /kernels        -->     /hda4/kernels   # < 1024 cylinders
        /boot           -->     /hda4/boot      # < 1024 cylinders
        /old            -->     /hdb2           # the 'old' booting system
        /new            -->     /hda1   # diff /old/etc/fstab /new/etc/fstab
        /hda1           -->     /               # for regularity

Remeber that extra things don't HAVE to be in /etc/fstab, but it's easier if they are.

pigeon is another host connected with ethernet. It has a file etc/exports/ containing:

        /cdrom  (ro)    # no host validation but probably secure ?
The defaults need investigating, but now I can say:
        mount /pigeon/cdrom

The noauto parameter prevents those lines being mounted at boot time (a long timeout for NFS).

The parameters for the MSDOS partitions make it appear as if every file belonged to user 1016. The 'user' parameter makes it mountable by users without permission on the device, and every file then belongs to that user (for MSDOS, as_is for ext2). The umask should really be split into files and dirs (because of the 'x' bit), but the noexec makes it safer to navigate without running anything (or allowing suid programs in).

Those with sharp eyes will notice that /dos/c and /dos/x use the same device. This is Ok because it can only be mounted once. Simply umount one, and mount the other. It is just a way of testing whether umsdos, with it's long file names are worth it or not.

My current opinion is not-really, but I'm not certain. There are parameters to mount (msdos) to control whether long file names generate errors. This needs further work, as a cp -p * /dos/a/safe_dir managed to overwrite filename with filename.bak. (Because file.name already had a dot in it!).

5.15 /etc/exports

Note that NFS is not very secure. I had a host it refused to recognise, because I had mis-spelled drycon, and it refused my identity (quite properly). However it was quite happy to tell me whether directories existed or not!

# world
                                /cdrom  (ro)
                                /home/ftp (ro)
                                /home/ftp/pub/writable (rw)
# local - via known gateways -
                *.trix.dircon.co.uk:/home/ftp/pub  (rw) 
                         *.trix.org:/home/ftp/pub  (rw) 
                       *.lan_44.org:/home/ftp/pub  (rw) 
# PPP - claiming to be -
                        *.lan_22.org:/home/ftp/pub (rw)

This is some of the "fireproofing" applied to the Inet apps, including /etc/inetd.conf, /etc/hosts.allow, ftp.allow, and other files. It works by looking at the IP_ADDR of the calling host, and converting it to a host name, then allowing or denying access to that host.

5.16 /etc/profile

This is run by /bin/sh when you login. You may wish to make a few modifications. Test each modification before leaving them.

HINT: If you mess up badly, you won't be able to login. Keep a root login in a different window, that you can use. Also su - user goes through /etc/profile, whilst su user doesn't. If you can't login because you messed up /etc/profile, switch to the other virtual console (using ALT-F2), and fix it.

ignoreeof=2

This makes it quicker if you use CTRL-D to exit a shell

export DISPLAY=${DISPLAY:-"0.0"}

This sets the default DISPLAY that X11 applications will use.

export MORE=${MORE:-less}

Selects the prefered pager. You might also want to run (once)

        cd /usr/bin ; ln -s less pg

PATH=$PATH:$HOME/bin

If you use such a directory.

PS1="$LOGNAME@$PS1"

Put this at the end of the file, after PS1 has been set, to tell you which user you are (as well as which host you are on). This makes it a lot less frustrating to work as a plain user. You should only run as root when doing root things like repartitioning disks.

5.17 ln -s ttyS0 mouse

If you have a serial mouse on ttyS0, you tell Linux apps where it is, (/dev/mouse --> /dev/ttyS0), and what it is (MouseSystems mode). using:

        cd /dev
        ln -s ttyS0 mouse
You also have to tell the two main Linux mouse apps, what type of mouse it is. With X11 (XFree86) you put a line in /etc/XF86Config
        Section "Pointer"
                Protocol    "MouseSystems"
                Device      "/dev/mouse"
        EndSection

Text based apps, means the "gpm" program. You configure it with a a command line option, when you start gpm. Usually in /etc/rc.d/rc.local

        # don't forget the ampersand, it runs the command in the background
        gpm -t msc &    

5.18 ln -s cua2 modem

If you have a internal modem on ttyS2 which is the same as cua2 (but different), you tell Linux apps where it is using:

        cd /dev
        ln -s cua2 modem
From then on, you don't have to specify /dev/cua2, simply /dev/modem. Most comms programs have that as their default, so many things simply "fall into place".


Previous Next Table of Contents