Tuesday, February 8, 2011

Kludge for running Samba in StormOS/Nexenta hybrid system

A very long time ago, I upgraded a bunch of packages on my Nexenta NCP 3.0.1 fileserver to their StormOS "Hail" counterparts; however, I encountered a problem with the samba package:

Setting up samba (2:3.3.2-2stormos3.2) ...
Starting Samba daemons...:ld.so.1: smbd: fatal: relocation error: file /usr/lib/libcups.so.2: symbol __gss_c_nt_hostbased_service_oid_desc: referenced symbol not found
/etc/init.d/samba: line 33: 17304 Killed                  start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/smbd -- -D
Well, this was no fun. It looked like smbd was not getting a symbol it needed. I shelved the upgrade and forced dpkg to put a "hold" on the old version of samba, until I finally had an idea today.

I "grepped" through the /usr/lib directory in search of the provider of the missing symbol:
find /usr/lib -type f -exec grep __gss_c_nt_hostbased_service_oid_desc '{}' \;
... and I discovered that it was provided by /usr/lib/libgssapi.so.2.
baitisj@raid:/usr/lib$ objdump -T libgssapi.so.2.0.0  | grep hostbased       
0002ba80 g    DO .data  00000008  HEIMDAL_GSS_2.0 __gss_c_nt_hostbased_service_oid_desc
0002ba78 g    DO .data  00000008  HEIMDAL_GSS_2.0 __gss_c_nt_hostbased_service_x_oid_desc
Therefore, I added the following LD_PRELOAD kludge into /etc/init.d/samba:
...
PIDDIR=/var/run/samba
NMBDPID=$PIDDIR/nmbd.pid
SMBDPID=$PIDDIR/smbd.pid
# Baitisj: kludge for missing symbol
LD_PRELOAD=/usr/lib/libgssapi.so.2
export LD_PRELOAD
...
Voila! My nifty ZFS fileserver now runs Samba 3.3.2.

No comments: