collectd python plugin not working

Bug #1872281 reported by Jan Killius on 2020-04-12
108
This bug affects 20 people
Affects Status Importance Assigned to Milestone
collectd (Ubuntu)
Undecided
Unassigned

Bug Description

ERROR: dlopen("/usr/lib/collectd/python.so") failed: /usr/lib/collectd/python.so: undefined symbol: PyFloat_Type. The most common cause for this problem is missing dependencies. Use ldd(1) to check the dependencies of the plugin / shared object.

 ldd /usr/lib/collectd/python.so
        linux-vdso.so.1 (0xbea86000)
        libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0xb6f75000)
        libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6e77000)
        /lib/ld-linux-armhf.so.3 (0xb6fcc000)

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: collectd 5.9.2.g-1ubuntu4
ProcVersionSignature: Ubuntu 5.4.0-1007.7-raspi 5.4.27
Uname: Linux 5.4.0-1007-raspi armv7l
ApportVersion: 2.20.11-0ubuntu26
Architecture: armhf
CasperMD5CheckResult: skip
Date: Sun Apr 12 11:35:51 2020
SourcePackage: collectd
UpgradeStatus: Upgraded to focal on 2020-04-07 (4 days ago)
mtime.conffile..etc.collectd.collectd.conf: 2020-04-08T08:16:11.615515

Jan Killius (tmpnerd) wrote :
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in collectd (Ubuntu):
status: New → Confirmed

I don't know if it will help, but I've been able to compile collectd with the Python plugin.

If I'm not wrong, collectd uses a custom interpreter (a kind of wrapper over the cpython interpreter) to avoid to initialize a new interpreter each time we need to execute Python scripts.
That interpreter seems to be compiled into a shared library that is placed in /usr/lib/collectd/python.so after install the package from the Ubuntu repos.

If we execute ldd over the shared library installed with apt from the official repository, we can see that it is not linked with libpython.so, the real interpreter, so it is not able to run it.

I've been able to compile the version 5.11.0 of collectd enabling Python support installing `python-dev-is-python3` before to compile it.

That package installs a shell script that is able to detect which version of Python is installed (and other details like libs and paths). That script is used by the configure script of collectd to determine if Python is supported or not.

I've been tried to compile the same version that is present in the repository (5.9.2) with no luck, probably I'm missing some header, however I've been able to use the python.so compiled for 5.11.0 with Python support with collectd 5.9.2.
The only changes to the Python plugin between these two versions are just a few format changes (indentation changes) and the replacement of snprintf by snnprintf in some functions (the older one uses snprintf and the newer one snnprintf).

As you can see my knowledge on this topic is limited but I hope this can be useful to you.

Jan Killius (tmpnerd) wrote :

Thanks for the Information. This was my solution too for now.

Jimmy Merrild Krag (beruic) wrote :

Just to clarify:
I'm not the only one experiencing this on another architecture than the armhf, right?

Pawel Kalemba (pkalemba) wrote :

No You are not, i have this problem too. Do you have some plans to fix it in Focal?

Mike Battersby (mib-8) wrote :

I have this problem as well.

You can work around it by adding the following line to /etc/default/collectd

LD_PRELOAD=/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/libpython3.8.so

this will force it to load the python shared library.

Nick (nickmack) wrote :

Hi Mike, thanks for the suggestion, that work around didn't resolve my issue.

Giles Thomas (gpjt) wrote :

@Mike Battersby (mib-8) -- thanks, that fixed it for me.

Wolf Dieter Schaedel (wodix) wrote :

@Mike Battersby (mib-8) -- thanks, perfect, that fixed it.

Simon Banks (oxymandias) wrote :

I downloaded the 20.10 collectd-core_5.11.0-7_amd64.deb to my 20.04 system installed using dpkg -i and that resolves the issue.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.