It turned out that my adventure in backporting net-snmp from CentOS 7 to CentOS 5 has a regression issue with disk stats. The logs provided us with the following error message

2015-05-29T10:27:14+02:00 foobar snmpd[2200]: Cannot statfs

but only on CentOS 5. CentOS 6, build on the same CentOS 7 VM also with mock, worked like a charm.

When I attached strace to the snmpd process I could see that the calls to statfs() were executed with an empty string, so no path was supplied.

A bit of source code grep'ing already pointed in the direction of #define ETC_MNTTAB but at that point I didn't believe that the chroot could be the culprit. So it took some discussions with the colleagues until I did a test build, the old way with a "./configure --prefix=$HOME/snmpd && make && make install", on a real system. To my surprise that worked.

Since I did not fold in all the patches from the CentOS 7 rpm I expected that one of the patches broke something along the way for old Linux releases. So I went on, disabled nearly all patches in the spec file, build again in a chroot and the resulting binary still did not work.

Somehow the chroot was at fault. Looking closer at the configure magic linked above you'll see it iterates through a list of various files that contain the list of mounted disks on various of *nix systems. For some unknown reason my CentOS 5 chroot is not populated with a proper /etc/mtab linked to the systems /proc/self/mounts while the one for CentOS 6 is. With /etc/mtab missing the configure script happily picks up /etc/filesystems which is, you might or might not know this, the /etc/fstab pendant on AIX. But on a CentOS system that just contains a list of filesystems.

That indeed could not work out and explains why the build itself succeeded but parsing a filesystem path out of that file did not. Luckily we can override that stuff easily with the '--with-mnttab="/etc/mtab"' configure option of net-snmp, but the "/etc/filesystems" file on CentOS was something I did not expect and never noticed before.

Hint: for the function of /etc/filesystems take a look at man 8 mount and the section about the "-t" parameter.