Invalid service name defined in /etc/ctdb/events.d/50.samba

Bug #1734225 reported by Julien Langlois
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
samba (Ubuntu)
Low
Unassigned
Trusty
Low
Unassigned
Xenial
Low
Christian Ehrhardt 

Bug Description

[Impact]

 * samba/nmbd Service names as referenced by ctdb default config are wrong

 * Due to that ctdb deployments start the wrong init script which is bad.

 * Backport a later fix of >=4.5.2 to fix the issue

[Test Case]

1. install ctdb and samba
    $ apt install ctdb samba
2. verify that the "correct" service names on xenial are smbd and nmbd
   $ systemctl status smbd nmbd
   while OTOH
   $ systemctl status samba won't show an active service
3. check the config of ctbd
   $ vim /etc/ctdb/events.d/50.samba
   It should refer to smbd and nmbd for "debian" based systems

[Regression Potential]

 * This doesn't work without the fix, so we can't regress people relying
   on it. Much more likely we have people that tripped over it in the past
   and fixed it themselves which now might be behavior-affected in some
   way. But even that should be safe because:
    a) user didn't care about the issue -> didn't change -> now gets the
       fix as the conffile is the default
    b) user did care about the issue -> adapted the .conf and will now get
       an upgrade prompt
    c) user did care about the issue -> adapted the variable in anotther
       place -> this makes use of bash's "use this if not set" mechanism
       so the overrides of those users should not be affected.

[Other Info]

 * n/a

---

The CTDB deployed /etc/ctdb/events.d/50.samba script contain the following code to detect the smbd/nmbd service name:
---
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:-samba}
                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
---

It detects Ubuntu as Debian (/etc/ctdb/functions) and so define that the smb service is named "samba" and the nmb service does not exists.

That could be OK since Samba deploy an "samba" init script as well as smbd and nmbd. Except, this init script does not really work to start smbd and nmbd.

To make CTDB happy, the previous code must be modified:
--- 50.samba.orig 2017-11-23 23:34:35.146314429 +0000
+++ 50.samba 2017-11-23 23:35:08.161814684 +0000
@@ -14,8 +14,8 @@
   CTDB_SERVICE_NMB=${CTDB_SERVICE_NMB:-nmb}
   ;;
  debian)
- CTDB_SERVICE_SMB=${CTDB_SERVICE_SMB:-samba}
- CTDB_SERVICE_NMB=${CTDB_SERVICE_NMB:-""}
+ CTDB_SERVICE_SMB=smbd
+ CTDB_SERVICE_NMB=nmbd
   ;;
  *)
   # Use redhat style as default:

I reproduced this issue on both Ubuntu 16.04 and 14.04. But it does not exists on Debian Stretch (the 50.samba has been updated).

An easier workaround to avoid updating the 50.samba script is to set those 2 service name in the /etc/default/ctdb:

CTDB_SERVICE_SMB=smbd
CTDB_SERVICE_NMB=nmbd

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in samba (Ubuntu):
status: New → Confirmed
Revision history for this message
Thomas Smith (theitsmith) wrote :

I ran into this problem as well, and the solution (editing /etc/default/ctdb) does resolve the issue.

Note, too, that this issue will prevent a CTDB cluster (or at least the problem node) from coming online (i.e. indicating a status of "HEALTHY") until the mentioned settings are updated.

One thing I would adjust (versus what the OP indicated) is changing the related variables in 50.samba to:

    CTDB_SERVICE_SMB=${CTDB_SERVICE_SMB:-smbd}
    CTDB_SERVICE_NMB=${CTDB_SERVICE_NMB:-nmbd}

instead of:

    CTDB_SERVICE_SMB=smbd
    CTDB_SERVICE_NMB=nmbd

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thanks for this report.

I can confirm bionic and artful have this fixed:
    debian)
        CTDB_SERVICE_SMB=${CTDB_SERVICE_SMB:-smbd}
        CTDB_SERVICE_NMB=${CTDB_SERVICE_NMB:-nmbd}

But not xenial or trusty, which still use "samba" as the fallback name.

Changed in samba (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → Low
tags: added: server-next
Changed in samba (Ubuntu Trusty):
status: New → Triaged
Changed in samba (Ubuntu Xenial):
status: New → Triaged
Changed in samba (Ubuntu Trusty):
importance: Undecided → Low
Changed in samba (Ubuntu Xenial):
importance: Undecided → Low
Changed in samba (Ubuntu):
status: Triaged → Fix Released
C de-Avillez (hggdh2)
Changed in samba (Ubuntu Trusty):
milestone: none → trusty-updates
Changed in samba (Ubuntu Xenial):
milestone: none → xenial-updates
Changed in samba (Ubuntu Xenial):
assignee: nobody → Karl Stenerud (kstenerud)
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Hi,
coming by here after no movement for a while as this was forgotten.
o/ Karl :-)

This was fixed in 2%4.5.2+dfsg-1.
Commit:
https://git.samba.org/samba.git/?p=samba.git;a=commit;h=385aef614034a3f32276e19312f089990e6dbb85
Which made it into 4.5-stable as
https://git.samba.org/samba.git/?p=samba.git;a=commit;h=9cc435fdd602a5e2dee26e106e874e5c2ae5b8b5

Trusty is no more active, especially not for a low prio bug - so Won't Fix there, but easy to prep for Xenial.

Repro:
1. install ctdb and samba
2. verify that the "correct" service names on xenial are smbd and nmbd
   systemctl status smbd nmbd
   while OTOH
   systemctl status samba won't show an active service
3. check the config of ctbd in /etc/ctdb/events.d/50.samba
   It should refer to smbd and nmbd

Changed in samba (Ubuntu Xenial):
assignee: Karl Stenerud (kstenerud) → Christian Ehrhardt  (paelzer)
Changed in samba (Ubuntu Trusty):
status: Triaged → Won't Fix
description: updated
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

While I was preparing a fix for this I realized this probably would be SRU-rejected anyway.

I have asked a SRU Team member and got confirmed:
"I think not worth an SRU for Xenial. Everyone affected has probably either worked around or moved on. So unless someone claims otherwise, I'd leave it."

Therefore dropping server-next tag.

If anyone wants to re-pick-up this the interim work (actually ready to build&test IMHO) is at:
https://code.launchpad.net/~paelzer/ubuntu/+source/samba/+git/samba/+ref/lp-1734225-wrong-ctdb-default-service-names

tags: removed: server-next
Revision history for this message
Bryce Harrington (bryce) wrote :

[Xenial has passed end of standard support]

Changed in samba (Ubuntu Xenial):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers