[Samba] CTDB: Failed to connect client socket to daemon.
steve
steve at steve-ss.com
Mon Aug 18 02:38:40 MDT 2014
On Sun, 2014-08-17 at 18:18 +0200, Achim Gottinger wrote:
> Am 17.08.2014 17:04, schrieb steve:
> > On Sun, 2014-08-17 at 14:22 +0200, Achim Gottinger wrote:
> >> Am 17.08.2014 11:25, schrieb steve:
> >>> On Sat, 2014-08-16 at 19:57 +0200, Achim Gottinger wrote:
> >>>> 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).
> >>> Hi
> >>> This solves the socket problem:
> >>> /etc/default/ctdb
> >>>
> >>> #CTDB_SOCKET=/usr/local/var/run/ctdb/ctdbd.socket
> >>> export CTDB_SOCKET
> >> Seen this mentined here.
> >> http://lists.opensuse.org/opensuse-bugs/2013-07/msg03469.html. Assumed
> >> the thread was to old to be relevant here. :-\
> >>> and indeed:
> >>> sudo ctdb status
> >>> Number of nodes:2
> >>> pnn:0 192.168.0.10 OK (THIS NODE)
> >>> pnn:1 192.168.0.11 DISCONNECTED|UNHEALTHY|INACTIVE
> >>> Generation:635915504
> >>> Size:1
> >>> hash:0 lmaster:0
> >>> Recovery mode:NORMAL (0)
> >>> Recovery master:0
> >>>
> >>> ...................
> >>>
> >>> What are the valid arguments to 50.samba?
> >>>
> >>> *************
> >>> As you suggested we restored the original 50.samba script and added:
> >>> CTDB_SERVICE_SMB=smbd
> >>> to /etc/defaults/ctdb
> >>>
> >>> 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
> >>> .........
> >>> service_start ()
> >>> {
> >>> # make sure samba is not already started
> >>> echo $CTDB_SERVICE_SMB
> >>> exit 1
> >> The above two lines do not appear on debians version of the startscript.
> >> Guess they endedup unintentional.
> > OK, removed them.
> >
> >>> 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"
> >>> }
> >>>
> >>> .....
> >>> is_ctdb_managed_service || exit 0
> >> Below you can see startup/shutdown/monitor are valid options for the
> >> script. Take an look at /etc/ctdb/functions if you want to inspect the
> >> functions like is_ctdb_managed_service above.
> >>> ###########################
> >>>
> >>> 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
> >>>
> >> Hope that helps.
> > Hi
> > smbd won't start:
> > sudo smbd -i -d3
> > Maximum core file size limits now 16777216(soft) -1(hard)
> > smbd version 4.1.11 started.
> > Copyright Andrew Tridgell and the Samba Team 1992-2013
> > uid=0 gid=0 euid=0 egid=0
> > lp_load_ex: refreshing parameters
> > Initialising global parameters
> > rlimit_max: increasing rlimit_max (1024) to minimum Windows limit
> > (16384)
> > params.c:pm_process() - Processing configuration file
> > "/usr/local/samba/etc/smb.conf"
> > Processing section "[global]"
> > connect(/usr/local/var/run/ctdb/ctdbd.socket) failed: Connection refused
> > messaging_ctdbd_init failed: NT_STATUS_CONNECTION_REFUSED
> >
> > We have exported CTDB_SOCKET as per the post you sent:
> > echo $CTDB_SOCKET
> > /usr/local/var/run/ctdb/ctdbd.socket
> >
> > But smbd will not start:
> >
> > sudo smbd -i -d3
> > Maximum core file size limits now 16777216(soft) -1(hard)
> > smbd version 4.1.11 started.
> > Copyright Andrew Tridgell and the Samba Team 1992-2013
> > uid=0 gid=0 euid=0 egid=0
> > lp_load_ex: refreshing parameters
> > Initialising global parameters
> > rlimit_max: increasing rlimit_max (1024) to minimum Windows limit
> > (16384)
> > params.c:pm_process() - Processing configuration file
> > "/usr/local/samba/etc/smb.conf"
> > Processing section "[global]"
> > connect(/usr/local/var/run/ctdb/ctdbd.socket) failed: Connection refused
> > messaging_ctdbd_init failed: NT_STATUS_CONNECTION_REFUSED
> >
> > We have tried with the socket at:
> > /var/run/ctdb/ctdbd.socket
> > and
> > /usr/local/var/run/ctdb/ctdbd.socket
> >
> > We can only run:
> > sudo ctdb status
> > with the socket at:
> > /usr/local/var/run/ctdb/ctdbd.socket
> >
> > But then, smbd will not start.
> >
> > Give up?
> > Thanks for your patience,
> > Steve
> Did an quick setup here on my testing vm (debian wheezy with samba from
> backports.
> CTDB_SOCKET is not configured in /etc/default/ctdb here, i did not
> change that.
> I created suitable /etc/ctdb/nodes and /etc/ctdb/public_addresses for my
> network and set CTDB_RECOVERY_LOCK=/tmp/ctdb.lock in /etc/default/ctdb.
>
> First try to start ctdb resulted in an error message
> 2014/08/17 17:27:46.970998 [16882]: Unable to bind on ctdb socket
> '/var/lib/run/ctdb/ctdbd.socket'
>
> So the lock seems to be expected at /var/lib/run/ctdb. The folder did
> not exist so i created it. Then ctdb started.
>
> ls -l /var/lib/run/ctdb/
> total 0
> srwx------ 1 root root 0 Aug 17 17:52 ctdbd.socket
>
> ctdb status
> Number of nodes:1
> pnn:0 192.168.100.104 OK (THIS NODE)
> Generation:1546680508
> Size:1
> hash:0 lmaster:0
> Recovery mode:NORMAL (0)
> Recovery master:0
>
> Stripped down my smb.conf which is usually for an addc to this content:
>
> [global]
> workgroup = DOMAIN
> realm = domain.local
> netbios name = server
> interfaces = 192.168.100.104,127.0.0.1
> bind interfaces only = Yes
> disable netbios = yes
> clustering = yes
> ctdbd socket = /var/lib/run/ctdb/ctdbd.socket
>
> [s1]
> path = /test/data/s1
> read only = No
>
> Trying to start smbd in foreground just like you did:
>
> ~#smbd -i -d3
> Maximum core file size limits now 16777216(soft) -1(hard)
> smbd version 4.1.9-Debian started.
> Copyright Andrew Tridgell and the Samba Team 1992-2013
> uid=0 gid=0 euid=0 egid=0
> lp_load_ex: refreshing parameters
> Initialising global parameters
> rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
> params.c:pm_process() - Processing configuration file "/etc/samba/smb.conf"
> Processing section "[global]"
> Registered MSG_REQ_POOL_USAGE
> Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED
> lp_load_ex: refreshing parameters
> Initialising global parameters
> rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
> params.c:pm_process() - Processing configuration file "/etc/samba/smb.conf"
> Processing section "[global]"
> Processing section "[s1]"
> adding IPC service
> added interface eth0 ip=192.168.100.104 bcast=192.168.100.255
> netmask=255.255.255.0
> added interface lo ip=127.0.0.1 bcast=127.255.255.255 netmask=255.0.0.0
> loaded services
> db_open_ctdb: opened database 'g_lock.tdb' with dbid 0x4d2a432b
> db_open_ctdb: opened database 'secrets.tdb' with dbid 0x7132c184
> db_open_ctdb: opened database 'dbwrap_watchers.tdb' with dbid 0x6afb8c09
> db_open_ctdb: opened database 'smbXsrv_version_global.tdb' with dbid
> 0x521b7544
> db_open_ctdb: opened database 'serverid.tdb' with dbid 0x9ec2a880
> db_open_ctdb: opened database 'smbXsrv_session_global.tdb' with dbid
> 0x6b06a26d
> db_open_ctdb: opened database 'smbXsrv_tcon_global.tdb' with dbid 0x68c12c2c
> db_open_ctdb: opened database 'brlock.tdb' with dbid 0x4e66c2b2
> db_open_ctdb: opened database 'locking.tdb' with dbid 0x7a19d84d
> db_open_ctdb: opened database 'notify_index.tdb' with dbid 0xaf029e9d
> db_open_ctdb: opened database 'g_lock.tdb' with dbid 0x4d2a432b
> db_open_ctdb: opened database 'registry.tdb' with dbid 0x6cf2837d
> db_open_ctdb: opened database 'g_lock.tdb' with dbid 0x4d2a432b
> db_open_ctdb: opened database 'share_info.tdb' with dbid 0xc3078fba
> db_open_ctdb: opened database 'g_lock.tdb' with dbid 0x4d2a432b
> db_open_ctdb: opened database 'group_mapping.tdb' with dbid 0xa1413774
> db_open_ctdb: opened database 'g_lock.tdb' with dbid 0x4d2a432b
> db_open_ctdb: opened database 'account_policy.tdb' with dbid 0x2ca251cf
> db_open_ctdb: opened database 'g_lock.tdb' with dbid 0x4d2a432b
> db_open_ctdb: opened database 'passdb.tdb' with dbid 0x3ef19640
> db_open_ctdb: opened database 'smbXsrv_open_global.tdb' with dbid 0x66f71b8c
> Initialise the svcctl registry keys if needed.
> db_open_ctdb: opened database 'g_lock.tdb' with dbid 0x4d2a432b
> db_open_ctdb: opened database 'registry.tdb' with dbid 0x6cf2837d
> Initialise the eventlog registry keys if needed.
> db_open_ctdb: opened database 'g_lock.tdb' with dbid 0x4d2a432b
> db_open_ctdb: opened database 'registry.tdb' with dbid 0x6cf2837d
> db_open_ctdb: opened database 'printer_list.tdb' with dbid 0x5bcfcbd7
> reloading printcap cache
>
> Seems it's ok for ctdb.
>
> An quick test to check the socket used by ctdbd.
>
> ~#pidof ctdbd
> 22724 22580
>
> ~#lsof -p 22580 | grep socket
> ctdbd 22580 root 5u unix 0xffff880002319ac0 0t0 609955
> /var/lib/run/ctdb/ctdbd.socket
> ctdbd 22580 root 16u unix 0xffff8800ec5103c0 0t0 616499
> /var/lib/run/ctdb/ctdbd.socket
>
>
Hi
Thanks for this. We rolled back to ctdb 2.5.1 and the sockets are
working in the same place as your debian install. We can join the
domain, smbd fires up _manually_ and we can server windows and linux
domain clients:
sudo ctdb status
Number of nodes:2
pnn:0 192.168.0.10 OK (THIS NODE)
pnn:1 192.168.0.11 DISCONNECTED|UNHEALTHY|INACTIVE
Generation:1016391403
Size:1
hash:0 lmaster:0
Recovery mode:NORMAL (0)
Recovery master:0
BUT:
the 50.samba script does not work:
sudo ctdb enablescript 50.samba
sudo ctdb eventscript 50.samba startup
2014/08/18 10:09:20.129066 [18449]: Invalid arguments
sudo ctdb eventscript 50.samba shutdown
2014/08/18 10:10:51.002979 [19033]: Invalid arguments
even though ctdb says it has:
Aug 18 10:19:05 uc1 ctdbd: server/eventscript.c:496 Eventscript monitor
finished with state 0
/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="smbd"
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
More information about the samba
mailing list