[Samba] CTDB: Failed to connect client socket to daemon.
steve
steve at steve-ss.com
Sat Aug 16 07:52:04 MDT 2014
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
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 = ALTEA
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)
# CTDB_SERVICE_SMB=${CTDB_SERVICE_SMB:-smbd}
# CTDB_SERVICE_NMB=${CTDB_SERVICE_NMB:-""}
CTDB_SERVICE_SMB=smbd
;;
*)
# Use redhat style as default:
# CTDB_SERVICE_SMB=${CTDB_SERVICE_SMB:-smb}
# CTDB_SERVICE_NMB=${CTDB_SERVICE_NMB:-""}
CTDB_SERVICE_SMB=smbd
;;
esac
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
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"
}
service_stop ()
{
service "$CTDB_SERVICE_SMB" stop
if [ -n "$CTDB_SERVICE_NMB" ] ; then
service "$CTDB_SERVICE_NMB" stop
fi
}
######################################################################
# Show the testparm output using a cached smb.conf to avoid delays due
# to registry access.
smbconf_cache="$service_state_dir/smb.conf.cache"
testparm_foreground_update ()
{
_timeout="$1"
if ! _out=$(timeout $_timeout testparm -v -s 2>/dev/null) ; then
if [ -f "$smbconf_cache" ] ; then
echo "WARNING: smb.conf cache update failed - using old cache file"
return 1
else
die "ERROR: smb.conf cache create failed"
fi
fi
_tmpfile="${smbconf_cache}.$$"
# Patterns to exclude...
pat='^[[:space:]]+(registry[[:space:]]+shares|include|copy|
winbind[[:space:]]+separator)[[:space:]]+='
echo "$_out" | grep -Ev "$pat" >"$_tmpfile"
mv "$_tmpfile" "$smbconf_cache" # atomic
return 0
}
testparm_background_update ()
{
_timeout="$1"
testparm_foreground_update $_timeout >/dev/null 2>&1 </dev/null &
}
testparm_cat ()
{
testparm -s "$smbconf_cache" "$@" 2>/dev/null
}
list_samba_shares ()
{
testparm_cat |
sed -n -e 's@^[[:space:]]*path[[:space:]]*=[[:space:]]@@p' |
sed -e 's/"//g'
}
list_samba_ports ()
{
testparm_cat --parameter-name="smb ports" |
sed -e 's@,@ @g'
}
###########################
ctdb_start_stop_service
is_ctdb_managed_service || exit 0
###########################
case "$1" in
startup)
ctdb_service_start
;;
shutdown)
ctdb_service_stop
;;
monitor)
testparm_foreground_update 10
ret=$?
smb_ports="$CTDB_SAMBA_CHECK_PORTS"
if [ -z "$smb_ports" ] ; then
smb_ports=$(list_samba_ports)
[ -n "$smb_ports" ] || die "Failed to set smb ports"
fi
ctdb_check_tcp_ports $smb_ports || exit $?
if [ "$CTDB_SAMBA_SKIP_SHARE_CHECK" != "yes" ] ; then
list_samba_shares | ctdb_check_directories || exit $?
fi
if [ $ret -ne 0 ] ; then
testparm_background_update 10
fi
;;
*)
ctdb_standard_event_handler "$@"
;;
esac
exit 0
***************
/etc/init.d/smbd
#!/bin/sh
### BEGIN INIT INFO
# Provides: smbd
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start: slapd cups
# Should-Stop: slapd cups
# Short-Description: start Samba SMB/CIFS daemon (smbd)
### END INIT INFO
PIDDIR=/usr/local/samba/var/run
SMBDPID=$PIDDIR/smbd.pid
# clear conflicting settings from the environment
unset TMPDIR
# See if the daemons are there
test -x /usr/local/samba/sbin/smbd || exit 0
. /lib/lsb/init-functions
case $1 in
start)
if init_is_upstart; then
exit 1
fi
SERVER_ROLE=`samba-tool testparm --parameter-name="server role"
2>/dev/null | tail -1`
if [ "$SERVER_ROLE" = "active directory domain controller" ]; then
exit 0
fi
log_daemon_msg "Starting SMB/CIFS daemon" smbd
# Make sure we have our PIDDIR, even if it's on a tmpfs
install -o root -g root -m 755 -d $PIDDIR
if ! start-stop-daemon --start --quiet --oknodo
--exec /usr/local/samba/sbin/smbd -- -D; then
log_end_msg 1
exit 1
fi
log_end_msg 0
;;
stop)
if init_is_upstart; then
exit 0
fi
log_daemon_msg "Stopping SMB/CIFS daemon" smbd
start-stop-daemon --stop --quiet --pidfile $SMBDPID
# Wait a little and remove stale PID file
sleep 1
if [ -f $SMBDPID ] && ! ps h `cat $SMBDPID` > /dev/null
then
# Stale PID file, remove it (should be removed by
# smbd itself IMHO).
rm -f $SMBDPID
fi
log_end_msg 0
;;
reload)
log_daemon_msg "Reloading /etc/samba/smb.conf" smbd
start-stop-daemon --stop --quiet --signal HUP --pidfile $SMBDPID
log_end_msg 0
;;
restart|force-reload)
if init_is_upstart; then
exit 1
fi
$0 stop
sleep 1
$0 start
;;
status)
status_of_proc -p $SMBDPID smbd smbd
exit $?
;;
*)
echo "Usage: /etc/init.d/smbd {start|stop|reload|restart|force-reload|
status}"
exit 1
;;
esac
exit 0
More information about the samba
mailing list