[Samba] CTDB: Failed to connect client socket to daemon.
Achim Gottinger
achim at ag-web.biz
Mon Aug 18 13:44:33 MDT 2014
Am 18.08.2014 16:59, schrieb steve:
> On Mon, 2014-08-18 at 15:39 +0200, Achim Gottinger wrote:
>> Am 18.08.2014 15:19, schrieb steve:
>>> On Mon, 2014-08-18 at 14:38 +0200, steve wrote:
>>>> On Mon, 2014-08-18 at 12:32 +0200, Achim Gottinger wrote:
>>>>> Am 18.08.2014 12:09, schrieb steve:
>>>>>> On Mon, 2014-08-18 at 11:31 +0200, Achim Gottinger wrote:
>>>>>>> Change service_name back to samba it
>>>>>>> Is Usedom by ctdb
>>>>>> OK. Thanks again. Getting closer. Changed smbd to samba:
>>>>>> sudo ctdb eventscript 50.samba startup
>>>>>> 2014/08/18 11:57:16.958275 [ 9029]: Invalid arguments
>>>>> First sorry for the typos, iphone autocorrection got me.
>>>> No problem. Thanks for your time and trouble.
>>>>> I assue you want to give ctdbd control over samba.
>>>>> https://ctdb/samba.org/samba.html
>>>> Yes.
>>>> ATM, we have both nodes live. But evidently that's very bad. We must
>>>> have only one node up at a time it seems.
>>>>
>>>>> Do you have CTDB_MANAGES_SAMBA="yes" in /etc/default/ctdb?
>>>> Yes:
>>>> /etc/default/ctdb
>>>>
>>>> CTDB_NODES=/etc/ctdb/nodes
>>>> CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses
>>>> CTDB_MANAGES_SAMBA=yes
>>>> CTDB_SYSLOG=yes
>>>> CTDB_DEBUGLEVEL=3
>>>> CTDB_SERVICE_SMB=smbd
>>>>
>>>>> If so ctdb calls /etc/ctdb/event.d/50.samba. Are you sure you do not
>>>>> have exit 1 iin the service_start function any longer?
>>>>>
>>>>> Seen you enabled the script with
>>>>>
>>>>> ctdb enablescript samba
>>>> It was:
>>>> sudo ctdb enablescript 50.samba
>>>>
>>>>> I guess you can trigger an start with:
>>>>>
>>>>> ctdb -n 0 disable
>>>>> ctdb -n 0 enable
>>>> done.
>>>>> And
>>>>>
>>>>> ctdb scriptstatus
>>>> gives us:
>>>> sudo ctdb scriptstatus
>>>> monitor cycle never run
>>>>> should show if samba is up and running under ctdb control.
>>>> but:
>>>> sudo ctdb eventscript 50.samba startup
>>>> 2014/08/18 14:33:41.263631 [12631]: Invalid arguments
>>>>
>>>> here is /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:-""}
>>>> ;;
>>>> *)
>>>> # Use redhat style as default:
>>>> CTDB_SERVICE_SMB=${CTDB_SERVICE_SMB:-smb}
>>>> CTDB_SERVICE_NMB=${CTDB_SERVICE_NMB:-""}
>>>> ;;
>>>> esac
>>>>
>>>> service_name="samba"
>>>>
>>>> loadconfig
>>>>
>>>> ctdb_setup_service_state_dir
>>>>
>>>> service_start ()
>>>> {
>>>> # make sure samba is not already started
>>>> 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
>>>>
>>>>> You should start smbd/nmbd/winbindd instead for domain member and
>>>>>> standalone file server tasks
>>>>>>
>>>>> This is differnet because you call smbd and sometimes samba. :-)
>>>>>
>>>> Yes. Sorry. Stupid of us!
>>>>
>>>>
>>> ##############################################
>>> OK, we simplified the start and stop part of 50.samba to:
>>> service_start ()
>>> {
>>> service smbd start
>>> }
>>> service_stop ()
>>> {
>>> sudo service smbd stop
>>> }
>>>
>>> And the log changes to:
>>> Aug 18 15:09:06 uc1 ctdbd: 50.samba: ERROR: samba tcp port 445 is not
>>> responding
>>> Aug 18 15:09:06 uc1 ctdbd: server/eventscript.c:496 Eventscript monitor
>>> finished with state 1
>>>
>>> netstat shows nothing on 445 nor 139
>>>
>>> We can however start samba manually, whereupon the 445 error disappears.
>>> Presumably because then it _is_ responding?
>>>
>>> Still, if smbd is not up at the beginning, ctdb will not start it.
>>> Are we any closer?
>>>
>>>
>>>
>> The sytax to start ctdb managed services is
>>
>> ctdb eventscrip startup
>>
>> or to stop em
>>
>> ctdb eventscript shutdown
>>
>> I also get these "samba tcp port 445 is not responding" messages if i
>> shutdown eventscripts but they disappear after a few seconds.
>>
>> ctdb scriptstatus
>> 19 scripts were executed last monitor cycle
>> 00.ctdb Status:OK Duration:0.017 Mon Aug 18 15:39:05 2014
>> 01.reclock Status:OK Duration:0.038 Mon Aug 18 15:39:05 2014
>> 10.interface Status:OK Duration:0.066 Mon Aug 18 15:39:05 2014
>> 11.natgw Status:OK Duration:0.013 Mon Aug 18 15:39:05 2014
>> 11.routing Status:OK Duration:0.013 Mon Aug 18 15:39:05 2014
>> 13.per_ip_routing Status:OK Duration:0.013 Mon Aug 18 15:39:05 2014
>> 20.multipathd Status:DISABLED
>> 31.clamd Status:DISABLED
>> 40.fs_use Status:DISABLED
>> 40.vsftpd Status:OK Duration:0.013 Mon Aug 18 15:39:05 2014
>> 41.httpd Status:OK Duration:0.013 Mon Aug 18 15:39:05 2014
>> 49.winbind Status:OK Duration:0.017 Mon Aug 18 15:39:05 2014
>> 50.samba Status:OK Duration:0.147 Mon Aug 18 15:39:05 2014
>> 60.ganesha Status:DISABLED
>> 60.nfs Status:OK Duration:0.017 Mon Aug 18 15:39:05 2014
>> 62.cnfs Status:OK Duration:0.017 Mon Aug 18 15:39:05 2014
>> 70.iscsi Status:OK Duration:0.013 Mon Aug 18 15:39:05 2014
>> 91.lvs Status:OK Duration:0.013 Mon Aug 18 15:39:05 2014
>> 99.timeout Status:DISABLED
>
> Hi
> And does smbd get started?
>
> Here, it still doesn't:
> sudo ctdb eventscript startup
> 2014/08/18 16:37:51.329851 [ 5327]: Running eventscripts with arguments
> "startup" on node 0
>
> sudo ctdb scriptstatus
> 13 scripts were executed last monitor cycle
> 00.ctdb Status:OK Duration:0.142 Mon Aug 18 16:37:55
> 2014
> 01.reclock Status:OK Duration:0.109 Mon Aug 18 16:37:56
> 2014
> 10.interface Status:OK Duration:0.442 Mon Aug 18 16:37:56
> 2014
> 11.routing Status:OK Duration:0.062 Mon Aug 18 16:37:56
> 2014
> 11.natgw Status:OK Duration:0.054 Mon Aug 18 16:37:56
> 2014
> 13.per_ip_routing Status:OK Duration:0.058 Mon Aug 18 16:37:56
> 2014
> 20.multipathd Status:DISABLED
> 31.clamd Status:DISABLED
> 40.vsftpd Status:OK Duration:0.058 Mon Aug 18 16:37:56
> 2014
> 40.fs_use Status:DISABLED
> 41.httpd Status:OK Duration:0.056 Mon Aug 18 16:37:56
> 2014
> 49.winbind Status:DISABLED
> 50.samba Status:ERROR Duration:0.604 Mon Aug 18 16:37:56
> 2014
> OUTPUT:ERROR: samba tcp port 445 is not responding
>
> Still getting the 445 error. This is with the original 50.samba without
> our simplifications, but the same with the simplifications.
>
> Disabling the eventscript makes no difference to the 445 error:
>
> Aug 18 16:54:47 uc1 ctdbd: server/eventscript.c:859 Starting eventscript
> shutdown
> Aug 18 16:54:48 uc1 ctdbd: server/eventscript.c:496 Eventscript shutdown
> finished with state 0
> Aug 18 16:54:48 uc1 ctdbd: Monitoring has been enabled
>
> Is there any way we could ignore the 445 error and go ahead anyway?
>
> Once we start smbd manually, the error disappears. It just won't start
> to begin with.
>
>
If you take an look at the 50.samba script
.................................
list_samba_ports ()
{
testparm_cat --parameter-name="smb ports" |
sed -e 's@,@ @g'
}
.................................
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
;;
there is an check for these tcp ports
testparm -v --parameter-name="smb ports"
On my side these are 139 and 445. In my test environment samba starts
and stops fine via ctdb and it does listen on port 445.
It does not allow me to access the server from an client because i just
disabled all addc stuff and did not enable any password mechanisms.
Seems you have an kerberos problem on your machine because i found this
in your smbd -i -d3 logs. I'd increase the loglevel in smb.conf restart
via ctdb and if it's not an easy fix use an simpler password backend first.
ads_krb5_mk_req: krb5_cc_get_principal failed (No such file or
directory)
ads_cleanup_expired_creds: Ticket in ccache[MEMORY:prtpub_cache]
More information about the samba
mailing list