Upgraded > Samba no longer listening on 192.168.0.x

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Upgraded > Samba no longer listening on 192.168.0.x

Winfried
Hello

Since I last ran "apt-get upgrade" on a Debian host which upgraded Debian to 8.8 and Samba to 4.2.14, Samba is no longer listening on the 192.168.0.x network after waking up from suspend mode. As a result, it's not listed in Windows' Network Neighborhood and, thus, not reachable from a Windows host where a backup job is running that uses the Debian host as a file server.

Samba runs as a stand-alone server at home, and is only used to share a directory, with write access; It handles no printer. This computer only has one Ethernet card, and is scheduled to wake up and go back to sleep every day with enough time to be used to run the backup job.

Running "/etc/init.d/samba restart" does solve the problem but I must find the root of the problem and solve it accordingly.

Here's what /var/log/syslog says when I run the init.d script; Notice the "At this time the 'samba' binary should only be used for either" at the end:
==========
May 17 11:56:02 debian systemd[1]: Stopping LSB: start Samba NetBIOS nameserver (nmbd)...
May 17 11:56:02 debian nmbd[719]: [2017/05/17 11:56:02.577041,  0] ../source3/nmbd/nmbd.c:58(terminate)
May 17 11:56:02 debian nmbd[719]:   Got SIGTERM: going down...
May 17 11:56:03 debian nmbd[1373]: Stopping NetBIOS name server: nmbd.
May 17 11:56:03 debian systemd[1]: Starting LSB: start Samba NetBIOS nameserver (nmbd)...
May 17 11:56:07 debian nmbd[1377]: Starting NetBIOS name server: nmbd.
May 17 11:56:07 debian systemd[1]: Started LSB: start Samba NetBIOS nameserver (nmbd).
May 17 11:56:07 debian nmbd[1389]: [2017/05/17 11:56:07.186384,  0] ../lib/util/become_daemon.c:124(daemon_ready)
May 17 11:56:07 debian nmbd[1389]:   STATUS=daemon 'nmbd' finished starting up and ready to serve connections
May 17 11:56:07 debian systemd[1]: Stopping LSB: start Samba SMB/CIFS daemon (smbd)...
May 17 11:56:07 debian smbd[763]: [2017/05/17 11:56:07.320366,  0] ../lib/util/pidfile.c:153(pidfile_unlink)
May 17 11:56:07 debian smbd[763]:   Failed to delete pidfile /var/run/samba/smbd.pid. Error was No such file or directory
May 17 11:56:08 debian smbd[1417]: Stopping SMB/CIFS daemon: smbd.
May 17 11:56:08 debian systemd[1]: Starting LSB: start Samba SMB/CIFS daemon (smbd)...
May 17 11:56:09 debian smbd[1423]: Starting SMB/CIFS daemon: smbd.
May 17 11:56:09 debian systemd[1]: Started LSB: start Samba SMB/CIFS daemon (smbd).
May 17 11:56:09 debian smbd[1432]: [2017/05/17 11:56:09.360728,  0] ../lib/util/become_daemon.c:124(daemon_ready)
May 17 11:56:09 debian smbd[1432]:   STATUS=daemon 'smbd' finished starting up and ready to serve connections
May 17 11:56:09 debian systemd[1]: Stopping LSB: start Samba daemons for the AD DC...
May 17 11:56:10 debian samba-ad-dc[1461]: Stopping Samba AD DC daemon: samba.
May 17 11:56:10 debian systemd[1]: Starting LSB: start Samba daemons for the AD DC...
May 17 11:56:11 debian systemd[1]: Started LSB: start Samba daemons for the AD DC.
May 17 12:02:19 debian crontab[1516]: (root) LIST (root)
May 17 12:02:39 debian kernel: [ 7713.661907] perf interrupt took too long (5003 > 5000), lowering kernel.perf_event_max_sample_rate to 25000
May 17 12:03:30 debian samba[1521]: [2017/05/17 12:03:30.212614,  0] ../source4/smbd/server.c:370(binary_smbd_main)
May 17 12:03:30 debian samba[1521]:   samba version 4.2.14-Debian started.
May 17 12:03:30 debian samba[1521]:   Copyright Andrew Tridgell and the Samba Team 1992-2014
May 17 12:03:30 debian samba[1522]: [2017/05/17 12:03:30.650332,  0] ../source4/smbd/server.c:475(binary_smbd_main)
May 17 12:03:30 debian samba[1522]:   At this time the 'samba' binary should only be used for either:
May 17 12:03:30 debian samba[1522]:   'server role = active directory domain controller' or to access the ntvfs file server with 'server services = +smb' or the rpc proxy with 'dcerpc endpoint servers = remote'
May 17 12:03:30 debian samba[1522]:   You should start smbd/nmbd/winbindd instead for domain member and standalone file server tasks
May 17 12:03:30 debian samba[1522]: [2017/05/17 12:03:30.650724,  0] ../lib/util/become_daemon.c:111(exit_daemon)
May 17 12:03:30 debian samba[1522]:   STATUS=daemon failed to start: Samba detected misconfigured 'server role' and exited. Check logs for details, error code 22
==========

This is the smb.conf I wrote:
==========
[global]
workgroup = WORKGROUP
;netbios name = LINUX

log level = 2

;this avoids needless errors in the logs if you have no printer
printcap name = /dev/null
load printers = no
printing = bsd

security = user
hosts allow = 127.0.0.1 192.168.0.0/24
hosts deny = 0.0.0.0/0
bind interfaces only = yes

map to guest = bad user

;Sheevaplug
wins server = 192.168.0.15

[write]
path = /BackupFromWindows7
guest ok = yes
writeable=yes
browseable=yes
==========

And I notice that Samba mentions "samba-ad-dc" when running the init.d script:
==========
root@debian:~# /etc/init.d/samba restart
[ ok ] Restarting nmbd (via systemctl): nmbd.service.
[ ok ] Restarting smbd (via systemctl): smbd.service.
[ ok ] Restarting samba-ad-dc (via systemctl): samba-ad-dc.service.
==========

It used to work fine before upgrading: Do I need to change something in smb.conf? And should I run add a Cron job to run the init.d script after the computer wakes up?

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Upgraded > Samba no longer listening on 192.168.0.x

Samba - General mailing list
On Wed, 17 May 2017 03:17:13 -0700 (PDT)
Winfried via samba <[hidden email]> wrote:

>
> And I notice that Samba mentions "samba-ad-dc" when running the init.d
> script:
> ==========
> root@debian:~# /etc/init.d/samba restart
> [ ok ] Restarting nmbd (via systemctl): nmbd.service.
> [ ok ] Restarting smbd (via systemctl): smbd.service.
> [ ok ] Restarting samba-ad-dc (via systemctl): samba-ad-dc.service.
> ==========
>
> It used to work fine before upgrading: Do I need to change something
> in smb.conf? And should I run add a Cron job to run the init.d script
> after the computer wakes up?
>
> Thank you.

It looks the init script is trying to start Samba as an AD DC, but you
don't have an AD DC ;-)

The init script is provided by Debian and not by Samba.

Can you post the init script ?

Rowland
 



--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba
Reply | Threaded
Open this post in threaded view
|

Re: Upgraded > Samba no longer listening on 192.168.0.x

Winfried
Here goes:

root@debian:~# cat /etc/init.d/samba
#!/bin/sh

### BEGIN INIT INFO
# Provides:          samba
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: ensure Samba daemons are started (nmbd and smbd)
### END INIT INFO

set -e

