Fix for MRTG Generating SNMP_Session Error in Debian Wheezy (and possibly Ubuntu)

This article is published at Linux Tools of the Trade.

Lately, after an upgrade from Debian Squeeze to Debian Wheezy, MRTG is sending emails every few minutes when it runs from the crontab. This is quickly filling up my Inbox. There error message is as follows:

Subroutine SNMP_Session::pack_sockaddr_in6 redefined at /usr/share/perl/5.14/Exporter.pm line 67.
 at /usr/share/perl5/SNMP_Session.pm line 149

After waiting for a while to see if a fix came from Debian, I decided to look around on my own. It seems there is a patch that works, but it has not been propagated out to the repositories. Luckily, this error problem is easy to fix.

You can apply the patch at the link above, or you can just edit a file and make 2 quick changes: Edit the file

/usr/share/perl5/SNMP_Session.pm

Change line #149:

old: import Socket6;
new: Socket6->import(qw(inet_pton getaddrinfo));

Then change line #609:

old: import Socket6;
new: Socket6->import(qw(inet_pton getaddrinfo));

That seems to fix the problem quite well. Hopefully the Debian maintainer will get that change in sooner that later so others don’t have to bother!

Note: Someone commented that the line numbers listed were a bit off from version to version of Debian. Not entirely unexpected. It’s the change to calling the class directly that counts.

  • Vastmeridian

    Thanks for this – why the other people referring to this bug couldn’t have done the same as you I don’t know. I found this trying to get Devmon working with Xymon on Ubuntu 12.04LTS.

  • http://orbum.net/mark Mark Rushing

    Not really sure why. Other than it seems some people like being official or something, maybe.

  • S. Phillips

    You rock, bud. Well done.

    Incidentally, in my particular version on Wheezy (2.17.4-2 for amd64), the line numbers were off by 1 from what you had. No big deal though; your fix was extremely helpful. Be well.

  • http://orbum.net/mark Mark Rushing

    Hey thanks ;) – very happy I could help. And you be well too Mr. Phillips.

  • Alberto Corni

    Thanks!
    this seems works to me
    perl -pi -e “s/import Socket6;/Socket6->import(qw(inet_pton getaddrinfo));/g”
    /usr/share/perl5/SNMP_Session.pm

  • http://orbum.net/mark Mark Rushing

    You’re a brave man Alberto… ;)

  • Pasteldenata

    Thanks for sharing… avoided times of great annoyance ;)

  • http://orbum.net/mark Mark Rushing

    Happy I could help – always nice to find the answer if someone else already dug through all the stuff. :-)

  • Pingback: ????mrtg????????PHP?Error?? | 13GroupStudy-QPC

  • ThankU

    Thanks!! It works!

  • http://orbum.net/mark Mark Rushing

    Sure thing! :) Glad it helped.

  • César García

    Great that worked for me !!!

  • http://orbum.net/mark Mark Rushing

    Excellent! Much more peaceful now, eh? ;)

  • ugmoe2000

    THANK YOU! Now successfully graphing with MRTG on my Raspberry Pi thanks to your fix!

  • http://orbum.net/mark Mark Rushing

    Ha! Fun! :) Happy it helped! :)

  • Dull

    I hate wheezy with i210 NIC.

    Thank you very very much.

    It help me.

  • http://orbum.net/mark Mark Rushing

    I’m happy it helped – thanks for thanking me Dull!

  • bjd

    thanks ..

  • http://orbum.net/mark Mark Rushing

    no prob bjd