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

Achim Gottinger achim at ag-web.biz
Sun Aug 17 11:51:38 MDT 2014


Am 17.08.2014 18:18, schrieb Achim Gottinger:
> 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
>
>
Post this list of configure options used by debian samba 4.1.9 for 
comparison.

                 --prefix=/usr \
                 --enable-fhs \
                 --sysconfdir=/etc \
                 --localstatedir=/var \
                 --with-privatedir=/var/lib/samba/private \
                 --with-smbpasswd-file=/etc/samba/smbpasswd \
                 --with-piddir=/var/run/samba \
--with-pammodulesdir=/lib/$(DEB_HOST_MULTIARCH)/security \
                 --with-pam \
                 --with-syslog \
                 --with-utmp \
                 --with-pam_smbpass \
                 --with-winbind \
--with-shared-modules=idmap_rid,idmap_ad,idmap_adex,idmap_hash,idmap_ldap,idmap_tdb2,vfs_dfs_samba4,auth_samba4 
\
                 --with-automount \
                 --with-ldap \
                 --with-ads \
                 --with-dnsupdate \
                 --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
--with-modulesdir=/usr/lib/$(DEB_HOST_MULTIARCH)/samba \
                 --datadir=/usr/share \
                 --with-lockdir=/var/run/samba \
                 --with-statedir=/var/lib/samba \
                 --with-cachedir=/var/cache/samba \
                 --disable-avahi \
                 --with-ctdb=/usr --with-cluster-support \
                 --disable-rpath \
                 --disable-rpath-install \
                 --bundled-libraries=NONE,pytevent,iniparser \
                 --builtin-libraries=replace,ccan \
                 --minimum-library-version="$(shell ./debian/autodeps.py 
--minimum-library-version)"


More information about the samba mailing list