ubuntu / debian rlm_python issues using mysqldb module

John Dennis jdennis at redhat.com
Wed Jul 8 15:19:56 CEST 2009


On 07/08/2009 04:16 AM, Michael da Silva Pereira wrote:
> Hi All,
>
> I am sure i'm not the only person experiencing this problem. It seems
> when using the python module to handle auth/acct.
> If you include the MySQLdb module in the python script freeradius then
> dies and is unable to load the pythong module.
>
> I am using the latest stable freeradius version 2.1.6, built for ubuntu
> as per http://wiki.freeradius.org/Build using fakeroot.
> The python script being used is the "prepaid.py" script renamed to
> "radiusd_test.py" in the example below.
>
> I am using the standard scripts and config from freeradius, I found a
> similar article regarding this and apparently has something to do with
> statically linking the module ?
>
> Are there any solutions for this ?

> Wed Jul 8 12:10:51 2009 : Error: rlm_python:python_load_function: module
> 'radiusd_test' is not found
> Wed Jul 8 12:10:51 2009 : Error: rlm_python:EXCEPT:<type
> 'exceptions.ImportError'>: /var/lib/python-support/python2.6/_mysql.so:
> undefined symbol: PyExc_ImportError
> Wed Jul 8 12:10:51 2009 : Error: rlm_python:python_load_function: failed
> to import python function 'radiusd_test.instantiate'
> Wed Jul 8 12:10:51 2009 : Error: /etc/freeradius/modules/python[1]:
> Instantiation failed for module "python"
> Wed Jul 8 12:10:51 2009 : Error:
> /etc/freeradius/sites-enabled/iburst-prepaid[30]: Failed to find module
> "python".
> Wed Jul 8 12:10:51 2009 : Error:
> /etc/freeradius/sites-enabled/iburst-prepaid[30]: Failed to parse
> "python" entry.
> Wed Jul 8 12:10:51 2009 : Error: Errors initializing modules

This seems to be wholey a Python problem, not a FreeRADIUS problem 
because you're getting a Python import error, specifically an unresolved 
reference to a symbol in a .so. It's probably easiest to diagnose this 
outside of FreeRADIUS. My first guess would be you've got something 
amiss in your Python setup because the missing symbol PyExc_ImportError 
is a common symbol which should be defined in libpython2.6.so. I'm 
guessing something is linked against the wrong libraries or a library 
path is not pointing in the right place. Here is a series of steps I 
would try:

Fire up python from the command line by typing python, that will put you 
in a python interpreter shell. Then type "import MySQLdb". Does the 
import succeed? Try the same thing with your script.

Check which libraries standard python are using (note, the path name 
will likely be different).

% ldd /usr/bin/python
	linux-gate.so.1 =>  (0x005fc000)
	libpython2.6.so.1.0 => /usr/lib/libpython2.6.so.1.0 (0x0361d000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x003c2000)
	libdl.so.2 => /lib/libdl.so.2 (0x003bb000)
	libutil.so.1 => /lib/libutil.so.1 (0x001d5000)
	libm.so.6 => /lib/libm.so.6 (0x00391000)
	libc.so.6 => /lib/libc.so.6 (0x0021d000)
	/lib/ld-linux.so.2 (0x001f9000)

On my system _mysql.so in in /usr/lib/python2.6/site-packages but on 
yours its in /var/lib/python-support/python2.6/_mysql.so, adjust the 
paths appropriately.

% ldd /usr/lib/python2.6/site-packages/_mysql.so
	linux-gate.so.1 =>  (0x00acd000)
	libmysqlclient_r.so.16 => /usr/lib/mysql/libmysqlclient_r.so.16 
(0x004c8000)
	libz.so.1 => /lib/libz.so.1 (0x00110000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x004ac000)
	libcrypt.so.1 => /lib/libcrypt.so.1 (0x009e6000)
	libnsl.so.1 => /lib/libnsl.so.1 (0x00407000)
	libm.so.6 => /lib/libm.so.6 (0x00b60000)
	libssl.so.8 => /usr/lib/libssl.so.8 (0x00f58000)
	libcrypto.so.8 => /usr/lib/libcrypto.so.8 (0x0021b000)
	libpython2.6.so.1.0 => /usr/lib/libpython2.6.so.1.0 (0x0063c000)
	libc.so.6 => /lib/libc.so.6 (0x007bc000)
	/lib/ld-linux.so.2 (0x001f9000)
	libfreebl3.so => /lib/libfreebl3.so (0x00123000)
	libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x0016b000)
	libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00e13000)
	libcom_err.so.2 => /lib/libcom_err.so.2 (0x00196000)
	libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00199000)
	libresolv.so.2 => /lib/libresolv.so.2 (0x00ed6000)
	libdl.so.2 => /lib/libdl.so.2 (0x001cc000)
	libutil.so.1 => /lib/libutil.so.1 (0x001d1000)
	libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x0043e000)
	libkeyutils.so.1 => /lib/libkeyutils.so.1 (0x00cea000)
	libselinux.so.1 => /lib/libselinux.so.1 (0x001d5000)

This will tell you what the loader will try to resolve when you try to 
do the import. If you see a mismatch in the libraries or their paths 
then there is your culprit.





-- 
John Dennis <jdennis at redhat.com>

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/



More information about the Freeradius-Users mailing list