unbound v1.6.0 python module on debian 9

George Thessalonikefs george at nlnetlabs.nl
Tue Oct 23 16:13:23 UTC 2018

Hi Christopher,

On 23/10/2018 17:24, Christopher Hearn via Unbound-users wrote:
> I’m trying to set up a server running unbound and a python script.  This is working OK on an older server running version 1.4.2.  On the newer one, I can’t seem to get unbound to see the python script dependencies.  I do recall on the old server, this was because chroot was enabled.  Once I disabled it in the config file via chroot: “”, it was fine.  It’s disabled on the new one too, but still doesn’t seem to help.  If I symlink the requested file from /usr/lib/python2.7/dist-packages/unboundpython.py to /etc/unbound/, that resolves that error, but more come up because of course it can’t see the other libraries.  This leads me to believe that unbound isn’t looking out of /etc/unbound/ even though chroot is disabled.  Is there something else I’m missing?

I am assuming that you want to use a python script with unbound's python

I see that when initializing the python module, unbound appends to the
sys path also the directory reported by Python as the
"platform-dependent include directory" [1].

You can find that directory by starting up the Python interpreter (the
same that unbound will also use; in case of Python virtual environments)
and typing:
	>> import distutils.sysconfig
	>> distutils.sysconfig.get_python_lib(1,0)
	'/usr/local/lib/python2.7/site-packages' (in my case)

As a side note you can also achieve the same with chroot enabled but
then you would need to link the same python directory structure inside
the chroot in order for unbound to find the libraries.


-- George

More information about the Unbound-users mailing list