Bug 13700 - CTDB socket in wrong place
Summary: CTDB socket in wrong place
Status: RESOLVED INVALID
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: CTDB (show other bugs)
Version: 4.8.6
Hardware: x64 Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Amitay Isaacs
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-03 11:38 UTC by Ryan Launchbury
Modified: 2018-12-06 08:43 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan Launchbury 2018-12-03 11:38:47 UTC
CTDB is looking in the right place for the event socket.

Running the following command:
smbd -b | grep -i 'ctdb\|cluster'

Outputs:   
CLUSTER_SUPPORT
   CTDB_SOCKET
Cluster support features:
   CLUSTER_SUPPORT
   CTDB_SOCKET: /var/run/ctdb/ctdbd.socket
   CTDB_PROTOCOL: 1

Running an LS of the directory:
ls -lr /var/run/ctdb/

Result:
srwxr-xr-x 1 root root 0 Dec  3 10:54 eventd.sock
srwx------ 1 root root 0 Dec  3 10:54 ctdbd.socket
-rw-r--r-- 1 root root 7 Dec  3 10:54 ctdbd.pid

However when running the following command:
ctdb event status

we get the following output:
socket connect failed - /etc/var/run/ctdb/eventd.sock
ctdb_event_init() failed, ret=5
Comment 1 Martin Schwenke 2018-12-05 00:52:37 UTC
One thing to note is that, in CTDB <=4.8, the ctdb command doesn't read the
config.  So, if ctdbd is configured with an unusual socket location then the
ctdb command won't know about it.  This is fixed in 4.9 by not offering a
configurable location for the socket.  ;-)

However, I'm guessing that isn't the case here.

A few questions, just to figure out what is happening...

* Do you have the CTDB_SOCKET environment variable set in your environment when
  you run "ctdb event status"?

* Do have CTDB_SOCKET set in you CTDB configuration?

* Did you compile Samba/CTDB yourself or are you using 3rd party packages?
  If the latter, which ones?

* Please run:

    strings /usr/local/bin/ctdb | grep -F ctdbd.sock

  What path do you see?

* If your platform's "which" command supports the -a option, can you please try:

    which -a ctdb

  Just making sure there's only 1 version installed.  :-)

Thanks...
Comment 2 Ryan Launchbury 2018-12-05 08:59:21 UTC
(In reply to Martin Schwenke from comment #1)

Hi Martin,

Thanks for your response, answers in-line.

* Do you have the CTDB_SOCKET environment variable set in your environment when
  you run "ctdb event status"? 
    No

* Do have CTDB_SOCKET set in you CTDB configuration?
    Yes, it is. The socket location was also configured when compiled. Configure command used was:

   ./configure --sbindir=/usr/sbin --prefix=/etc --with-logdir=/var/log  --sysconfdir=/etc --bindir=/usr/bin --with-socketpath=/var/run/ctdb/ctdbd.socket




* Did you compile Samba/CTDB yourself or are you using 3rd party packages?
  If the latter, which ones?

* Please run:

    strings /usr/local/bin/ctdb | grep -F ctdbd.sock

  What path do you see?
    Return:
      /var/run/ctdb/ctdbd.socket

* If your platform's "which" command supports the -a option, can you please try:

    which -a ctdb

Return:
/usr/bin/ctdb
  Just making sure there's only 1 version installed.  :-)
Comment 3 Ryan Launchbury 2018-12-05 09:02:40 UTC
(In reply to Martin Schwenke from comment #1)

Hi Martin,

Thanks for your response, answers in-line.

* Do you have the CTDB_SOCKET environment variable set in your environment when
  you run "ctdb event status"? 
    No

* Do have CTDB_SOCKET set in you CTDB configuration?
    Yes, it is. The socket location was also configured when compiled. Configure command used was:

   ./configure --sbindir=/usr/sbin --prefix=/etc --with-logdir=/var/log  --sysconfdir=/etc --bindir=/usr/bin --with-socketpath=/var/run/ctdb/ctdbd.socket

   I've rebuilt CTDB with the following configure command and the event socket can now be found
   ./configure --sbindir=/usr/sbin --prefix=/--with-logdir=/var/log  --sysconfdir=/etc --bindir=/usr/bin --with-socketpath=/var/run/ctdb/ctdbd.socket

   Is this correct functionality?


* Did you compile Samba/CTDB yourself or are you using 3rd party packages?
  If the latter, which ones?

* Please run:

    strings /usr/local/bin/ctdb | grep -F ctdbd.sock

  What path do you see?
    Return:
      /var/run/ctdb/ctdbd.socket

* If your platform's "which" command supports the -a option, can you please try:

    which -a ctdb

Return:
/usr/bin/ctdb


Best regards,
Ryan
Comment 4 Martin Schwenke 2018-12-05 22:13:21 UTC
Hi Ryan,

Setting --prefix=/etc is... ummm... unexpected.  :-)

This is the base directory for software installation, so is /usr/local/ by
default and /usr/ in Linux packaging.  Something like the following is usually
enough to get what you want.

   ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var

Everything is installed under /usr, except config and state.  Paths for things
like the socket are derived from those.

You might need some extra things if you're worried about having different
locations for 32 and 64 bit binaries/libraries.

Even with the following, I can't get the socket in the wrong place:

  $ ./configure --sbindir=/usr/sbin --prefix=/etc --with-logdir=/var/log \
      --sysconfdir=/etc --bindir=/usr/bin \
      --with-socketpath=/var/run/ctdb/ctdbd.socket
  ...
  $ strings bin/ctdb | grep -F ctdbd.sock
  /var/run/ctdb/ctdbd.socket

This is because the socket location is explicitly specified.

However, if I omit --with-socketpath then I can get what you were seeing:

  $ ./configure --sbindir=/usr/sbin --prefix=/etc --with-logdir=/var/log \
      --sysconfdir=/etc --bindir=/usr/bin
  ...
  $ strings bin/ctdb | grep -F ctdbd.sock
  /etc/var/run/ctdb/ctdbd.socket

So, I think you might just have been using some unusual ./configure options.  :-)

Is it OK if I close this as either user error or as a duplicate of the
following?

  https://bugzilla.samba.org/show_bug.cgi?id=13064

Thanks...
Comment 5 Ryan Launchbury 2018-12-06 08:43:02 UTC
Hi Martin,

Thanks for looking into this.
I've recompiled with the commands you posted and the issue is resolved.

I was a bit thrown before because with the original configure commands I run, the sock files are in the correct place, and the CTDBD socket can be found, it was only the event sock path that was wrong.

Many thanks for your help,
Best regards,
Ryan