Converting a Red Hat Linux 5.8 install to CentOS

Recently, we wanted to convert from Red Hat Enterprise Linux to CentOS. CentOS is a build of Red Hat Enterprise Linux from all of the open source packages that are released by Red Hat. There are a number of instructions in this regard, but the overall process is the same. My conversion was a Red Hat Enterprise Linux 5.8 to CentOS 5.8.

I started by following these instructions from saylinux.net (or thuannvn.blogspot.com). However, I had to adjust the instructions for RHEL 5.8 – just look in the directory on mirror.centos.org for the proper version of the packages you need. You won’t be able to use yum to download the packages because you want to pull not from RHEL but from CentOS – and yum will be getting updated as well.

Firstly, do a cleanup:

yum clean all

Then, create a working space where RPMs can be downloaded:

mkdir ~/centos
cd ~/centos

Now download the relevant CentOS key and import it:

wget http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
rpm --import RPM-GPG-KEY-CentOS-5

Then, get relevant packages from CentOS – note these instructions will pull i386 packages or x86_64 packages depending on your system:

wget http://mirror.centos.org/centos/5/os/`uname -m`/CentOS/centos-release-5-8.el5.centos.i386.rpm
wget http://mirror.centos.org/centos/5/os/`uname -m`/CentOS/centos-release-notes-5.8-0.i386.rpm
wget http://mirror.centos.org/centos/5/os/`uname -m`/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm
wget http://mirror.centos.org/centos/5/os/`uname -m`/CentOS/yum-updatesd-0.9-2.el5.noarch.rpm
wget http://mirror.centos.org/centos/5/os/`uname -m`/CentOS/yum-fastestmirror-1.1.16-21.el5.noarch.rpm

You don’t have to use wget either; you could – if you want – instead use a text browser like elinks to get the same packages. Using elinks allows you to get the most recent version without stumbling over the version number – if the package is updated, you don’t have to guess at the version numbers in the filename.

elinks http://mirror.centos.org/centos/5/os/`uname -m`/CentOS/

Delete unnecessary packages from RHEL – in particular, those that use the Red Hat Network (RHN):

rpm -e yum-rhn-plugin rhn-client-tools rhn-setup rhn-check rhnsd

If there are any other packages that require yum-rhn-plugin or related packages, add it to the list of packages to remove.

Now update all of the packages that were downloaded:

rpm -Uvh --force *.rpm

Lastly, perform an upgrade to fully update the system from the new CentOS repositories:

yum upgrade

For best practices, you probably should reboot here as well – thus loading new libraries, deleting old files, and activating new kernels.

Moving a VMware ESXi 4.0 Guest From One Host to Another

To move an ESXi 4.0 guest is not all that hard – but you must be aware of several things along the way. Taken one step at a time, it won’t be difficult. In this discussion, we assume that you are moving from one ESXi 4.0 host to another – both with the same architecture. (Anything other than that gets much more complicated.)

First, make sure there are no snapshots. Snapshots are not compatible with this process and must be eliminated altogether.

Then, shut down the guest system. We don’t want the guest changing as it is copied across.

The next step is to copy the guest files from the original host to the destination host. This is the longest step considering you probably have gigabytes of data to transfer. This is also done from the ESXi command line.

I would normally use rsync but it doesn’t exist on an ESXi 4.0 system; use scp to copy the files. Your files for the guest should be located in /vmfs/volumes/datastoreX/guest/ where datastoreX is the data store containing the guest and guest is the name of the guest host. If you renamed the host in one of the GUIs such as VSphere Client, then this will reflect the original name.

Make a directory in the remote host (using the ESXi command line interface) in one of the data stores, and then use commands like these from the original host:

cd /vmfs/volumes/datastoreX/guest
scp * remotehost:/vmfs/volumes/datastoreY/guest/

This will copy the files to the remote host.

