4.4: Basic Configurations


Contents of this section:
4.4 Basic Configurations
   4.4.1 How to setup my soundcard?
   4.4.2 How do I setup my printer?
   4.4.3 Word Perfect 8 does not have a driver for my printer
   4.4.4 Configuration files
   4.4.5 Device files
   4.4.6 Some daemons

4.4.1 How to setup my soundcard?

Try to run  (as root)

sndconfig

Unless you have a very fancy sound card, this will work for you. At the end of the setup, Linus says how he pronounces "Linux".  (On RedHat, "sndconfig" can be also run via the "setup" utility--type setup . )
You may want to try your soundcard and cdrom using a command line cdplayer. Put a music CD to your CDROM and type:

cdplay

If this does not work, maybe you don't have /dev/cdrom?  Check if you can mount a data CD as root (look here) and create the device /dev/cdrom by linking it to the appropriate drive (most likely /dev/hdb), for example (as root):

ln -s /dev/hdb /dev/cdrom


If cdplay works for root, but does not work for a regular user, you may need to give (as root) everybody the permissions to read and write to the the file /dev/cdrom or review the permissions on /mnt/cdrom, or modify /etc/fstab as explained earlier, e.g.:

chmod 666 /dev/cdrom

(The directory /dev  is where all your devices appear as files.)
To play third song, try:

cdplay play 3

You can also use the command cdp for rudimentary command line interface to cdplay, but perhaps you prefer the interfaces available from under X-windows (e.g., from KDE "K" menu, choose: Multimedia-"CD Player").

To stop the music either press the button on your CDROM or issue one of these commands:

eject
cdplay stop

Troubleshooting.  If you are having problems with a sound card, a manual configuration is an option. Here is my setup for a SoundBlaster16-compatibile ("no name") soundcard that persistently played at half speed (too slow and with "low voice") because it was misdetected. The resource to read turned out to be: /usr/src/linux-xxx/Documentation/sound (hope you installed the kernel source code so that you have the documentation).  The file to edit is /etc/modules.conf. The critical line in this file (after manual edition) is:

options sb esstype=1688 io=0x220 irq=5 dma=0 dma16=5 mpu_io=0x330

The change that I had to make was to insert the "esstype=" option. After modification, the best to test your setup is to cold reboot (shutdown to a halt, and then recycle the power).

4.4.2 How do I setup my printer?

Start an X-terminal (perhaps by pressing the proper button) and type in it (as root or you will be prompted for the root password):

printtool &


This program does a complete printer setup, you just have to fill up the information about your type of printer and where it is hooked up.

Specifying the proper printer port is the most important part. If you don't know which one is yours try: on RedHat 5.2: lp1 (this is the first parallel port on RH5.2 ) or lp2 (this is the second parallel port on RH5.2) or lp3 (this is the third parallel port on RH5.2); on RedHat 6.0 (or later):  lp0 (this is the first parallel port on RH6.x) or lp1 (this is the second parallel port on RH6.x) or lp2 (this is the third parallel port on RH6.x).  After upgrading from RH5.2 to 6.0, the printing stopped working because the name of the parallel ports changed. I had to re-run the printool and adjust the port. The numbering of ports changed to bring it in line with numbering of other devices, which always starts from 0.

Try printing an ASCII test-page straight to the port. Only when this works set up the bells and whistles.

If you are setting up a remote printer, make sure that your machine has the permission to use the remote printer. The permissions are set in the file /etc/hosts.lpd (more secure) or /etc/hosts.equiv (less secure)  on the machine to which the printer is attached. These files simply list the names of the remote computers that can use a local printer, one computer name per line. Mine looks like this:

hacker
mars

The file /etc/hosts.lpd did not exist on my system, so I created it.
For quick information about the printers on your machine, you may want to view the file /etc/printcap :

cd /etc/
cat printcap

Here is the meaning of some codes that I see in my /etc/printcap:

