Bug 1088574 - Just updated TW now SMB daemon fails to start
Just updated TW now SMB daemon fails to start
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Samba
Current
x86-64 Other
: P3 - Medium : Normal (vote)
: ---
Assigned To: Aurelien Aptel
The 'Opening Windows to a Wider World' guys
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-04-08 12:35 UTC by Petr Matula
Modified: 2018-08-08 22:26 UTC (History)
6 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Matula 2018-04-08 12:35:03 UTC
SAMBA fails to start after last zypper dup:





        server1:/var/log/samba # systemctl start smb nmb
        Job for nmb.service failed because the control process exited with error code.
        See "systemctl status nmb.service" and "journalctl -xe" for details.
        Job for smb.service failed because the control process exited with error code.
        See "systemctl status smb.service" and "journalctl -xe" for details.
        server1:/var/log/samba # journalctl -xe         
        -- Subject: Unit smb.service has begun start-up
        -- Defined-By: systemd
        -- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
        -- 
        -- Unit smb.service has begun starting up.
        dub 08 12:27:06 server1 nmbd[2996]: [2018/04/08 12:27:06.622500,  0] ../lib/util/become_daemon.c:124(exit_daemon)
        dub 08 12:27:06 server1 systemd[1]: Starting Samba NMB Daemon...
        -- Subject: Unit nmb.service has begun start-up
        -- Defined-By: systemd
        -- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
        -- 
        -- Unit nmb.service has begun starting up.
        dub 08 12:27:06 server1 nmbd[2996]:   exit_daemon: STATUS=daemon failed to start: Failed to create session, error code 1
        dub 08 12:27:06 server1 systemd[1]: nmb.service: Main process exited, code=exited, status=1/FAILURE
        dub 08 12:27:06 server1 smbd[2998]: [2018/04/08 12:27:06.856898,  0] ../lib/util/become_daemon.c:124(exit_daemon)
        dub 08 12:27:06 server1 systemd[1]: nmb.service: Failed with result 'exit-code'.
        dub 08 12:27:06 server1 smbd[2998]:   exit_daemon: STATUS=daemon failed to start: Failed to create session, error code 1
        dub 08 12:27:06 server1 systemd[1]: Failed to start Samba NMB Daemon.
        -- Subject: Unit nmb.service has failed
        -- Defined-By: systemd
        -- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
        -- 
        -- Unit nmb.service has failed.
        -- 
        -- The result is RESULT.
        dub 08 12:27:06 server1 systemd[1]: smb.service: Main process exited, code=exited, status=1/FAILURE
        dub 08 12:27:06 server1 systemd[1]: smb.service: Failed with result 'exit-code'.
        dub 08 12:27:06 server1 systemd[1]: Failed to start Samba SMB Daemon.
        -- Subject: Unit smb.service has failed
        -- Defined-By: systemd
        -- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
        -- 
        -- Unit smb.service has failed.
        -- 
        -- The result is RESULT.
Comment 2 Arjen de Korte 2018-04-08 19:56:38 UTC
As a workaround, running

/usr/sbin/nmbd -D
/usr/sbin/smbd -D

on the commandline will fire up the daemons.
Comment 3 Aurelien Aptel 2018-04-09 09:53:32 UTC
This is related to bsc#1065551 and bsc#1071090.

To make samba<=>systemd interactions better (first bug in the list) we changed the service files. Then things started breaking *on upgrades*.

The starting flags are in the unit file which is on the vendor repo (same branch for all products) and they source /etc/sysconfig/samba (also from vendor repo)
which is where we defined the daemonizing/foreground flags. But this file doesnt get updated automatically on updates it seems (see second bug).

the fix is to
- make sure the samba has the required systemd commits
- move the foreground flags directly in the unit file, and leave the sysconfig flags empty by default (might require %post scriptlet in spec file to FORCE sysconfig update)

We could use upstream sysconfig/unit files which are mostly correct but differ slightly in certain directives. This might be hard to get right so I'm more for keeping our vendor files.

This will probably affect SLE15 too.
Comment 4 Arjen de Korte 2018-04-09 10:20:41 UTC
I don't think flags from /etc/sysconfig/samba and/or systemd startup files are the problem here. I updated /etc/sysconfig/samba and confirmed that the systemd files are updated.