However, copying is not enough. Log into the remote host and go to the place you copied the files to. Check over the file ending in .vmx for any references to disks that must be changed. Convert remote host paths to local disk paths – you will probably need to know the long hexadecimal path for any paths, so list that before you start editing. If you execute a cd command to the directory containing the guest host, the long path will be in the prompt.

Next you must register the host so the system knows about it. Use this command at the command line to do this:

vim-cmd solo/registervm /vmfs/volumes/datastoreY/guest/guest.vmx

Now, to get the host started: start the host from VSphere Client. The client will give you a question to answer about where the guest came from. Click on the guest’s Summary tab and select I copied it. (which should be the default) and click Ok.

The guest will start up – and discover that the MAC address of its network interface has changed. For Linux, this means a new ethernet interface, and the configuration of the old interface is ignored: that means that there will be no network connectivity. Enter the console and change the old configuration from eth0 to eth1 (or whatever is appropriate; find out with ifconfig -a). This change varies by which Linux distribution you use; for Ubuntu, the configuration is in /etc/network/interfaces.

While you don’t have to reboot, it doesn’t hurt to do so after this change – and it tests the system in a clean reboot. The system should start up cleanly.

Now don’t forget to remove the original. Using the VSphere Client, right-click on the host and select Delete from Disk. This will remove the guest host entirely from the system and delete all of its files. If you want to retain the files, instead select Remove from Inventory which essentially unregisters the host, so that the system is not managing it – but the disk files remain.

Window Manager and xcompmgr

In my current Window Maker configuration, I use xcompmgr to create some nice shadows for the windows. The problem is that xcompmgr sometimes doesn’t realize that a window has closed, and thus the shading remains while the window is actually no longer there. It is possible to “fix” this problem by reopening the window and closing it, but this is ot workable: the only workable work-around is to restart xcompmgr; since xcompmgr is small and fast, this is not a problem.

There are a number of ways to automate this…

Currently, xcompmgr is started in ~/GNUstep/Library/WindowMaker/autostart:

xcompmgr -c -C -r 8 -l -12 -t -12 &

To make it easy to restart xcompmgr, let’s put a program around it that automatically starts the program again if it dies. Since xcompmgr does not go into the background, we can just start it up and when it exits, restart (in a loop).

With Ruby, we can do this:

#!/usr/bin/ruby
#
# xcompmgr2: run xcompmgr and keep it running:
#            permits autorestart of xcompmgr

# Get rid of any programs already running...
`pkill -x xcompmgr`

while (1==1) do

    # Main program: run it!
    `/usr/bin/xcompmgr -c -C -r 8 -l -12 -t -12`

    # Catch and log unusual exitstatus...
    if ($?.exitstatus != 15 && $?.exitstatus != 0) then
        # Not good
    end
end

If xcompmgr exits for any reason, it loops again in the infinite loop. This sort of program could be done in almost any language: certainly Perl, ksh, and PHP are up to the task (as are many others).

Thus, when xcompmgr gets confused, do this command to fix it:

pkill -x xcompmgr

The -x option makes it so that xcompmgr is killed, and not xcompmgr2: -x matches a command name exactly.

Choosing Your Linux Distribution

For enterprise servers, the choices are (basically) easy: Red Hat Enterprise Linux, SUSE Linux Enterprise, or Ubuntu Server – all very good environments with good support from their companies and supported by various hardware manufacturers. What about your desktop?

The choice is usually easy: most of us choose one of the common distributions – like Fedora, OpenSUSE, Ubuntu, Debian, or Linux Mint. What if you want to stretch a little – try something more avant-garde?

You must define your boundaries – what do you want to have or to accomplish? Here are some possibilities:

  • Do you want to build the software from source?
  • Do you want extensive packages already built?
  • Do you want to start from a minimal system and build up?
  • Do you want run on old or minimal hardware?
  • Do you want stable releases or a rolling release?
  • Do you want a full-featured desktop?
  • Do you want to run Linux?
  • Do you want to run Flash, MP3, DVDs, etc.?
  • Do you want to configure everything yourself?
  • Do you want to build everything yourself?
  • Do you want a special purpose distribution (e.g., penetration testing, multimedia, scientific, etc.)?