: Field separator (separates the entries in the file).
\ (at the end of line) Continuation on the next line.
lp Name of the printer. "lp" is the name of the default printer on your machine. Subsequent printers are often, by default, given the the names lp0 or lp1, ... (or whatever you like) but this should not be confused with the name of the devices (parallel ports) to which they are connected.
sd=/var/spool/lpd/lp My spool directory (sd).
mx#0 Maximum size of print jobs (mx) in blocks. "0" means no limit.
sh I want headers to be suppressed (sh). Header is the page with your name that prints before your printing job (waste of paper if you print at home).
rm=mars Name of the remote machine (rm), which on my system is called "mars (my printer is connected to a different computer).
rp=lp 

or

lp=/dev/lp0

Name of the remote printer (rp), which is the name of the printer on the remote machine ("lp" on "mars" on my home network)
or 

the name of the device on the local machine.  "/dev/lp0" is the first parallel port on RH6.x (it used to be /dev/lp1 on RH5.2, the numbering of parallel ports changed).

if=/var/spool/lpd/lp/filter Input filter (if). Your printing job will be formatted by this "filter" before it is sent to the printer.
sf Suppress the form feed (sf)  that is normally sent when printing is completed (use it if your printer keeps printing an empty page at the end of each jobs).

The printer is controlled using the command lpc (as root).  Type "?" to see the options. This program is notorious for its peculiarities, so don't get discouraged easily. The printer queue can be viewed with lpq and cleaned up with lprm , both of which work for a user (not only root). You can print from the command line using the command lpr.  Under KDE, you can control the printer queue from the program available under the "K-button"-"Utilities"-"Printer Queue".

Most printers will work perfectly under Linux, but some may not utilize their full capablity due to lack of information/drivers from the vendors. Therefore, when purchasing a new printer, you may want to consult the database of Linux printers:  http://www.linuxprinting.org/database.html.  In brief, it is a good bet is to select ( http://www.linuxprinting.org/suggested.html): 

- For inexpensive colour printing:  an Epson Stylus, for example:  Stylus C80 (better) or Stylus C60 (cheaper) (Dec.2001). HP inkjets are generally less recommended than Epson's. Please note that "inkjet-type" printers are (in general) "not-so-great" for black-and-white printing. Also, they are meant to be "personal" printers and do not handle well high volumes. Yet they can offer excellent colour output, particularly on good quality paper. Kids love inkjets.
- For low-end laser printing:  a Lexmark or Brother printer.  Many Hewlett-Packard (HP) laser printers will also work perfectly, but one has to be more careful when selecting an HP printer due to their more limited support. Lower-cost laser printers are always black-and-white, but they offer excellent quality text printouts. You may avoid some headaches if you select a printer which supports "Postscript".

4.4.3 Word Perfect 8 does not have a driver for my printer

If you installed your printer in KDE using the printtool and it had a driver which works fine, set up Word Perfect to print using the "passthru postscript" driver.

4.4 4 Where are the setup and configuration files?

System-wide settings settings are stored in the /etc directory. User-specific settings are stored in the user home directory /home/user_login_name.

Here is a listing of some system-wide configuration files that I use most often:

SHELL DEFAULTS
/etc/bashrc - system-wide default functions and aliases for the bash shell
/etc/profile - system-wide defaults for bash shell, including system-wide environment variables.

ADMINISTRATIVE SETTINGS
/etc/passwd - contains passwords and other information concerning users who are registered to use the system. It can be modified by root directly, but it is preferable to use a configuration utility such as passwd to make the changes. A corrupt /etc/passwd file can easily render a Linux box unusable.
/etc/shadow - contains "shadow" information for the passwd file, i.e., the information pieces which "the world" does not have permission to read.
/etc/group - similar to /etc/passwd but for groups.
/etc/crontab - setup for "cron", which runs commands periodically (hourly, daily, weekly, monthly, etc.).
/etc/inittab - runs different programs and processes on startup.
/etc/issue - message that accompanies login prompt. This is often overwitten by the rc.local script.
/etc/issue.net - same as above, but used when login is attempted over the network.
/etc/motd - "message of the day" file, displayed after a user logs in.
/etc/rc.d/rc.local - the last script to execute on the system bootup. I put the commands which customize my local machine at the end of this file.   It works like DOS "autoexec.bat".

