[Samba] CTDB: Failed to connect client socket to daemon.

Achim Gottinger achim at ag-web.biz
Sat Aug 16 11:57:56 MDT 2014


Am 16.08.2014 19:39, schrieb steve:
> On Sat, 2014-08-16 at 18:09 +0200, Achim Gottinger wrote:
>> Am 16.08.2014 15:52, schrieb steve:
>>> Ubuntu 14.04, ctdb 2.5.3, samba 4.1.11. CTDB is working with IP takeover
>>> between the 2 nodes. The machine is joined to the domain.
>>>
>>> Any help with the following errors would be most gratefully received.
>>>
>>> 1. connect to socket error:
>>> ctdb status
>>> 2014/08/16 15:32:03.248034 [23255]: client/ctdb_client.c:267 Failed to
>>> connect client socket to daemon. Errno:Connection refused(111)
>>> common/cmdline.c:156 Failed to connect to daemon
>> What's the output of ls -l /usr/local/var/run/ctdb/ ?
>   ls -l /usr/local/var/run/ctdb
> total 0
> srwx------ 1 root root 0 ago 16 19:32 ctdbd.socket
>
> The socket is there and is renewed upon each ctdb (re) start. smb.conf
> refers to the same socket.
Guess that's ok. Maybe the log is more helpfull with CTDB_DEBUGLEVEL=4 
(an recommendation i found on an other therad about ctdb issues).
>
>
>>> 2014/08/16 15:32:03.261221 [23255]: Failed to init ctdb
>>>
>>>    /etc/default/ctdb
>>> CTDB_NODES=/etc/ctdb/nodes
>>> CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses
>>> CTDB_MANAGES_SAMBA=yes
>>> CTDB_SYSLOG=yes
>>> CTDB_DEBUGLEVEL=NOTICE
>>> CTDB_SOCKET=/usr/local/var/run/ctdb/ctdbd.socket
>>>
>>>
>>> /usr/local/samba/etc/smb.conf
>>> [global]
>>> workgroup = ALTEAfrom /etc/defaults/
>>> realm = ALTEA.SITE
>>> security = ADS
>>> kerberos method = secrets and keytab
>>> netbios name = SMBCLUSTER
>>> disable netbios = Yes
>>> clustering = Yes
>>> ctdbd socket = /usr/local/var/run/ctdb/ctdbd.socket
>>> [users]
>>> path = /cluster/users
>>> read only = No
>>>
>>> **************
>>> /etc/ctdb/50.samba
>>>
>>> ps aux|grep ctdbd
>>> root     25902  3.3  3.6  26772 18460 ?        SLs  15:38
>>> 0:08 /usr/sbin/ctdbd --pidfile=/var/run/ctdb/ctdbd.pid
>>> --nlist=/etc/ctdb/nodes --socket=/usr/local/var/run/ctdb/ctdbd.socket
>>> --public-addresses=/etc/ctdb/public_addresses -d NOTICE --syslog
>>> root     25904  0.0  0.0   3012   396 ?        S    15:38
>>> 0:00 /usr/sbin/ctdbd --pidfile=/var/run/ctdb/ctdbd.pid
>>> --nlist=/etc/ctdb/nodes --socket=/usr/local/var/run/ctdb/ctdbd.socket
>>> --public-addresses=/etc/ctdb/public_addresses -d NOTICE --syslog
>>> root     26048  0.6  0.1  13404   792 ?        S    15:38
>>> 0:01 /usr/sbin/ctdbd --pidfile=/var/run/ctdb/ctdbd.pid
>>> --nlist=/etc/ctdb/nodes --socket=/usr/local/var/run/ctdb/ctdbd.socket
>>> --public-addresses=/etc/ctdb/public_addresses -d NOTICE --syslog
>>> **************
>>>
>>> 2. CTDB does not start smbd but is started correctly (with response from
>>> ctdb) upon:
>>> sudo service smbd start
>>>
>>> /etc/ctdb/events.d/50.samba
>>> #!/bin/sh
>>> # ctdb event script for Samba
>>>
>>> [ -n "$CTDB_BASE" ] || \
>>>       export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
>>>
>>> . $CTDB_BASE/functions
>>>
>>> detect_init_style
>>>
>>> case $CTDB_INIT_STYLE in
>>> 	suse)
>>> 		CTDB_SERVICE_SMB=${CTDB_SERVICE_SMB:-smb}
>>> 		CTDB_SERVICE_NMB=${CTDB_SERVICE_NMB:-nmb}
>>> 		;;
>>> 	debian)
> **comments
>>> #		CTDB_SERVICE_SMB=${CTDB_SERVICE_SMB:-smbd}
>>> #		CTDB_SERVICE_NMB=${CTDB_SERVICE_NMB:-""}
> **added
>>> 		CTDB_SERVICE_SMB=smbd
>>> 		;;
>>> 	*)
>>> 		# Use redhat style as default
> **comments
>>> #		CTDB_SERVICE_SMB=${CTDB_SERVICE_SMB:-smb}
>>> #		CTDB_SERVICE_NMB=${CTDB_SERVICE_NMB:-""}
> **added
>>> 		CTDB_SERVICE_SMB=smbd
>>> 		;;
>>> esac
>>>
> ** changed samba to smbd
>>> service_name="smbd"
>>>
>>> loadconfig
>>>
>>> ctdb_setup_service_state_dir
>>>
>>> CTDB_SERVICE_SMB=smbd
>>> service_start ()
>>> {
>>>       # make sure samba is not already started
>>> echo $CTDB_SERVICE_SMB
>>> exit 1
>> Is it intentional to echo "smbd" and exit here?
>> Id verify maybe with an few echo statements that all the CTDB variables
>> from /etc/default/ctdb get passed to that script.
>> Read you copied the samba start script from an wiki can be it assumes
>> variables in /etc/sysconfig/ctdb.
>>
> Hi
> The changes we made were necessary for ubuntu. In ubuntu smbd is called
> smbd, not either samba or smb.
>
> The script is from the standard Ubuntu ctdb and samba install using
> synaptic. Because samba on ubuntu is not built with cluster support, we
> built 4.1.11 from source. The script at /etc/init.d/smbd works fine
> manually using:
> sudo service smbd start
> etc. etc.
>
> Cheers,
> Steve
Hi Steve,

I assume ctdb calls /etc/ctdb/events.d/50.samba if it wants to 
start/stop samba on the nodes. In case of start this will call the 
function service_start().
In your script this function looks like below and it will echo 
$CTDB_SERVICE_SMB (in your case smbd) and exit with exit code 1. It 
never gets to that last line where it calls /etc/init.d/smbd via 
'nice_service "$CTDB_SERVICE_SMB" start'.
On a sidenote you can define CTDB_SERVICE_SMB="smbd" in 
/etc/default/ctdb and leave the script unmodified.

service_start ()
{
     # make sure samba is not already started
echo $CTDB_SERVICE_SMB
exit 1
     service "$CTDB_SERVICE_SMB" stop > /dev/null 2>&1
     if [ -n "$CTDB_SERVICE_NMB" ] ; then
	service "$CTDB_SERVICE_NMB" stop > /dev/null 2>&1
     fi
     killall -0 -q smbd && {
	sleep 1
	# make absolutely sure samba is dead
	killall -q -9 smbd
     }
     killall -0 -q nmbd && {
	sleep 1
	# make absolutely sure samba is dead
	killall -q -9 nmbd
     }

     # start Samba service. Start it reniced, as under very heavy load
     # the number of smbd processes will mean that it leaves few cycles
     # for anything else
     net serverid wipe

     if [ -n "$CTDB_SERVICE_NMB" ] ; then
	nice_service "$CTDB_SERVICE_NMB" start || die "Failed to start nmbd"
     fi

     nice_service "$CTDB_SERVICE_SMB" start || die "Failed to start
samba"
}







More information about the samba mailing list