I find myself in the situation of trying to fix some hardware which requires installation of a new system – thus, I thought I would try something new. My criteria are:

  • Support for lots of packages
  • Everything mostly works on install
  • Window manager other than GNOME or KDE
  • Good security
  • Good support for Java, DVD, MP3, and Flash
  • Not mainstream
  • Actively supported and with active community

So far, the choices seem to be:

Almost all of these are based on Debian unstable or testing; Sabayon is based on Gentoo, and LFS is based on nothing at all…

I’ve always wanted to try a Linux that had the equivalent of FreeBSD’s ports tree…

A First Attempt with Arch Linux

Having heard great things about Arch Linux, I thought I would give it a try. I’ve enjoyed trying different Linux versions over the years, and have found some good environments.

Unfortunately, Arch Linux is not one of them – at least judging according to my initial installation.

The initial install gives you a text-based environment – no GUI here. This can be almost forgivable – but the installation had some hiccups. If you decide to install Arch Linux, don’t select anything other than the core resource: adding extras will only cause things to break. Stick with your CDROM installation media and forget the rest.

Then, after installation, there are a number of tasks to do. As long as you stick with the Beginner’s Guide, all should work just fine. The problems begin when you get into the extras. Most of these problems have solutions; however, one should not come across one problem after another.

Here are the problems I’ve experienced in just a few hours time after initial installation:

  • xdm spawning too many times; pausing for 5 minutes – this because xdm wasn’t installed but /etc/inittab was trying to start it.
  • package conflict with /etc/mtab
  • package conflict with /etc/profile.d/locale.sh
  • configuration of Window Maker overwrites ~/.xinitrc
  • configuring PAM to use ecryptfs didn’t work
  • encrypting home directory appears to have encrypted ~/Private and not ~
  • ecryptfs documentation is obsolete
  • running XDM loops back to login screen after successful login
  • running GDM fails
  • sudo wasn’t part of the main install
  • a new user wasn’t part of the main install
  • the documentation for adding a new user puts the user in the wheel group if you do it manually – but not if you do it with useradd
  • during installation, old install messages are not removed
  • perl is not part of the base install
  • X installs with a network listener active

The two biggest problems are the following:

  1. Bugs are just documented, not fixed.
  2. Nothing is configured!

When a package is installed, it should be ready to go – it should “just work.” Nothing “just works” on Arch. It is one thing to let us choose which packages we want and how we want; however, there should not be a day’s worth (or more!) of work to get things working. Every package seemed to have bugs and things that didn’t work right – and needed special instructions to configure it.

To do anything with Arch, it requires a huge effort to install a large number of packages – and to hand-configure most. It is a minimalist distribution that is built up to be what someone wants. However, I thought their choice of simplicity quotes was ironic:

Perfection is achieved not when there is nothing more to add, but rather when there is nothing more to take away.

I say ironic because there is nothing that can be taken away from Arch Linux; packages must be added.

