Snmpd Not Responding on Boot

Hi,

I had this issue in the past, and it seemed to go away (just lucky?), but again running the latest code ... it seems that snmpd is not starting (properly) on boot? I can't connect to it / get it to respond. If I just manually restart the service, then it's all good. Perhaps an issue with sequencing on boot (i.e. should it not be 50?)?

Thanks!

Are you binding to all IPs or a specific one?

1 Like

All - I think :laughing:. Saying that because,

  1. /etc/snmp/snmpd.conf
agentaddress UDP:161,UDP6:161
  1. netstat -ul
udp        0      0 0.0.0.0:snmp            0.0.0.0:*

Thanks!

My snmpd is also at S50 and given that some other servers start at that point there shouldn't be a problem.
Is there anything in the logs after a reboot?
If not you can try to move the starting link to S90 and try again.

1 Like

Yep, was thinking the same thing - that works! Assuming it's some sort of delay / timing issue?

Hmmm ... how to change this in the source code, so after updates (re-flash) it still works (i.e. returns to S90)?

Thanks!

Most likely it's some race condition. Keep it as is for now and hopefully it won't repeat after flashing of a newer version.
Otherwise the easiest way I can think of is to add the file in the sysupgrade list of preserved files.

1 Like

Agreed! We're on the same page :smiley:.

Confirmed - it reappears :frowning_face:.

Is that the way to do it, or rather modify it in the source code, so that it's correct (automatically) in new builds?

Thanks!

If you make your own builds then that would be ideal.

1 Like

I do! Need to find the way to change this in the source code :laughing:

Thanks!

1 Like

BTW, I just found a second router (completely different HW, brand even) that has this same issue. Thinking that S50 may not be quite the right place for snmpd :frowning:.

Thanks!

I am running snmpd in a couple of routers without any issue of this kind.
It needs to be analyzed further before reaching a conclusion. Post here the uci export network and cover any sensitive data.

2 Likes

Sure, below. But why look at network? Just trying to understand! snmpd is starting, it's just "dead". Restart and all is OK. BTW, I checked dmesg, nothing there for snmpd :frowning_face:

package network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix '...'

config interface 'lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ipaddr '192.168.0.1'
        option delegate '0'
        option type 'bridge'
        option ifname 'eth0.1'

config interface 'wan'
        option ifname 'eth0.2'
        option proto 'dhcp'

config device 'wan_dev'
        option name 'eth0.2'
        option macaddr '...'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '2 3 4 5 0t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '1 0t'

config interface 'wg0'
        option proto 'wireguard'
        option private_key '...'
        list addresses '192.168.253.3'

config wireguard_wg0
        option description '...'
        option public_key '...'
        option preshared_key '...'
        option route_allowed_ips '1'
        option endpoint_host '...'
        option endpoint_port '...'
        list allowed_ips '192.168.253.1/32'
        list allowed_ips '0.0.0.0/0'

Thanks!

In case there is something that could lead to the race condition.

ula addresses are private, no need to hide them.

add a mask here

You don't need the first line when you have the second.

2 Likes

Didn't know that :laughing:. Thanks!

Mask meaning CIDR (i.e. /32)?

Agreed! Was just being thorough, and to keep my head straight going through :rofl:

None of these should really cause race conditions though, agreed? Thanks!

Yes.

I'd be surprised if they did.
One more thing to try, unless someone else has a better idea, is to debug the S50-snmpd and find at which point it fails. Maybe that would show more on the reason it doesn't start.
User logger to send the debug messages to syslog.

1 Like

More checking, and I realized I worded this VERY poorly - sorry! The service does start (i.e. it shows as running), it just doesn't reply to queries. After a restart of snmpd ... it's "alive" again => same state (running), but actually replies.

Thoughts?

Thanks!

Run these are boot: ps wwww | grep snmp; netstat -anp | grep snmp; logread -e snmp

2 Likes

Sure! BTW, it definitely seems like some sort of race condition - had to reboot the router twice ... first time it was fine, second time it failed. Here is the output from the command(s) you noted,

root@wap-patio:~# ps wwww | grep snmp; netstat -anp | grep snmp; logread -e snmp
 2506 root      3344 S    /usr/sbin/snmpd -Lf /dev/null -f -r
 9292 root      1156 S    grep snmp
udp        0      0 0.0.0.0:161             0.0.0.0:*                           2506/snmpd

So then, I ran service snmpd restart ... back up and going, the same command check,

root@wap-patio:~# ps wwww | grep snmp; netstat -anp | grep snmp; logread -e snmp
10191 root      3312 S    /usr/sbin/snmpd -Lf /dev/null -f -r
10373 root      1156 S    grep snmp
netstat: showing only processes with your user ID
udp        0      0 0.0.0.0:161             0.0.0.0:*                           10191/snmpd
udp        0      0 :::161                  :::*                                10191/snmpd
unix  2      [ ACC ]     STREAM     LISTENING      40852 10191/snmpd         /var/run/agentx.sock

It definitely is different! Not sure why though :laughing:. Thoughts?

Thanks!

Remove this from lan. It is not a valid option for the static protocol according to the documentation.

1 Like

I didn't add it, came from LuCI I assume. But ... this interface isn't static, so leave it alone?