# start nmbd, smbd and samba-ad-dc unconditionally
# the init scripts themselves check if they are needed or not
case $1 in
        start)
                /etc/init.d/nmbd start
                /etc/init.d/smbd start
                /etc/init.d/samba-ad-dc start
                ;;
        stop)
                /etc/init.d/samba-ad-dc stop
                /etc/init.d/smbd stop
                /etc/init.d/nmbd stop
                ;;
        reload)
                /etc/init.d/smbd reload
                ;;
        restart|force-reload)
                /etc/init.d/nmbd "$1"
                /etc/init.d/smbd "$1"
                /etc/init.d/samba-ad-dc "$1"
                ;;
        status)
                status=0
                NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null || true`
                SERVER_ROLE=`samba-tool testparm --parameter-name="server role"  2>/dev/null | tail -1 || true`
                if [ "$SERVER_ROLE" != "active directory domain controller" ]; then
                        if [ "$NMBD_DISABLED" != "Yes" ]; then
                                /etc/init.d/nmbd status || status=$?
                        fi
                        /etc/init.d/smbd status || status=$?
                else
                        /etc/init.d/samba-ad-dc status || status=$?
                fi
                exit $status
                ;;
        *)
                echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload|status}"
                exit 1
                ;;
esac
root@debian:~#
Reply | Threaded
Open this post in threaded view
|

Re: Upgraded > Samba no longer listening on 192.168.0.x

Samba - General mailing list
In reply to this post by Winfried
Hi Winfried,

Am 17.05.2017 um 12:17 schrieb Winfried via samba:
> Samba runs as a stand-alone server at home, ...
 > ...
 > Notice the "At this time the 'samba' binary should
 > only be used for either" at the end:
 > ...> May 17 12:03:30 debian samba[1522]:   At this time the 'samba'
binary should

> only be used for either:
> May 17 12:03:30 debian samba[1522]:   'server role = active directory domain
> controller' or to access the ntvfs file server with 'server services = +smb'
> or the rpc proxy with 'dcerpc endpoint servers = remote'
> May 17 12:03:30 debian samba[1522]:   You should start smbd/nmbd/winbindd
> instead for domain member and standalone file server tasks
> May 17 12:03:30 debian samba[1522]: [2017/05/17 12:03:30.650724,  0]
> ../lib/util/become_daemon.c:111(exit_daemon)
> May 17 12:03:30 debian samba[1522]:   STATUS=daemon failed to start: Samba
> detected misconfigured 'server role' and exited. Check logs for details,
>
 > ...
> And I notice that Samba mentions "samba-ad-dc" when running the init.d
> script:
> ==========
> root@debian:~# /etc/init.d/samba restart
> [ ok ] Restarting nmbd (via systemctl): nmbd.service.
> [ ok ] Restarting smbd (via systemctl): smbd.service.
> [ ok ] Restarting samba-ad-dc (via systemctl): samba-ad-dc.service.
> ==========



This is not a Samba problem. It looks like the update enabled a systemd
service that starts the "samba" binary - which is the Samba AD DC.
Because your config is not for a DC, Samba logs this error.

* Disable the samba and samba-ad-dc services
* Enable the nmbd and smbd services


Regards,
Marc

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba
Reply | Threaded
Open this post in threaded view
|

Re: Upgraded > Samba no longer listening on 192.168.0.x

Samba - General mailing list
In reply to this post by Winfried
that init script is ok.

Try adding the following in your smb.conf
Add :
    interfaces = 192.168.249.230 127.0.0.1
Or  interfaces = eth0 lo
( change eth0 to your interface name)

Check:
systemctl status samba
systemctl status samba-ad-dc

If samba-ad-dc is enable, disable that one, and enable samba.
systemctl disable samba-ad-dc
systemctl enable samba


Greetz,

Louis



> -----Oorspronkelijk bericht-----
> Van: samba [mailto:[hidden email]] Namens
> Winfried via samba
> Verzonden: woensdag 17 mei 2017 12:45
> Aan: [hidden email]
> Onderwerp: Re: [Samba] Upgraded > Samba no longer listening
> on 192.168.0.x
>
> Here goes:
>
> root@debian:~# cat /etc/init.d/samba
> #!/bin/sh
>
> ### BEGIN INIT INFO
> # Provides:          samba
> # Required-Start:
> # Required-Stop:
> # Default-Start:
> # Default-Stop:
> # Short-Description: ensure Samba daemons are started (nmbd
> and smbd) ### END INIT INFO
>
> set -e
>
> # start nmbd, smbd and samba-ad-dc unconditionally # the init
> scripts themselves check if they are needed or not case $1 in
>         start)
>                 /etc/init.d/nmbd start
>                 /etc/init.d/smbd start
>                 /etc/init.d/samba-ad-dc start
>                 ;;
>         stop)
>                 /etc/init.d/samba-ad-dc stop
>                 /etc/init.d/smbd stop
>                 /etc/init.d/nmbd stop
>                 ;;
>         reload)
>                 /etc/init.d/smbd reload
>                 ;;
>         restart|force-reload)
>                 /etc/init.d/nmbd "$1"
>                 /etc/init.d/smbd "$1"
>                 /etc/init.d/samba-ad-dc "$1"
>                 ;;
>         status)
>                 status=0
>                 NMBD_DISABLED=`testparm -s
> --parameter-name='disable netbios' 2>/dev/null || true`
>                 SERVER_ROLE=`samba-tool testparm
> --parameter-name="server role"  2>/dev/null | tail -1 || true`
>                 if [ "$SERVER_ROLE" != "active directory
> domain controller"
> ]; then
>                         if [ "$NMBD_DISABLED" != "Yes" ]; then
>                                 /etc/init.d/nmbd status || status=$?
>                         fi
>                         /etc/init.d/smbd status || status=$?
>                 else
>                         /etc/init.d/samba-ad-dc status || status=$?
>                 fi
>                 exit $status
>                 ;;
>         *)
>                 echo "Usage: /etc/init.d/samba
> {start|stop|reload|restart|force-reload|status}"
>                 exit 1
>                 ;;
> esac
> root@debian:~#
>
>
>
>
> --
> View this message in context:
> http://samba.2283325.n4.nabble.com/Upgraded-Samba-no-longer-li
stening-on-192-168-0-x-tp4718767p4718769.html
> Sent from the Samba - General mailing list archive at Nabble.com.
>
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba
>
>


--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba
Reply | Threaded
Open this post in threaded view
|

Re: Upgraded > Samba no longer listening on 192.168.0.x

Samba - General mailing list
In reply to this post by Winfried
On Wed, 17 May 2017 03:45:28 -0700 (PDT)
Winfried via samba <[hidden email]> wrote:

> Here goes:
>
> root@debian:~# cat /etc/init.d/samba

>
> # start nmbd, smbd and samba-ad-dc unconditionally
> # the init scripts themselves check if they are needed or not

This tells you that the scripts should check if they should try to
start or stop the relevant deamons.

> case $1 in
>         start)
>                 /etc/init.d/nmbd start
>                 /etc/init.d/smbd start
>                 /etc/init.d/samba-ad-dc start
>                 ;;
>         stop)
>                 /etc/init.d/samba-ad-dc stop
>                 /etc/init.d/smbd stop
>                 /etc/init.d/nmbd stop
>                 ;;

This shows what deamon to try and start/stop, it looks like the
'samba-ad-dc' is where the problem lies.

I use Devuan and there is this in my 'samba-ad-dc' script on a domain
member:

SERVER_ROLE=`samba-tool testparm --parameter-name="server role"  2>/dev/null | tail -1`
if [ "$SERVER_ROLE" != "active directory domain controller" ]; then
    exit 0
fi

There is a similar one in the 'nmbd' and 'smbd' scripts, but this one
exits if it is a DC.

Do you have something like the above in your samba-ad-dc script ?

Rowland
 

--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba
Reply | Threaded
Open this post in threaded view
|

Re: Upgraded > Samba no longer listening on 192.168.0.x

Winfried
In reply to this post by Samba - General mailing list
Thank you.

After adding "interfaces = eth0 lo" to smb.conf, I ran the following commands:

================
root@debian:~# systemctl status samba
● samba.service
   Loaded: masked (/dev/null)
   Active: inactive (dead)
================
root@debian:~# systemctl status samba-ad-dc
● samba-ad-dc.service - LSB: start Samba daemons for the AD DC
   Loaded: loaded (/etc/init.d/samba-ad-dc)
   Active: active (exited) since Wed 2017-05-17 12:25:44 CEST; 47min ago

May 17 12:25:44 debian systemd[1]: Started LSB: start Samba daemons for the AD DC.
================
root@debian:~# systemctl disable samba-ad-dc
Synchronizing state for samba-ad-dc.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d samba-ad-dc defaults
insserv: warning: current start runlevel(s) (empty) of script `samba-ad-dc' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `samba-ad-dc' overrides LSB defaults (0 1 6).
Executing /usr/sbin/update-rc.d samba-ad-dc disable
insserv: warning: current start runlevel(s) (empty) of script `samba-ad-dc' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `samba-ad-dc' overrides LSB defaults (0 1 6).
================
root@debian:~# systemctl enable samba
Synchronizing state for samba.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d samba defaults
Executing /usr/sbin/update-rc.d samba enable
update-rc.d: error: samba Default-Start contains no runlevels, aborting.
================
root@debian:~# systemctl enable nmbd.service smbd.service
Synchronizing state for nmbd.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d nmbd defaults
Executing /usr/sbin/update-rc.d nmbd enable
Synchronizing state for smbd.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d smbd defaults
Executing /usr/sbin/update-rc.d smbd enable
================

The Debian host is listed when I run "c:\>net view" in Windows:

================
root@debian:~# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      390/sshd
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      1706/smbd
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      1706/smbd
tcp6       0      0 :::22                   :::*                    LISTEN      390/sshd
tcp6       0      0 :::445                  :::*                    LISTEN      1706/smbd
tcp6       0      0 :::139                  :::*                    LISTEN      1706/smbd
udp        0      0 0.0.0.0:52216           0.0.0.0:*                           741/dhclient
udp        0      0 0.0.0.0:68              0.0.0.0:*                           741/dhclient
udp        0      0 192.168.0.255:137       0.0.0.0:*                           1663/nmbd
udp        0      0 192.168.0.7:137         0.0.0.0:*                           1663/nmbd
udp        0      0 0.0.0.0:137             0.0.0.0:*                           1663/nmbd
udp        0      0 192.168.0.255:138       0.0.0.0:*                           1663/nmbd
udp        0      0 192.168.0.7:138         0.0.0.0:*                           1663/nmbd
udp        0      0 0.0.0.0:138             0.0.0.0:*                           1663/nmbd
udp6       0      0 :::26459                :::*                                741/dhclient
================

I'll report back tomorrow if the above solved the problem after the computer wakes up from suspend mode.

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Upgraded > Samba no longer listening on 192.168.0.x

Winfried
Problem solved: After waking up from suspend mode, the Debian host acting as home NAS is listed in Windows' Network Neighborhood.

========
root@debian:~# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      390/sshd
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      1706/smbd
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      1706/smbd
tcp6       0      0 :::22                   :::*                    LISTEN      390/sshd
tcp6       0      0 :::445                  :::*                    LISTEN      1706/smbd
tcp6       0      0 :::139                  :::*                    LISTEN      1706/smbd
udp        0      0 0.0.0.0:52216           0.0.0.0:*                           741/dhclient
udp        0      0 0.0.0.0:68              0.0.0.0:*                           741/dhclient
udp        0      0 192.168.0.255:137       0.0.0.0:*                           1663/nmbd
udp        0      0 192.168.0.7:137         0.0.0.0:*                           1663/nmbd
udp        0      0 0.0.0.0:137             0.0.0.0:*                           1663/nmbd
udp        0      0 192.168.0.255:138       0.0.0.0:*                           1663/nmbd
udp        0      0 192.168.0.7:138         0.0.0.0:*                           1663/nmbd
udp        0      0 0.0.0.0:138             0.0.0.0:*                           1663/nmbd
udp6       0      0 :::26459                :::*                                741/dhclient
========
root@debian:~# ps aux | grep mbd
root      1663  0.0  0.5 198628  5720 ?        Ss   May17   0:00 /usr/sbin/nmbd -D
root      1706  0.0  1.4 283172 14200 ?        Ss   May17   0:00 /usr/sbin/smbd -D
root      1719  0.0  0.6 283696  6548 ?        S    May17   0:00 /usr/sbin/smbd -D
root      2372  0.0  0.2  12732  2292 pts/1    S+   11:55   0:00 grep mbd
========
c:\>net view
Server Name            Remark

------------------------------------------
\\DEBIAN               Samba 4.2.14-Debian
The command completed successfully.
========

Thank you all.