NETWORK CONFIGURATION
/etc/hosts - contains a list of host names and absolute IP addresses.
/etc/hosts.allow - hosts allowed to access Internet services
/etc/hosts.deny - hosts forbidden to access Internet services
/etc/resolv.conf - setups for a list of domain name servers used by the local machine
/etc/inetd.conf - configures the inetd daemon to tell it what TCP/IP services your machine should run.
/etc/exports - specifies hosts to which file systems can be exported using NFS (network file system). man exports contains information on how to set up this file for remote users.

HARDWARE CONFIGURATION
/etc/conf.modules - setup for the linux kernel modules. Modules are like "device drivers" under MS Windows or DOS.
/etc/fstab - contains information on partitions and filesystems used by system to mount different partitions and devices on the directory tree.
/etc/mtab - shows currently mounted devices and partitions and their status.
/etc/lilo.conf - configuration file for lilo boot loader.
/boot/grub/grub.conf - configuration file for grub boot loader.
/etc/printcap -  setup for printers.
/etc/termcap - ASCII database defining the capabilities and characteristics of different consoles, terminals, and printers. You typically don't want to change these.
/etc/X11/XF86Config - X configuration file. For XFree version 4.xx, the file is /etc/X11/XF86Config-4 (if it does not exist, then XF86Config is tried).

4.4.5 What are all the device files?

Devices appear as files in the directory /dev. They can be read, or written to, if you have the permission to do so. The listing of the file reveals some important details about the device, for example:

ls -l /dev/ttyS3

on my system produces the following output:

crwxr-xr-x    1 root     tty        4,  67 Mar 13 22:59 ttyS3

The initial "c" indicates a character device. "b" would mean "block device", "p"=FIFO device, "u"=unbuffered character device, "d"=directory, "l"=symbolic link. The numbers "4, 67" mean that the device major number is 4 and the minor number is 67. To make some devices usable to all users on your system, you may need to set the proper permissions. For example:
ls -l /dev/usb/scanner0
chmod 666 /dev/usb/scanner0

Here is a list of some common devices:

/dev/ttyS0 - the first serial port. The mouse is typically connected here.
/dev/ttyS1 - the second serial port. This may well be the device to which your modem is connected.
/dev/ttyS2  and /dev/ttyS3 the third and fourth serial port (typically not present, but your internal modem may well be configured as one of these).
/dev/modem - the serial modem. In the typical case, a symbolic link to /dev/ttyS1, /dev/ttyS2, /dev/ttyS3 or /dev/ttyS0, depending to which serial port your modem is connected.
/dev/mouse - mouse. In the typical case, a symbolic link to /dev/ttyS0 or similar (see above), depending to which serial port your mouse is connected.
/dev/lp0  - printer on the first parallel port. That's where normally printers are connected.
/dev/lp1  - printer on the second parallel port (typically not present).
/dev/fd0 - first floppy disk drive (almost always present).
/dev/fd0H1440 - driver for the first floppy drive in the high-density mode (1440 kB). Generally, this (or a driver with a device with a similar descriptive name) is invoked when formatting a floppy drive to a particular density. Slackware also comes with drivers that allow for formatting a 3.5" diskette with up to 1.7MB of space. Red Hat and Mandrake do not contain these device drivers files by default.
/dev/fd1 - second floppy disk drive.
/dev/hda - first IDE hard drive  (whole drive). Most hard drives on IBM-compatibile PCs are IDE.
/dev/hdb - second IDE hard drive (whole drive). On many computers, the IDE cdrom drive is attached here.
/dev/hdc - third IDE drive (whole drive). On many computers, the IDE cdrom drive is attached here.
/dev/cdrom - a symbolic link to the appropriate drive interface, typically  /dev/hdc or /dev/hdb (a CDROM) or /dev/scd0 (a CD-R/RW writer).
/dev/hda1 - the first partition on the first IDE hard drive. /dev/hda2 is the second partion on the first IDE hard drive. As one could guess, /dev/hdd8 would be the eight partition on the fourth IDE hard drive.
/dev/tty1  -  the first text console. /dev/tty2 is the second text console, etc.
/dev/dsp - digital audio, i.e., the sound card. "dsp" stands for "digital signal processing".
/dev/sndstat - do cat /dev/sndstat to learn about the status of your sound devices.
/dev/null - used when you want to send output into oblivion.
/dev/random - used to read pseudo-random numbers. Do cat /dev/random to display garbage-looking characters on your screen. There is also /dev/urandom to generate lower-quality random sequences.
/dev/sda -the first SCSI drive (whole drive). On a home machine, you are unlikely to have any SCSI drives (expensive).
/dev/sdb - the second scsi drive ("sdc" is the third scsi drive, etc. There can be many scsi drive on a system).
/dev/sda1 - the first partition on the first scsi drive.
/dev/sr0 - the first scsi CD drive (sometimes called /dev/scd0). If you have an ATAPI CD writer, it will also be likely here.
/dev/sr1-is the second scsi CD drive (sometimes called /dev/scd1),  (/dev/sr2 is the third scsi CD drive, etc. There can be many scsi CD drives on the system).
/dev/usb/scanner0 - a usb scanner.  Try: less /usr/src/linux/Documentation/usb/scanner.txt for an info on scanner configuration from scratch.

