systemd / pystemd

A thin Cython-based wrapper on top of libsystemd, focused on exposing the dbus API via sd-bus in an automated and easy to consume way.
GNU Lesser General Public License v2.1
411 stars 36 forks source link

sd_bus_match_symbol requires systemd >=237 #26

Closed hashbrowncipher closed 3 years ago

hashbrowncipher commented 5 years ago

pystemd version 0.6.0 references sd_bus_match_signal, which only exists in systemd >=237. Users on older OSes (e.g. Ubuntu Xenial) will experience an error importing pystemd, like so:

$ python 
Python 3.7.2 (default, Dec 25 2018, 22:05:20) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pystemd import systemd1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nfsuper/env/lib/python3.7/site-packages/pystemd/__init__.py", line 103, in <module>
    from pystemd import DBus, __version__, machine1, systemd1
  File "/home/nfsuper/env/lib/python3.7/site-packages/pystemd/DBus/__init__.py", line 10, in <module>
    from pystemd.base import SDObject
  File "/home/nfsuper/env/lib/python3.7/site-packages/pystemd/base.py", line 14, in <module>
    from pystemd.dbuslib import DBus, apply_signature
ImportError: /home/nfsuper/env/lib/python3.7/site-packages/pystemd/dbuslib.cpython-37m-x86_64-linux-gnu.so: undefined symbol: sd_bus_match_signal 

Possible solutions include a) document the required systemd version or b) disable the feature when compiled against versions not including the necessary symbols.

aleivag commented 5 years ago

Thanks for reporting, this is known , and for the life of me I could swear that I included that in the readme ... Apparently I did not, I will fix that ..

Sadly by the way that cython works, it make really hard to not include the symbols...

Will update the task with a PR for the readme

Once again, Thanks for reporting!!

shorton3 commented 5 years ago

I have been using pystemd for a bit now with a backported systemd-234 on centos7. I was surprised when I updated packages today found this error. I cannot find any backports of systemd-237 or above. Any suggestions for me?

aleivag commented 5 years ago

oh dude, i'm really sorry we broke you... i would recommend pin to version 0.5, while we come up with a solution that is not terrible horrible... this surface as a import error at runtime, so it may be possible to attach this programatically. i just need to sit and think of something clever.

i'll update the issue, when i have an idea!

davide125 commented 5 years ago

@shorton3, we have a systemd 241 backport for CentOS 7 at https://github.com/facebookincubator/rpm-backports fyi

shorton3 commented 5 years ago

Thanks David, I'll give it a try. We can close this thread. I will either stay with 0.5 or migrate to your newer systemd.

honglei commented 3 years ago

Change to older version or fix this ? version 0.8.0 still has this problem.