Bug 25747 - snmpd: /dev/kmem: No such file or directory
Summary: snmpd: /dev/kmem: No such file or directory
Status: RESOLVED OLD
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 7
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: David GEIGER
QA Contact:
URL:
Whiteboard: NEEDINFO
Keywords:
Depends on: 27034
Blocks:
  Show dependency treegraph
 
Reported: 2019-11-26 11:12 CET by Zamir Ostroukhov
Modified: 2021-09-07 14:09 CEST (History)
4 users (show)

See Also:
Source RPM: net-snmp-utils-5.8-2.mga7
CVE:
Status comment:


Attachments

Description Zamir Ostroukhov 2019-11-26 11:12:26 CET
Description of problem:

The service snmpd can not startup, because kmem is disable in kernel, but not disables in snmpd service.

Version-Release number of selected component (if applicable):

5.8-2

How reproducible:

every time

Steps to Reproduce:
1. urpmi net-snmp-utils-5.8-2
2. systemctl start snmpd
3. systemctl status snmpd

# cat /boot/config-5.3.11-server-1.mga7 |fgrep DEVKMEM
# CONFIG_DEVKMEM is not set

# systemctl status snmpd | grep kmem
nov 26 13:02:54 Z1 snmpd[10199]: /dev/kmem: No such file or directory
Comment 1 David GEIGER 2019-11-26 13:08:33 CET
Please test with upcoming net-snmp-5.8-2.1.mga7 in Core/Updates_testing repo!

CC: (none) => geiger.david68210

Comment 2 Zamir Ostroukhov 2019-11-26 15:08:34 CET
Hi David,

I test net-snmp-5.8-2.1.mga7.
The issue is not resolved.

# whereis snmpd
snmpd: /usr/sbin/snmpd /usr/share/man/man8/snmpd.8.xz

# rpm -qf /usr/sbin/snmpd
net-snmp-5.8-2.1.mga7

# strace /usr/sbin/snmpd
...
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
write(3, "/dev/kmem: No such file or direc"..., 37) = 37
openat(AT_FDCWD, "/dev/mem", O_RDONLY)  = 4
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
pipe([5, 6])                            = 0
futex(0x7ffbbd13b398, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x7ffbbd13b38c, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x7ffbbd13b1d0, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x7ffbbd13b480, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x7ffbbd13b374, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x7ffbbd13b36c, FUTEX_WAKE_PRIVATE, 2147483647) = 0
futex(0x7ffbbd13b244, FUTEX_WAKE_PRIVATE, 2147483647) = 0
gettimeofday({tv_sec=1574777130, tv_usec=780547}, NULL) = 0
write(3, "Agent initialization failed\n", 28) = 28
futex(0x7ffbbd13b96c, FUTEX_WAKE_PRIVATE, 2147483647) = 0
exit_group(1)                           = ?
+++ exited with 1 +++
Comment 3 David GEIGER 2019-11-26 15:31:23 CET
Tested here and now snmpd service works fine!

Have you update all your net-snmp installed packages?


net-snmp-5.8-2.1.mga7
lib(64)net-snmp35-5.8-2.1.mga7
lib(64)net-snmp-devel-5.8-2.1.mga7
net-snmp-utils-5.8-2.1.mga7
net-snmp-tkmib-5.8-2.1.mga7
net-snmp-mibs-5.8-2.1.mga7
net-snmp-trapd-5.8-2.1.mga7
perl-NetSNMP-5.8-2.1.mga7
python-netsnmp-5.8-2.1.mga7
Comment 4 Zamir Ostroukhov 2019-11-26 17:17:51 CET
Hi David


# rpm -qa |grep -i snmp

+ net-snmp-utils-5.8-2.1.mga7
+ net-snmp-5.8-2.1.mga7
* php-snmp-7.3.11-1.mga7
* perl-NetSNMP-5.8-2.mga7
* freeswitch-event-snmp-1.6.20-6.mga7
- net-snmp-mibs-5.8-2.mga7
* perl-Net-SNMP-6.0.1-9.mga7
* nagios-check_snmp-2.2.1-4.mga7
+ lib64net-snmp-devel-5.8-2.1.mga7
+ lib64net-snmp35-5.8-2.1.mga7

+ updated
- not updated (not requered IHMO)
* other rpm

I want double check.
Please, provide me follow outputs:

ls -l /dev/kmem
md5sum /usr/sbin/snmpd
md5sum /usr/lib64/libnetsnmp.so.35.0.0
md5sum /usr/lib64/libsnmp.so.35.0.0

/dev/kmem - file is not exists
4f779a53188cd640fdee3f3880648c5e  /usr/sbin/snmpd
338d0158064debe954b378b40f60e3f9  /usr/lib64/libnetsnmp.so.35.0.0
19816429a5ffd050ea52d98a3d408311  /usr/lib64/libsnmp.so.35.0.0
Comment 5 Zamir Ostroukhov 2019-11-26 20:43:42 CET
Hi David,

Option "-r" resolve issue.

# snmpd -Mmibs -f -Lo
/dev/kmem: No such file or directory
Agent initialization failed

