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/ line 67.
 at /usr/share/perl5/ 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


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.

  • 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.

  • Hey thanks πŸ˜‰ – very happy I could help. And you be well too Mr. Phillips.

  • Alberto Corni

    this seems works to me
    perl -pi -e “s/import Socket6;/Socket6->import(qw(inet_pton getaddrinfo));/g”

  • You’re a brave man Alberto… πŸ˜‰

  • Pasteldenata

    Thanks for sharing… avoided times of great annoyance πŸ˜‰

  • 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!

  • Sure thing! πŸ™‚ Glad it helped.

  • CΓ©sar GarcΓ­a

    Great that worked for me !!!

  • Excellent! Much more peaceful now, eh? πŸ˜‰

  • ugmoe2000

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

  • Ha! Fun! πŸ™‚ Happy it helped! πŸ™‚

  • Dull

    I hate wheezy with i210 NIC.

    Thank you very very much.

    It help me.

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

  • bjd

    thanks ..

  • no prob bjd

  • msdsy

    Thanks !

  • Sure thing msdsy! Thanks for thanking πŸ™‚