Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 565136 - net-analyzer/net-snmp - snmpwalk reads /etc/filesystems (like it's AIX) if at configure time /etc/mtab is not a file
Summary: net-analyzer/net-snmp - snmpwalk reads /etc/filesystems (like it's AIX) if at...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-08 11:37 UTC by Michael Schwartzkopff
Modified: 2015-11-12 15:37 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Schwartzkopff 2015-11-08 11:37:48 UTC
We installed several gentoo with  net-analyzer/net-snmp 5.7.3_pre5-r1

in the config we have:

includeAllDisks
/var 100000
/ 5%

When we do a snmpwalk host dskTable the answer is nonsense and all values are zero ("0") [2]. It seems the problem was found already in 2008 [1]. We verified that this problem still exists. Removing the /etc/filesystem file when emerging resolved the problem.

Please could you fix it in the ebuild. Thanks.

[1] https://forums.gentoo.org/viewtopic-t-674396-start-0.html
[2] http://sourceforge.net/p/net-snmp/mailman/net-snmp-users/?viewmonth=201511&viewday=8
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2015-11-12 07:28:16 UTC
This would only happen if at src_configure time no file (or symlink) /etc/mtab exists. So why would that be?
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2015-11-12 07:28:51 UTC
Please post your `emerge --info net-analyzer/net-snmp' output in a comment.
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2015-11-12 07:29:12 UTC
Attach a build log, too, please.
Comment 4 Marc Schiffbauer gentoo-dev 2015-11-12 09:32:41 UTC
(In reply to Jeroen Roovers from comment #1)
> This would only happen if at src_configure time no file (or symlink)
> /etc/mtab exists. So why would that be?

It not uncommon, that /etc/mtab ist just empty if using a build chroot.

We use a build chroot on a hardened system and then having this issue. In the chroot, /etc/mtab is just zero Bytes in size. We might propably "ln -s /proc/mounts /etc/mtab" to circumvent this issue. Nevertheless this seems like a bug to me. At least, net-snmp should output a big fat warning it it detects that /etc/mtab ist not being used for whatever reason and might break the installation.

This is emerge --info:

Portage 2.2.20.1 (python 3.4.3-final-0, hardened/linux/amd64, gcc-4.8.5, glibc-2.21-r1, 3.14.25-hardened-r1 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.14.25-hardened-r1-x86_64-Intel_Xeon_E312xx_-Sandy_Bridge-with-gentoo-2.2
KiB Mem:     8172724 total,   1629660 free
KiB Swap:    1048572 total,   1037184 free
Timestamp of repository gentoo: Thu, 12 Nov 2015 01:15:01 +0000
sh bash 4.3_p39
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p39::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.10::gentoo, 3.4.3::gentoo
dev-util/cmake:           3.3.1-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.17::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.69::gentoo
sys-devel/automake:       1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.8.5::gentoo, 4.9.3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)
sys-libs/glibc:           2.21-r1::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://XXXXXXXXXXXXX.de/gentoo-portage
    priority: -1000

XXXXXXX
    location: /var/lib/layman/XXXXXXXXXX
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/share/gnupg/qualified.txt /var/bind /var/spool/munin-async/.ssh"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask-keep-masks=y --autounmask-write=n --binpkg-respect-use=y --binpkg-changed-deps=y --keep-going --rebuilt-binaries --usepkg-exclude='dev-perl/*' --usepkg-exclude='perl-core/*' --usepkg=y --with-bdeps=y "
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles getbinpkg merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="sftp://binpkg@XXXXXX.de/ http://de-mirror.org/distro/gentoo/ http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ http://ftp.uni-erlangen.de/pub/mirrors/gentoo "
LANG="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
USE="acl amd64 bash-completion berkdb bzip2 caps cli cracklib crypt cxx device-mapper dri gdbm hardened iconv idn ipv6 justify mmx mmxext modules multilib ncurses nls nptl openmp openssl pam pax_kernel pcre pie readline seccomp session sse sse2 ssl ssp tcpd udev unicode urandom vim-syntax xattr xtpax zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_core authn_dbm authn_file authz_core authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif socache_shmcb speling status unique_id unixd%* userdir usertrack vhost_alias proxy proxy_balancer proxy_connect proxy_fcgi proxy_http ratelimit slotmem_shm unixd lbmethod_byrequests lbmethod_bytraffic lbmethod_bybusyness lbmethod_heartbeat" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

net-analyzer/net-snmp-5.7.3_pre5-r1::gentoo was built with the following:
USE="bzip2 ipv6 perl ssl tcpd zlib -X -doc -elf -lm_sensors -mfd-rewrites -minimal -mysql -netlink -pci -python -rpm (-selinux) -ucd-compat" ABI_X86="64" PYTHON_TARGETS="python2_7"
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2015-11-12 15:03:24 UTC
(In reply to Marc Schiffbauer from comment #4)
> (In reply to Jeroen Roovers from comment #1)
> > This would only happen if at src_configure time no file (or symlink)
> > /etc/mtab exists. So why would that be?
> 
> It not uncommon, that /etc/mtab ist just empty if using a build chroot.
> 
> We use a build chroot on a hardened system and then having this issue. In
> the chroot, /etc/mtab is just zero Bytes in size. We might propably "ln -s
> /proc/mounts /etc/mtab" to circumvent this issue.

/etc/mtab should be fine as a file of whatever size. Aren't you looking at a dangling symlink to an unmounted /proc here?
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2015-11-12 15:25:20 UTC
Ah, neither baselayout nor openrc appear to install /etc/mtab these days. openrc has an init.d script that handles that.

So if /etc/mtab is missing in some cases we may need to force the variable.
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2015-11-12 15:28:03 UTC
diff --git a/net-analyzer/net-snmp/net-snmp-5.7.3-r2.ebuild b/net-analyzer/net-snmp/net-snmp-5.7.3-r2.ebuild
index 3bdf6ed..03afcc5 100644
--- a/net-analyzer/net-snmp/net-snmp-5.7.3-r2.ebuild
+++ b/net-analyzer/net-snmp/net-snmp-5.7.3-r2.ebuild
@@ -90,6 +90,8 @@ src_configure() {
        local mibs="host ucd-snmp/dlmod ucd-snmp/diskio ucd-snmp/extensible mibII/mta_sendmail smux etherlike-mib/dot3StatsTable"
        use lm_sensors && mibs="${mibs} ucd-snmp/lmsensorsMib"

+       use kernel_linux && export ac_cv_ETC_MNTTAB=/etc/mtab
+
        econf \
                $(use_enable !ssl internal-md5) \
                $(use_enable ipv6) \


Would that work?
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2015-11-12 15:33:52 UTC
checking for mount table location... (cached) /etc/mtab

It does.
Comment 9 Jeroen Roovers (RETIRED) gentoo-dev 2015-11-12 15:37:04 UTC
Fixed in -r3.