Best of Technical Support

Various

Issue #40, August 1997

Our experts answer your technical questions.

Trouble With crontab

I'm having trouble using the crontab file. This is the first time I have tried it and have not been able to get it working. The daemon crond is running. In my crontab file I have the following line:

30 6 * * * /home/Talon/automail

automail is a shell script to log on to my Internet provider, get my mail and log off. As far as I can tell crond never executes this command. —Jeff Largent

Making Programs Executable

Are you sure your automail program is executable? If it isn't, type:

chmod +x /home/Talon/automail

—Pierre Ficheux, Lectra Systèmès pierre@rd.lectra.fr

/dev/fd0 Error Message

When I try to mount /dev/fd0 I get the following error message:

/dev/fd0 is not a block device

What does that mean and how do I fix it? I can fdformat a floppy, but I can't mount or create a file system on one. —Scott Petinga

Identifying Block Devices

Check out the type of /dev/fd0—it should be a block device. If it is properly identified, the leading character for this device in the directory list will be a b. For example:

$ ls -l /dev/fd0
brwxrwxrwx   1 root    floppy     2,    0 Jul 18  1994 /dev/fd0

If the b is not present, re-create the device by typing:

rm /dev/fd0
mknod /dev/fd0 b 2 0
—Pierre Ficheux, Lectra Systèmès pierre@rd.lectra.fr

Mysterious Zombie Process

Every time I start up the X program netcfg, it generates a zombie process. I haven't been able to get rid of it. Nobody in my dorm can figure this out either. —Scott

Bug Fixes in netcfg

netcfg is a python script that Red Hat created to ease the configuration of network parameters. This script has been expanded and had many bugs fixed since 4.1 was released.

I suggest you upgrade to the latest netcfg-rpm (which is netcfg-2.15-1.i386.rpm as of this writing). —Mario de Mello Bittencourt Neto, Argo Internet mneto@buriti.com.br

Limiting Directory Size

How do I limit the size of a directory? I want to limit each customer's directory to 1MB. If a customer attempts to upload 2MB of content via ftp, I want Linux to reject the attempt to store more than 1MB. How do I accomplish this disk management feat? —M. Lamberson

Install Quota Support

This is easy. Install the quota support that will allow you to control the maximum size of a user's home directory. Assuming that you have FTP configured to redirect non-anonymous FTP logins to the actual home directory, it is simply a matter of configuring quota support in your kernel. Just go to /usr/src/linux and type:

make menuconfig

Under the Filesystems entry, check for quota support. Recompile the kernel, reboot and you can configure quota as you wish. —Mario de Mello Bittencourt Neto, Argo Internet mneto@buriti.com.br

init Run Levels

What do the different run levels listed by the init command do? I have looked in various Unix books and also in Linux Configuration and Installation, but I can't find any information. —Paul Sutton

Different Levels of Operation

A Unix run level is a state of system configuration. Each level signifies a certain level of operation. The run levels are controlled (and are relevant to) the init daemon, which is the first process that is executed when any Unix system is first loaded.

init's job is to start and stop processes, and the run levels help determine which to control. The file /etc/inittab contains entries that init uses to decide which processes to start and how to start them. An entry looks like this:

NM:LEVs:WHEN_AND_HOW:COMMAND

NM is a two-letter identifier for the command—each command must have its own, unique identifier. LEVs is a list of levels during which to run the command. It is typically a number or set of numbers from 0-5 but can also be an S or even nothing, depending on your version of init. WHEN_AND_HOW is an option specifying when the command should be run, whether init should wait for it to finish or not, whether it should be restarted when it dies and so on. COMMAND is the full path and file name of the command to execute.

The run level corresponds to the LEVs list. For example, the following lines are in my inittab file:

# Start the local dial-in services
s0:45:respawn:/usr/local/sbin/mgetty ttyS0 \
        vt100 -D -x 0
s1:45:respawn:/usr/local/sbin/mgetty ttyS2 \
        vt100 -D -x 0

I have defined two processes, s0 and s1, which will be executed any time the system is in run levels 4 or 5. The respawn option tells init to re-execute the command when the command terminates. (This allows my dial-in lines to accept the new callers when users hang up.) Finally, you can see the command that is run for each entry.

By using run levels, a system administrator can configure a system to automatically start and stop certain processes when they put their systems into different run levels. The most common use for this capability is to have a normal, multi-user level and a single-user administration level. By triggering this level, they can have their servers automatically terminate user processes and disable network support in order to administer their systems.

You can get more information on Unix run levels from the INIT(8) and INITTAB(5) man pages. Since many different Unix flavors exist, there are also many different versions of init. So, you should examine your man pages for exact details. —Chad Robinson, BRT Technical Services Corporation chadr@brttech.com

Making Sense of Core Dumps

How does one read a core dump file? Occasionally, a machine will crash and a core dump file is output. When I try to read them (using the more command) they are full of meaningless characters. I have yet to find anything on how to read these files except for a debugger for debugging the programs that caused the dump—I never know which program caused the core dump. Any ideas on other avenues of determining what happened? —G. Hendricks

Using gcc and gdb

Core dump files are process states for the process that died. When a process terminates with one of various signals (such as SIGSEGV, the segment violation, typically indicating a memory-related bug in the program) and the process owner's ulimit (see your shell's man page) allows for core files, a core dump will be created. It contains information such as the entire set of memory allocated to the program, where the program was when it died and what it was doing.

A core dump is an invaluable tool to Unix programmers. By using it in conjunction with a debugger, a programmer can see what went wrong with his or her program.

To examine one of these files, you typically need two things. First, the program must be compiled and linked using gcc with the -g switch set, which instructs the compiler to place debugging information in the executable. Although any program can produce a core file, the core file can only tell a programmer the location in the program where the fault occurred and the values of certain variables if this debugging information is available.

The second tool that is required is the debugger. If you have installed the development kit, chances are you already have this. The standard Linux debugger is gdb (the GNU Debugger) and is part of the gcc development kit. A programmer might then use this command to look at a core file:

gdb programname core

Core files are typically useful only to programmers, and a debugger is not a very friendly program (gdb is certainly no exception). If you have no programming experience, you will probably not increase your knowledge of what went wrong by examining a core file in this way. —Chad Robinson, BRT Technical Services Corporation chadr@brttech.com

Can't Receive Mail

I have loaded Linux and have all the settings for a full Internet connection. I can telnet to and from my computer and can send mail out. I have not been able to configure the system to receive mail. Any suggestions? —Jay Melton

Adding Sendmail to Startup Scripts

Most likely you just don't have sendmail running as a daemon. You can start up sendmail as a daemon with a command like:

sendmail -bd -q15m

If that doesn't cause any odd errors, you'll want to add that command to your startup scripts. Check to make sure /etc/rc.d/init.d/sendmail.init exists. If it does, use the run level editor to make it start in run levels 2, 3 and 5 and stop in run levels 0, 1 and 6. —Steven Pritchard, President Southern Illinois Linux Users Group steve@silug.org

Mirroring Sites

With what package and how can you mirror your favorite software site? —Andreas J. Bathe

Perl Script Mirror

There is a Perl script appropriately called mirror that works great for mirroring ftp sites. It is available from ftp://sunsite.doc.ic.ac.uk/packages/mirror/ and comes with excellent documentation. —Steven Pritchard, President Southern Illinois Linux Users Group steve@silug.org