# snmpd -Mmibs -f -Lo -r
2019-11-26 22:40:20 MIB search path: mibs
...
2019-11-26 22:40:20 Turning on AgentX master support.
2019-11-26 22:40:22 NET-SNMP version 5.8
^C2019-11-26 22:40:25 Received TERM or STOP signal...  shutting down...

-r      Do not require root access to run the daemon.  Specifically, do not exit if files only accessible to root (such as /dev/kmem etc.) cannot be opened.

Thank you!
Comment 6 Lewis Smith 2019-11-26 21:52:25 CET
Thank you both for dealing with this so rapidly.

I am unsure whether the need for the -r option (with the updated packages) in itself resolves the initial bug description. If so, this can be pushed to QA after a suitable advisory - which could mention the fact. It will be too easy to see the same bug reported again even after the update...

In the meantime, excuse me once more for assigning this to you David, as you already have done it.

Assignee: bugsquad => geiger.david68210

Comment 7 David GEIGER 2019-11-27 07:58:00 CET
Hmmm! something is strange between our BS and a mga7 user system:

On BS we can see that it search /dev/kmem and found it:

checking for /dev/kmem... /dev/kmem

And on my mga7 system it doesn't found it:

checking for /dev/kmem...



@tmb Have you an idea on why this difference?
Comment 8 Zamir Ostroukhov 2019-11-28 07:43:44 CET
I suppose difference in kernel options.

# uname -a
Linux Z1 5.3.11-server-1.mga7 #1 SMP Tue Nov 12 21:38:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

# cat /boot/config-5.3.11-server-1.mga7 |fgrep DEVKMEM
# CONFIG_DEVKMEM is not set
Comment 9 David GEIGER 2019-11-28 07:47:15 CET
# uname -a
Linux david.david 5.3.11-desktop-1.mga7 #1 SMP Tue Nov 12 21:10:01 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

# cat /boot/config-5.3.11-desktop-1.mga7 |fgrep DEVKMEM
# CONFIG_DEVKMEM is not set
Comment 10 Zamir Ostroukhov 2019-11-28 07:53:14 CET
"On BS we can see that it search /dev/kmem and found it:
checking for /dev/kmem... /dev/kmem"

Is BS building system?
I say that need check kernel option on building system.
Comment 11 David GEIGER 2019-11-28 07:54:45 CET
Yes it is our Build System.
Comment 12 Zamir Ostroukhov 2019-11-28 07:57:27 CET
Thanks.
Who check kernel option of Build System?
Comment 13 Thomas Backlund 2019-11-28 11:20:37 CET
the buildsystem runs on standard Mageia 7 server kernels, but since this is iurt chroots, I guess we meed to update makedev to not create kmem anymore

CC: (none) => tmb

