Character-encoding on CentOS 7

I have installed LibreNMS on CentOS 7 and followed the documentation exactly and everything looks good except one thing:
If I use Swedish characters (ie åäöÅÄÖ) or é (part of my name) in “location” or “contact” on Unifi-devices those characters are replaced by … in the gui. Somewhere the encoding is broken…

When I ran a test with LibreNMS as a container this was encoded correct.

Tested this and it looks broken in the snmp-tools

# snmpwalk -c public -v2c router SNMPv2-MIB::sysLocation.0
SNMPv2-MIB::sysLocation.0 = STRING: Verkstad, K..llare

Should look like this: "Verkstad, Källare"

Solved this myself.

Found this patch solving the issue upstream:
https://sourceforge.net/p/net-snmp/bugs/2815/

  • Downloaded the source rpm ‘net-snmp-5.7.2-43.el7.src.rpm’ for CentOS 7.
  • Added the patch to the source
  • Rebuild the net-snmp-5.7.2-43.el7 ( with: rpmbuild -ba net-snmp.spec )
  • yum reinstall net-snmp-libs-5.7.2-43.el7.x86_64.rpm

snmpwalk -c public -v2c router SNMPv2-MIB::sysLocation.0
SNMPv2-MIB::sysLocation.0 = STRING: Verkstad, Källare

Detailed instructions:
(This can be done on the librenms-machine or probably better on another CentOS 7 machine)

  1. Download source rpm from: http://vault.centos.org
    wget http://vault.centos.org/7.7.1908/os/Source/SPackages/net-snmp-5.7.2-43.el7.src.rpm

  2. Install source rpm
    rpm -i net-snmp-5.7.2-43.el7.src.rpm

  3. Download patch to this folder
    ~/rpmbuild/SOURCES/0001-CHANGES-BUG-2815-Display-UTF-8-characters-again.patch

  4. Modify ~/rpmbuild/SPECS/net-snmp.spec (two lines, starting with patch…)

Patch82: 0001-CHANGES-BUG-2815-Display-UTF-8-characters-again.patch

%patch82 -p1 -b .0001

  1. Install gcc (ie yum install gcc)

  2. Try to build new .rpm
    cd ~/rpmbuild/SPECS
    rpmbuild -ba net-snmp.spec

  3. Install needed -devel packages if the command above tell you to (and run rpmbuild again)
    example: yum install openssl-devel bzip2-devel elfutils-devel libselinux-devel

  4. Reinstall new rpm
    yum reinstall rpmbuild/RPMS/x86_64/net-snmp-libs-5.7.2-43.el7.x86_64.rpm

  5. Test with the snmpwalk command again

2 Likes