This is a big disappointment; I had such high hopes for Arch Linux. I thought it would be an simpler version of Gentoo or Slackware; not so.

    OpenLDAP with SSL in Ubuntu Lucid Lynx

    In researching configuration tasks for OpenLDAP, I found this article about using sudo with OpenLDAP. As I am going to implement SSL with OpenLDAP, problems with sudo and SSL could be fatal, so I decided to investigate further.

    It turns out that the problem is embedded in GnuTLS, a GPL-licensed OpenSSL replacement. GnuTLS was used by Debian because of a licensing conflict between OpenSSL and OpenLDAP. A backend library used by GnuTLS (libgcrypt11) causes problems based on the way it is initialized and the way it handles the dropping of privilege (that is, it gets rid of its “root” access). This shows up as suid applications failing when run against LDAP users; Ubuntu bugs 926350 (GnuTLS) and 423252 (sudo) are this exact problem.

    GnuTLS is replacing libgcrypt11 with the nettle backend as of 2.11.x, but Ubuntu Lucid Lynx continues to use GnuTLS with the original (flawed) backend. The “fix” espoused by some is to use nscd – but this is acknowledged to be a workaround.

    There is a GnuTLS version compiled not against libgcrypt11 but libnettle which should the problem. I did not test this PPA; if you wish to stick with OpenLDAP and GnuTLS this might be the way to go.

    However, there is also a version of OpenLDAP compiled against OpenSSL. Add the PPA to your APT configuration and then perform a system update (apt-get update && apt-get upgrade). This will upgrade your OpenLDAP and cause it to stop at least temporarily; thus, make sure you allow for some server downtime.

    This version of OpenLDAP works except for a few initial problems that must be overcome. When you first install, it may refuse to run.

    First, it seems to add an openldap user and group – and while this is good, it does not completely change appropriate files to give access to the openldap user. There are two locations that need to be fixed:

    • /var/lib/ldap (the location of the LDAP data store)
    • /etc/ssl (the location of the SSL certificates)

    Fixing the first is simple:

    chown -R openldap:openldap /var/lib/ldap

    The second is not as straight-forward; in my case, I added the user openldap to the group ssl-cert which has access into the /etc/ssl directory and subdirectories. Use the vigr command to make this happen: add openldap to the end of the ssl-cert group line (your group id might be different):

    ssl-cert:x:108:openldap

    Note that if the SSL certificates aren’t set up right, then running the new OpenLDAP will not work – even if LDAPS is not enabled at startup. (There is a fantastic message showing how to make sure your certificates match from OpenVPN.net.) You also need to make sure that the certificates are not expired; it is reported that OpenLDAP will also fail to start with expired certificates.

    As the final step, change the /etc/default/slapd file to start LDAPS:

    SLAPD_SERVICES="ldap:/// ldapi:/// ldaps:///"

    Eventually, the best thing to do is to remove LDAP support entirely (and use LDAPS completely):

    SLAPD_SERVICES="ldapi:/// ldaps:///"

    Tips and Tidbits About LDAP

    Setting up and understanding LDAP is not easy. In my opinion, nothing is obfuscated more and unnecessarily so than LDAP. There are a number of tips that can help you to understand LDAP.

    LDAP is not authentication. This was the number one problem I had when I started (a while back). The first time user might search for documents on setting up LDAP when in fact they are looking for documents on how to set up UNIX and Linux authentication using LDAP. An LDAP server at its most basic doesn’t understand UNIX uids, doesn’t understand GECOS fields, doesn’t understand UNIX gids, and doesn’t understand Linux shadow files. Support for all of this must be added.

    Support for UNIX authentication must be added. You would think that the most common usage for LDAP would come bundled and ready to go with the server; however, often this is not the case. Even if it is the case, you may find that for certain capabilities you are expected to add new LDIF files to support the fields in LDAP.

    LDAP is not just another database server. Virtually everything in LDAP has a different name; it is unlike anything you’ve done before. Take heart: X.500 (where LDAP comes from) was worse. You’ll have to slog through a pile of new terms, but after a while it will become easier to understand.

    OpenLDAP is not synonymous with LDAP. There are other servers out there. OpenLDAP does come with virtually every Linux platform; there are however, many others – many of which may be easier to use. There is the 389 Directory Server from Red Hat, the ApacheDS (part of the Apache Directory Project) from Apache, and OpenDJ from ForgeRock. OpenDJ itself is a spin-off from OpenDS, originally from Sun.

    OpenLDAP is known for making non-backwards-compatible changes. The most recent example is the complete replacement of the configuration system.

    OpenLDAP no longer uses slapd.conf. This will cause you no end of problems: there are a lot of people trying to explain how to set up OpenLDAP, and with a single strike (as of version 2.3) OpenLDAP made all of that documentation obsolete and useless. This is incomprehensible, but it is a fact.

    Using and administering LDAP requires command line expertise. This is basically true, but like many things, it is not the complete truth. There are many programs designed to make it easy to browse LDAP stores, along with editing capabilities. Some of the more interesting products include Jxplorer, Luma, and the Apache Directory Studio. Of these, the Apache Directory Studio is the most capable, robust, and actively developed – and by far the largest.

    Some LDAP entries can be present more than once or have more than one value. If you are comparing LDAP to a database, then this will come as a surprise. One valuable example is UNIX groups: the original UNIX systems only had one group per user; later, secondary groups were added – thus presenting a single user with multiple groups. This is handled in LDAP in a variety of ways, but they all amount to having multiple entries with different values.

    Limiting user logins by host is not available in LDAP. This capability is most likely to be done by using the client host. There are a number of ways to do it, but all require LDAP client configuration, and all are limited in their application. Without client configuration, all LDAP users will have authenticated access to the host.

    Be prepared to do a lot of web searches for documentation and solutions. The best places to go for searches are: Google (of course) and Ubuntu Documentation.

    There are also very good articles and documents on using LDAP for authentication. There is an article about OpenLDAP authentication on FreeBSD (FreeBSD articles tend to be very well-written). Similarly, Ubuntu documentation is well-written as well; each of the Ubuntu versions has a section in the documentation on using and configuring OpenLDAP for authentication. Ubuntu 11.04 documentation has a good article on OpenLDAP for example.

    Ubuntu documentation also includes a lot of well-written (and current) articles. For example, there are articles on OpenLDAP Server (a general article), LDAP Client Authentication, Samba and LDAP (from the 10.04 Server documentation), and Securing OpenLDAP Conenctions. If you plan to use 389 Server instead, there are even a couple of articles on using it with Ubuntu: Fedora Directory Server (the original name of 389 Server) and Fedora Directory Server Client Howto.

    A nice overview of LDAP comes from Brian Jones at O’Reilly: specifically, his 2006 articles on Demystifying LDAP and Demystifying LDAP Data. Linux Journal also has myriad different articles on LDAP (not to mention an OpenLDAP theme for the December 2002 issue). Linux Journal also has an article from 2007 on Fedora Directory Server (now 389 Server).

    Lastly, an excellent resource is the “book” LDAP for Rocket Scientists from Zytrax.com. You simply must go and read portions of this book. One very apt quote from the introduction to the book which sums up the state of LDAP documentation generally:

    The bad news is that [in our humble opinion] never has so much been written so incomprehensibly about a single topic with the possible exceptions of BIND and … and …

    (It should be noted that the other book at Zytrax is about DNS. Is it any surprise?)

    UPDATE:

    Yet another trick to LDAP:

    The cn= attribute is not solely a leaf attribute. This can be seen in OpenLDAP’s cn=config tree with OpenLDAP configuration. For example, a typical admin user can be designated like so:

    cn=admin,dc=bigcorp,dc=com

    However, when you use OpenLDAP’s configuration, the designation for the admin user is this:

    cn=admin,cn=config

    When you look into the configuration tree, there are more cn= entries – like this:

    cn={4}misc,cn=schema,cn=config

    Using the Message of the Day (MOTD) in Ubuntu Linux

    The message of the day file (/etc/motd) used to be so simple… but with great power often comes increased complexity. The Ubuntu motd file is very powerful and can be manipulated easily once you know how.

    The actual file is composed in /var/run/motd so that the /etc file system can still be considered read only and the file /etc/motd is a symbolic link to /var/run/motd. To make the motd file a static file as before, just change the link to another file such as /etc/motd.static.

    In older versions of Ubuntu, the file /etc/motd.tail was introduced for this purpose; however, it has been deprecated for some time in favor of the newer /etc/update-motd.d framework. The /etc/motd.tail file can still be used and is adapted into the new framework.

    The update-motd framework was introduced with the update-motd package in Ubuntu Intrepid; it now resides in the libpam-modules package as part of the pam_motd module.

    In earlier versions of update-motd, the /etc/update-motd.d directory contained multiple directories that would be executed hourly, daily, weekly, or monthly. The scripts would be executed by a daemon update-motd that was run from cron.

    In Ubuntu Lucid, this structure was phased out in favor of a straight sequential operation. The motd file is now generated by the pam_motd module upon login.

    Each of the files in the /etc/update-motd.d is executed in numerical order; those in a Ubuntu Lucid Server install are:

    /etc/update-motd.d# ls -l
    total 28
    -rwxr-xr-x 1 root root  57 2010-04-23 04:45 00-header
    -rwxr-xr-x 1 root root 248 2010-04-23 04:45 10-help-text
    -rwxr-xr-x 1 root root  65 2010-04-13 15:45 20-cpu-checker
    lrwxrwxrwx 1 root root  46 2010-12-02 12:26 50-landscape-sysinfo -> /usr/share/landscape/landscape-sysinfo.wrapper
    -rwxr-xr-x 1 root root  71 2010-04-13 15:45 90-updates-available
    -rwxr-xr-x 1 root root  61 2010-06-30 09:01 91-release-upgrade
    -rwxr-xr-x 1 root root  69 2010-04-13 15:45 98-reboot-required
    -rwxr-xr-x 1 root root 261 2010-04-23 04:45 99-footer
    

    These files generate a motd like this:

    Linux myserver 2.6.32-32-server #62-Ubuntu SMP Wed Apr 20 22:07:43 UTC 2011 x86_64 GNU/Linux
    Ubuntu 10.04.2 LTS
    
    Welcome to the Ubuntu Server!
     * Documentation:  http://www.ubuntu.com/server/doc
    
      System information as of Tue Nov 22 11:01:48 CST 2011
    
      System load:  1.84                Processes:           167
      Usage of /:   80.6% of 115.84GB   Users logged in:     0
      Memory usage: 50%                 IP address for lo:   127.0.0.1
      Swap usage:   10%                 IP address for eth0: 10.6.7.1
    
      Graph this data and manage this system at https://landscape.canonical.com/
    
    21 packages can be updated.
    0 updates are security updates.
    
    *** System restart required ***
    Last login: Fri Nov 18 09:46:33 2011 from 192.168.15.1
    

    SSH introduces some slight complexity: SSH has its own handling of the motd file and can produce it upon demand. In a Ubuntu Lucid install, this capability is turned off because the PAM framework shows the motd through the pam_motd module on login.

    Despite the documentation for motd.tail stating otherwise, there is no /etc/init.d/bootmisc.sh that runs and creates /var/run/motd; this is done upon login as previously mentioned.

    If logging in with SSH, the SSH display of motd may be turned off either by adding a file ~/.hushlogin or by reconfiguring the server with a PrintMotd No option. Note that this is separate from the pam_motd process; thus if a Ubuntu system has PrintMotd Yes as well as pam_motd you will see double messages. Likewise, if a ~/.hushlogin file is present – or the option PrintMotd No is set – the pam_motd module will still run and a message of the day will still be seen.

    In the PAM configuration of a standard Ubuntu Lucid install, both /etc/pam.d/login and /etc/pam.d/ssh contain the pammotd module. The /etc/motd file is selectable here; a different file entirely could be used by modifying the pammotd line appropriately:

    session optional pam_motd.so motd=/etc/motd.other

    To modify the motd within the update-motd framework, just create (or delete) scripts in the /etc/update-motd.d directory. Each script must be in the format NN-xxxxxxx where the first two numbers NN specify the order and the last xxxxxxx specifies a reasonable name for the script. The script should be an actual file and not a link, according to the documentation (although the 50-landscape-sysinfo script is a symbolic link!).

    Output should be to stdout and start with a blank line and end with a newline. Remember that the script will execute on every login, so it should be quick.

    Configuring the Bash Shell (and Korn Shell) to Permanently Use vi-mode Editing

    The GNU bash shell, as one might expect, uses Emacs key bindings to perform history and editing in the shell. Vi key bindings are available, and can be set with this standard command (just like in ksh):

    set -o vi

    My fingers have gotten this sequence of letters ingrained in them so I don’t even have to think about it – and I type it almost automatically after login.

    However, there is a way to set up ksh to automatically set editing to vi mode. If the VISUAL variable is set to a value like vi, then the editing mode will be set to vi mode automatically. Likewise, if the VISUAL variable is set to emacs, then emacs mode is used for editing.

    If the VISUAL variable is not set, then the EDITOR variable is used.

    In later versions of the AT&T Korn shell (such as 20100202) the recognized values have been expanded: the pattern *[Vv][Ii]* is recognized as a request for vi mode; the pattern *gmacs* results in gmacs mode; and the pattern *macs* results in emacs mode. (The only difference between emacs and gmacs mode is the handling of the ^T character.)

    This means that using vim or gvim will now trigger vi mode – indeed, using almost any vi clone editor such as nvi or elvis will work with this method. This also means that the full path can be used, although this may have been true previously.

    In bash however, this use of EDITOR and VISUAL is not available. However, since bash uses GNU readline, we can set up readline to use vi mode by default – and thus also affect all programs that use GNU readline besides.

    Edit (or create) a file in your home directory called .inputrc and add this line to it:

    set editing-mode vi

    After this, any time you log in – or use anything else that uses GNU readline (such as CLISP for example) – you’ll automatically have vi mode editing. I can finally rest my fingers…

    Turning off NET-SNMP overlogging

    In the normal configuration – both on Red Hat and Ubuntu – you’ll find that SNMP is filling your logs with an endless amount of log entries, especially if you have monitoring tools that use SNMP every five minutes. They’ll generate messages like this:

    Jan  8 13:45:02 example snmpd[2048]: Connection from UDP: [10.0.0.1]:51890
    Jan  8 13:45:02 example snmpd[2048]: Received SNMP packet(s) from UDP: [10.0.0.1]:51890
    Jan  8 13:45:02 example last message repeated 2 times
    

    To get rid of these, change the priority levels that are logged by NET-SNMP. This can be done by changing the options sent to SNMP.

    Look for a file /etc/default/snmpd or /etc/sysconfig/snmpd or similar. There should be a set of SNMP options – probably with an option like this one:

    -Ls d
    

    Change this option to be:

    -LS5d
    

    This will log everything at level NOTICE or higher (that is, severity level 5 down to severity 0). The severity levels used are those used by syslog; they are described in syslog(3).

    This works because the messages being seen are logged at level INFO; by not logging items at that severity level the log entries no longer clutter the syslog files.

    However, there is another set of messages that are common to NET-SNMP logs:

    Sep  7 09:47:29 burp snmpd[19242]: diskio.c: don't know how to handle 9 request
    Sep  7 09:47:29 burp snmpd[19242]: diskio.c: don't know how to handle 10 request
    Sep  7 09:47:29 burp snmpd[19242]: diskio.c: don't know how to handle 11 request
    

    This is the result of a bug (Red Hat Bugzilla #474093 - login required) which causes these “errors” when the SNMP diskIOTable is traversed. Red Hat fixed this bug back in September of 2009.

    According to this message by Chris Rizzo, Red Hat stated:

    The message that you see here is a result of querying for statistics
    that are not available on the linux system. Requests 9, 10, and 11 are
    defined as:
    
    #define DISKIO_LA1 9
    #define DISKIO_LA5 10
    #define DISKIO_LA15 11
    

    You can see where these statistics pop up by querying the SNMP diskIOTable using this command:

    snmptable -v 2c -c public host diskIOTable
    

    The output will look like this:

    SNMP table: UCD-DISKIO-MIB::diskIOTable
    
     diskIOIndex diskIODevice diskIONRead diskIONWritten diskIOReads diskIOWrites diskIOLA1 diskIOLA5 diskIOLA15 diskIONReadX diskIONWrittenX
               1         ram0           0              0           0            0         ?         ?          ?            0               0
               2         ram1           0              0           0            0         ?         ?          ?            0               0
               3         ram2           0              0           0            0         ?         ?          ?            0               0
               4         ram3           0              0           0            0         ?         ?          ?            0               0
               5         ram4           0              0           0            0         ?         ?          ?            0               0
               6         ram5           0              0           0            0         ?         ?          ?            0               0
               7         ram6           0              0           0            0         ?         ?          ?            0               0
               8         ram7           0              0           0            0         ?         ?          ?            0               0
               9         ram8           0              0           0            0         ?         ?          ?            0               0
              10         ram9           0              0           0            0         ?         ?          ?            0               0
              11        ram10           0              0           0            0         ?         ?          ?            0               0
              12        ram11           0              0           0            0         ?         ?          ?            0               0
              13        ram12           0              0           0            0         ?         ?          ?            0               0
              14        ram13           0              0           0            0         ?         ?          ?            0               0
              15        ram14           0              0           0            0         ?         ?          ?            0               0
              16        ram15           0              0           0            0         ?         ?          ?            0               0
              17        loop0           0              0           0            0         ?         ?          ?            0               0
              18        loop1           0              0           0            0         ?         ?          ?            0               0
              19        loop2           0              0           0            0         ?         ?          ?            0               0
              20        loop3           0              0           0            0         ?         ?          ?            0               0
              21        loop4           0              0           0            0         ?         ?          ?            0               0
              22        loop5           0              0           0            0         ?         ?          ?            0               0
              23        loop6           0              0           0            0         ?         ?          ?            0               0
              24        loop7           0              0           0            0         ?         ?          ?            0               0
              25          sr0           0              0           0            0         ?         ?          ?            0               0
              26          sda  2840214016     1178369536     8946299      2080062         ?         ?          ? 990682692096     18358238720
              27         sda1      598016         208896          82            8         ?         ?          ?       598016          208896
              28         sda2        2048              0           2            0         ?         ?          ?         2048               0
              29         sda3     2286592        4649984         449          332         ?         ?          ?      2286592         4649984
              30         sda5  2836463104     1173473792     8945636      2079527         ?         ?          ? 990678941184     18353342976
              31          sdb  2960873984     1173473792     1940422      2079476         ?         ?          ? 990803352064     18353342976
              32         sdb1      638976              0          83            0         ?         ?          ?       638976               0
              33         sdb2      798720              0         153            0         ?         ?          ?       798720               0
              34         sdb3        6144              0           2            0         ?         ?          ?         6144               0
              35         sdb5  2958672384     1173473792     1940080      2079284         ?         ?          ? 990801150464     18353342976
              36          md0  3051716608     1727252992       93765      1641387         ?         ?          ?   3051716608     14612154880
              37          sdc  3067452416      425118208     1640751      3638614         ?         ?          ? 101851700224    438511782400
              38         sdc1  3067317248      425118208     1640721      3638613         ?         ?          ? 101851565056    438511782400
              39          sdd      307712              0          76            0         ?         ?          ?       307712               0
              40         sdd1      147968              0          37            0         ?         ?          ?       147968               0
              41         sdd2      131072              0          32            0         ?         ?          ?       131072               0
    

    Towards the right side of center, you can see the metrics diskIOLA1, diskIOLA5, diskIOLA15; these are unsupported on Linux (as marked by the ? in each column). These are the 1 minute average disk load (as a percentage), the 5 minute average disk load, and the 15 minute average disk load respectively.

    The three have SNMP OIDs of .1.3.6.1.4.1.2021.13.15.1.1.9 and .1.3.6.1.4.1.2021.13.15.1.1.10 and .1.3.6.1.4.1.2021.13.15.1.1.11 respectively – thus, the logged complaint of not knowing how to handle request 9 (or 10 or 11).

    Without changing the code, there doesn’t seem to be any way to eradicate this message if you are querying the diskIOTable. Red Hat fixed the bug, perhaps others will? The bug remains on Ubuntu Lucid Lynx, unfortunately.

    Follow

    Get every new post delivered to your Inbox.

    Join 36 other followers