Comment 14 David GEIGER 2019-12-05 15:31:35 CET
(In reply to Thomas Backlund from comment #13)
> the buildsystem runs on standard Mageia 7 server kernels, but since this is
> iurt chroots, I guess we meed to update makedev to not create kmem anymore

Are you on it Thomas? I don't know how to fix it in makedev.
Comment 15 Zamir Ostroukhov 2019-12-11 19:03:07 CET
FYI, WA:
https://sourceforge.net/p/net-snmp/mailman/message/16165557/
You can set the no root access flag, and the agent will run fine without root access. Or, reconfigure the agent, and specify '--with-cflags=-DNO_KMEM_USAGE'.
Comment 16 David GEIGER 2019-12-12 07:43:41 CET
So please test net-snmp-5.8-2.2.mga7.
Comment 17 Zamir Ostroukhov 2019-12-12 13:17:38 CET
negative.

[zamir@Z1 ~]$ ls -l *.rpm
-rw-rw-r-- 1 zamir zamir 1008332 дек 12 10:19 lib64net-snmp35-5.8-2.2.mga7.x86_64.rpm
-rw-rw-r-- 1 zamir zamir 1175408 дек 12 10:19 lib64net-snmp-devel-5.8-2.2.mga7.x86_64.rpm
-rw-rw-r-- 1 zamir zamir  188720 дек 12 10:19 net-snmp-5.8-2.2.mga7.x86_64.rpm
-rw-rw-r-- 1 zamir zamir  270872 дек 12 10:19 net-snmp-mibs-5.8-2.2.mga7.x86_64.rpm
-rw-rw-r-- 1 zamir zamir  357172 дек 12 10:19 net-snmp-utils-5.8-2.2.mga7.x86_64.rpm
-rw-rw-r-- 1 zamir zamir  155396 дек 12 10:19 perl-NetSNMP-5.8-2.2.mga7.x86_64.rpm
[zamir@Z1 ~]$ sudo rpm -vU ./*.rpm
Verifying packages...
Подготовка пакетов...
lib64net-snmp35-5.8-2.2.mga7.x86_64
net-snmp-mibs-5.8-2.2.mga7.x86_64
perl-NetSNMP-5.8-2.2.mga7.x86_64
net-snmp-utils-5.8-2.2.mga7.x86_64
net-snmp-5.8-2.2.mga7.x86_64
lib64net-snmp-devel-5.8-2.2.mga7.x86_64
lib64net-snmp-devel-5.8-2.1.mga7.x86_64
net-snmp-5.8-2.1.mga7.x86_64
net-snmp-utils-5.8-2.1.mga7.x86_64
perl-NetSNMP-5.8-2.mga7.x86_64
net-snmp-mibs-5.8-2.mga7.x86_64
lib64net-snmp35-5.8-2.1.mga7.x86_64
[zamir@Z1 ~]$ sudo su
[root@Z1 zamir]# snmpd -Mmibs -f -Lo
/dev/kmem: No such file or directory
Agent initialization failed
[root@Z1 zamir]# snmpd -Mmibs -f -Lo -r
2019-12-12 15:14:17 MIB search path: mibs
2019-12-12 15:14:17 Cannot find module (SNMPv2-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (IF-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (IP-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (TCP-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (UDP-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (DISMAN-SCHEDULE-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (EtherLike-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (HOST-RESOURCES-TYPES): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (MTA-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (NETWORK-SERVICES-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (RMON-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (SCTP-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (UCD-DISKIO-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (LM-SENSORS-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (UCD-SNMP-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (UCD-DEMO-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (IPV6-ICMP-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (IPV6-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (IPV6-TCP-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (IPV6-UDP-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (IP-FORWARD-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (NET-SNMP-PASS-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (NET-SNMP-EXTEND-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (SNMPv2-TM): At line 0 in (none)
2019-12-12 15:14:17 Cannot find module (NET-SNMP-VACM-MIB): At line 0 in (none)
2019-12-12 15:14:17 Turning on AgentX master support.
2019-12-12 15:14:17 Error opening specified endpoint ""
2019-12-12 15:14:17 Server Exiting with code 1
[root@Z1 zamir]#
Comment 18 David GEIGER 2019-12-12 14:38:23 CET
I have added what upstream proposed: '--with-cflags=-DNO_KMEM_USAGE'

So why this doesn't work?
Comment 20 Zamir Ostroukhov 2019-12-12 18:56:51 CET
Yes, thanks, I checked srpm. Everything seems to be right. I don’t know why it didn’t work  :(
Comment 21 Simon Rowe 2020-03-27 21:10:20 CET
I added --without-kmem-usage to the configure line and rebuilt the SRPM, snmpd now runs for me.

CC: (none) => srowe

David Walser 2020-09-07 19:40:18 CEST

Depends on: (none) => 27034

Comment 22 Aurelien Oudelet 2020-10-01 18:22:08 CEST
@Zamir and @Simon,

Does this really work with proposed configure option in Comment 21?

CC: (none) => ouaurelien
Whiteboard: (none) => NEEDINFO

Comment 23 Simon Rowe 2020-10-01 18:31:45 CEST
I've got the following to patch configure

@@ -234,6 +234,7 @@
 %else
     --without-rpm \
 %endif
+    --without-kmem-usage \
     --disable-static \
     --enable-shared \
     --with-cflags="%{optflags} -D_RPM_4_4_COMPAT -fPIE" \

I've also got the following for reasons I don't remember

@@ -461,6 +462,7 @@
 %{_mandir}/man1/snmpwalk.1*
 %{_mandir}/man1/traptoemail.1*
 %{_mandir}/man5/mib2c.conf.5*
+%exclude %{_bindir}/snmppcap
 
 %files mibs
 %doc mibs/README.mibs

Package has been used by cacti for over six months now.
Comment 24 Zamir Ostroukhov 2020-10-02 07:02:17 CEST
I have not tested other solutions and I trust Simon.
I think the option "--without-kmem-usage" completely removes support kmem.
Currently I use option "-r" from comment5. This option disable using kmem.

# systemctl status snmpd 
● snmpd.service - Simple Network Management Protocol (SNMP) Daemon.
   Loaded: loaded (/usr/lib/systemd/system/snmpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2020-08-28 13:20:04 MSK; 1 months 4 days ago
 Main PID: 8661 (snmpd)
    Tasks: 1 (limit: 4915)
   Memory: 12.3M
   CGroup: /system.slice/snmpd.service
           └─8661 /usr/sbin/snmpd -r -LS0-4d -f
Comment 25 Aurelien Oudelet 2021-07-06 13:16:30 CEST
Mageia 7 is EOL since July 1st 2021.
There will not have any further bugfix for this release.

You are encouraged to upgrade to Mageia 8 as soon as possible.

@reporter, if this bug still apply with Mageia 8, please let us know it.

@packager, if you work on the Mageia 7 version of your package, please check the Mageia 8 package if issue is also present. In this case, please fix the Mageia 8 version instead.

This bug report will be closed OLD if there is no further notice within 1st September 2021.
Comment 26 Marja Van Waes 2021-09-07 14:09:08 CEST
Hi bug reporter and hi assignee and others involved,

Please reopen this bug report if it is still valid for Mageia 8 or 9(cauldron), and change "Version:" in the upper left of this report accordingly.

This report is being closed as OLD because it was filed against Mageia 7, for which  support ended on June 30th 2021.

Thanks,
Marja

Status: NEW => RESOLVED
Resolution: (none) => OLD


Note You need to log in before you can comment on or make changes to this bug.