For more info try:
less /usr/src/linux/Documentation/devices.txt
man MAKEDEV

As explained in /usr/src/linux/Documentation/devices.txt, I may need to create some symbolic links to device files locally to configure my system. This is merely a tabulation of existing practice, and does not constitute a recommendation.  However, if the links exist, they should have the following uses:

/dev/mouse      Current mouse port***
/dev/tape       Current tape device
/dev/cdrom      Current CD-ROM device***
/dev/cdwriter   Current CD-writer device (but my RedHat have /dev/cdrecorder)
/dev/scanner    Current scanner device
/dev/modem      Current dialout (modem) port***
/dev/root       Current root filesystem
/dev/swap       Current swap device

The *** mark the symbolic links that are surely present on my Mandrake system.  For example, if having problems with mouse I would do something like (as root):
ls -l /dev/mouse
[see if the mouse device is present and where it points]
ln -s /dev/ttyS0 /dev/mouse
[create a symbolic link so that /dev/mouse point to the first serial port]

For SCSI (and ATAPI) devices, /dev/tape and /dev/cdrom should point to the ``cooked'' devices (/dev/st* and /dev/sr*, respectively), whereas /dev/cdwriter and /dev/scanner should point to the appropriate generic SCSI devices (/dev/sg*).

Non-transient sockets and named pipes may exist in /dev.  Common entries are:
/dev/printer    socket     lpd local socket
/dev/log        socket     syslog local socket
/dev/gpmdata    socket     gpm mouse multiplexer

Some Linux daemons

Daemons are "resident"programs that periodically wake up, check your system and may perform certain functions. They do not take any input and don't normally produce any output. Your Linux system is likely set to run quite a number of daemons. Most of them can be (dis)selected by running the program ntsysv (RedHat) as root and checking the appropriate box. The short description of each daemon is available under netsysv by pressing <F1>.  If the daemon you need is not listed in ntsysv, you need to insert your RedHat/Mandrake installation CD and install the appropriate package. The alternative to ntsysv may be tksysv (type as root, in X terminal), which is perhaps more flexible, but way more complicated (it lets you set up the list of daemons to run in each runlevel). Another, simpler and even more powerful+flexible+difficult-to-use tool is /sbin/chkconfig.

Here is a short list of popular daemons with a brief description:

