Cfengine configuration directory

Segmentation faults

Relevant classes: any

Sometimes you might experience segmentation faults when running cfengine. Sometimes these will be bugs and other times they are problems in compilation due to mismatched libraries. To find out more about a segmentation fault, run the program in a debugger, e.g.

gdb /var/cfengine/bin/cfagent
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
(gdb)
(gdb) run -q -I

...
Segmentation fault

(gdb) back
Note that you give the cfagent command line options inside the gdb shell. When the program crashes, type "back" to get the backtrace of where the program stopped. When you ask for help in solving this problem, you should send this backtrace.

Here are some common cases:

  1. Crash in editing functions

    Crashes during file editing are caused normally by regular expression function calls. This occurs when two different versions of the POSIX library are present. e.g You should never install the GNU regular expression package librx if you have a working library (e.g. on Solaris). So do so is to play with fire. What happens is that the header file from one library is found and matched with the library from the other version. Since the definitions do not match, errors result.
  2. Crash at startup in LastSeen() - Berkeley DB

    Crashes in Berkeley DB calls are often caused by having multiple versions of the Berkeley DB library installed. Older versions had a different API than new versions. If you get the header file from one and the library from another (which is possible since the configure script is not very smart), then this will cause a segmenation fault. This happens, for instance, in Linux distributions where several versions are available. e.g. SuSE Linux, you should install packages
    db 
    db-devel (contains header files needed for compilation)
    
    Not the additional packages db-40, db42 etc. You should rather remove anything except this default version to avoid conficts.
  3. Problems with nsswitch.conf

    If you are seeing something like this in the backtrace:
    Loaded symbols for /lib/ld-linux.so.2
    Reading symbols from /lib/libnss_nisplus.so.2...done.
    Loaded symbols for /lib/libnss_nisplus.so.2
    Reading symbols from /lib/libnss_dns.so.2...done.
    Loaded symbols for /lib/libnss_dns.so.2
    Reading symbols from /lib/libresolv.so.2...done.
    Loaded symbols for /lib/libresolv.so.2
    
    then you are probably seeing a problem with some resolver libraries which occurs when there are calls to services which are not configured. Look in /etc/nswitch.conf. Take out references to services you are not using. e.g. if you are not using NIS, then the file should not contain any entries for "nis".
  4. Faulty C libraries

    Some versions of the C library on versions on Linux (especially Red Hat) have had faults causing segmentation faults. Make sure you are up to date with patches.
Back to documentation