I get exactly the same error if I run these from the commandline:

/usr/sbin/nmbd -D -F
/usr/sbin/smbd -D -F

This problem was first introduced when samba went from 4.7.6 to 4.8.0, so I think we should be looking in what changed there.
Comment 5 Noel Power 2018-04-09 11:49:55 UTC
(In reply to Arjen de Korte from comment #4)
> I don't think flags from /etc/sysconfig/samba and/or systemd startup files
> are the problem here. I updated /etc/sysconfig/samba and confirmed that the
> systemd files are updated.
> 
> I get exactly the same error if I run these from the commandline:
> 
> /usr/sbin/nmbd -D -F
> /usr/sbin/smbd -D -F
> 
> This problem was first introduced when samba went from 4.7.6 to 4.8.0, so I
> think we should be looking in what changed there.

as Aurelien says the problem is to do with new values (currently missing) that need to be in the systemd files (and/or) in the /etc/sysconfig/samba file

As a workaround a minimal change that should get you going would be 

in /usr/lib/systemd/system/smb.service (nmb.service & winbind.service) do similar to 

-ExecStart=/usr/sbin/smbd $SMBDOPTIONS
+ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS

systemctl daemon-reload

then try and restart the services
Comment 6 Noel Power 2018-04-09 11:51:06 UTC
(In reply to Noel Power from comment #5)

> -ExecStart=/usr/sbin/smbd $SMBDOPTIONS
> +ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS

and of course replacing smbd above with (nmb, winbindd) as appropriate
Comment 7 Arjen de Korte 2018-04-09 11:57:22 UTC
(In reply to Noel Power from comment #6)
> (In reply to Noel Power from comment #5)
> 
> > -ExecStart=/usr/sbin/smbd $SMBDOPTIONS
> > +ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS
> 
> and of course replacing smbd above with (nmb, winbindd) as appropriate

I just found out myself :-)

This is indeed the fix. Remove the "-D -F" from the NMBDOPTIONS and SMBDOPTIONS from /etc/sysconfig/samba and adjust 

/usr/lib/systemd/system/nmb.service:

-ExecStart=/usr/sbin/nmbd $NMBDOPTIONS
+ExecStart=/usr/sbin/nmbd --foreground --no-process-group $NMBDOPTIONS

/usr/lib/systemd/system/smb.service:

-ExecStart=/usr/sbin/smbd $SMBDOPTIONS
+ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS

and voila, everything is back in order.

Thanks!
Comment 8 Aurelien Aptel 2018-04-12 08:33:10 UTC
I've modified the post installation script to remove the sysconfig stuff and changed the unit file to use --foreground --no-process-group so that the next update should fix this issue in a way that won't break for those who did this themselves.

https://build.opensuse.org/request/show/595751
Comment 9 Arjen de Korte 2018-04-22 17:08:46 UTC
Seems to be fixed with Tumbleweed (20180419) now.
Comment 10 Aurelien Aptel 2018-04-23 14:19:04 UTC
ok, closing.
Comment 15 Swamp Workflow Management 2018-08-03 19:10:55 UTC
SUSE-RU-2018:2182-1: An update that has 6 recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1065551,1071090,1088574,1093864,1094881,1099702
CVE References: 
Sources used:
SUSE Linux Enterprise Module for Basesystem 15 (src):    samba-4.7.8+git.62.c1052da2b4e-4.7.4, talloc-2.1.11-3.3.4, talloc-man-2.1.11-3.3.3, tevent-0.9.36-4.3.3, tevent-man-0.9.36-4.3.3
SUSE Linux Enterprise High Availability 15 (src):    samba-4.7.8+git.62.c1052da2b4e-4.7.4
Comment 16 Swamp Workflow Management 2018-08-08 22:26:48 UTC
openSUSE-RU-2018:2260-1: An update that has 6 recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1065551,1071090,1088574,1093864,1094881,1099702
CVE References: 
Sources used:
openSUSE Leap 15.0 (src):    samba-4.7.8+git.62.c1052da2b4e-lp150.3.3.1, talloc-2.1.11-lp150.2.3.1, talloc-man-2.1.11-lp150.2.3.1, tevent-0.9.36-lp150.2.3.1, tevent-man-0.9.36-lp150.2.3.1