anacron - checks `cron' jobs that were left out due to down time and executes them. Useful if you have cron jobs scheduled but don't run your machine all the time--anacron will detect that during bootup.
amd - automount daemon (automatically mounts removable media).
apmd - Advanced Power Management BIOS daemon. For use on machines, especially laptops, that support apm.
arpwatch - keeps watch for ethernet/ip address pairings.
atd - runs jobs queued by the "at"  command.
autofs - control the operation of automount daemons (competition to amd).
bootparamd - server process that provides information to diskless clients necessary for booting.
crond - automatic task scheduler. Manages the execution of tasks that are executed at regular but infrequent intervals, such as rotating log files, cleaning up /tmp directories, etc.
cupsd - the Common UNIX Printing System (CUPS) daemon. CUPS is an advanced printer spooling system which allows setting of printer options and automatic availability of a printer configured on one server in the whole network. The default printing system of Linux Mandrake.
dhcpd - implements the Dynamic Host Configuration Protocol (DHCP) and the Internet Bootstrap Protocol (BOOTP).
gated - routing daemon that handles multiple routing protocols and replaces routed and egpup.
gpm - useful mouse server for applications running on the Linux text console.
httpd - daemon for the Apache webserver.
inetd - listens for service requests on network connections, particularly dial-in services. This daemon can automatically load and unload other daemons (ftpd, telnetd, etc.), thereby economizing on system resources. Newer systems use xinetd instead.
isdn4linux - for users of ISDN cards.
kerneld - automatically loads and unloads kernel modules.
klogd - the daemon that intercepts and displays/logs the kernel messages depending on the priority level of the messages. The priority is (copied from /usr/include/linux/kernel.h ):
KERN_EMERG      "<0>"  system is unusable
KERN_ALERT      "<1>"  action must be taken immediately
KERN_CRIT       "<2>"  critical conditions
KERN_ERR        "<3>"  error conditions
KERN_WARNING    "<4>"  warning condition
KERN_NOTICE     "<5>"  normal but significant condition
KERN_INFO       "<6>"  informational
KERN_DEBUG      "<7>"  debug-level messages
The messages typically go to the appropriately named files in the directory /var/log/kernel.

kudzu - detects and configures new or changed hardware during boot.
keytable - loads selected keyboard map.
linuxconf - the linuxconf configuration tool. The automated part is run if you want linuxconf to perform various tasks at boottime to maintain the system configuration.
lpd - printing daemon.
mcserv - server program for the Midnight Commander networking file system. It provides access to the host file system to clients running the Midnight file system (currently, only the Midnight Commander file manager). If the program is run as root the program will try to get a reserved port otherwise it will use 9876 as the port. If the system has a portmapper running, then the port will be registered with the portmapper and thus clients will automatically connect to the right port. If the system does not have a portmapper, then a port should be manually specified with the -p option (see below).
named - the Internet Domain Name Server (DNS) daemon.
netfs - network filesystem mounter. Used for mounting nfs, smb and ncp shares on boot.
network -activates all network interfaces at boot time by calling scripts in /etc/sysconfig/network-scripts .
nfsd - used for exporting nfs shares when requested by remote systems.
nfslock - starts and stops nfs file locking service.
numlock - locks numlock key at init runlevel change.
pcmcia - generic services for pcmcia cards in laptops.
portmap - needed for Remote Procedure Calls. Most likely, you need it for running network.
postfix - mail transport agent which is a replacement for sendmail. Now the default on desktop installations of Mandrake (RedHat uses sendmail instead).
random - saves and restores the "entropy" pool for higher quality random number generation.
routed - daemon that manages routing tables.
rstatd - kernel statistics server.
rusersd, rwalld - identification of users and "wall" messaging services for remote users.
rwhod - server which maintains the database used by the rwho(1) and ruptime(1) programs. Its operation depends on the ability to broadcast messages on a network.
sendmail - mail transfer agent. This is the agent that comes with Red Hat.
smbd -  the SAMBA (or smb) daemon, a network connectivity services to MS Windows computers on your network (hard drive sharing, printers, etc).
squid - An http proxy with caching. Proxies relay requests from clients to the outside world, and return the results. You would use this particular proxy if you wanted to use your linux computer as a gateway to the Internet for other computer on your network. Another (and probably safer at home) way to do it, is to set up masquarading.
syslogd - manages system activity logging. The configuration file is /etc/syslog.conf .
smtpd - Simple Mail Transfer Protocol, designed for the exchange of electronic mail messages. Several daemons that support SMTP are available, including sendmail, smtpd, rsmtpd, qmail, zmail, etc.
usb - daemon for devices on Universal Serial Bus.
xfs - X font server.
xntpd - finds the server for a NIS domain and stores the information about it in a binding file.
ypbind - NIS binder. Needed if computer is part of Network Information Service domain.

Go to Part: 4.5 - Networking