Forum

Full Version: Only first device can connect to Samba after restart
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!

Lately I'm having problems with Samba. Only first device can connect to Samba (shared printer or folders) after restart. After the first device have connected, others are getting timeout. This happens on Windows 10, Mac OS and Android clients.

Any suggestions, how to solve this? I think, it started after upgrade to Strech. I did fresh install of latest Xbian, it didn't help.

Log:
Terminal
[2018/01/22 21:56:00.543039, 0] ../source3/smbd/process.c:339(read_packet_remainder)
read_fd_with_timeout failed for client 0.0.0.0 read error = NT_STATUS_CONNECTION_RESET.
[2018/01/22 21:56:00.544912, 0] ../lib/util/pidfile.c:146(pidfile_unlink)
Failed to delete pidfile /var/run/samba/smbd.pid. Error was No such file or directory
[2018/01/22 21:57:26.444669, 0] ../source3/smbd/process.c:339(read_packet_remainder)
read_fd_with_timeout failed for client 0.0.0.0 read error = NT_STATUS_CONNECTION_RESET.
[2018/01/22 21:57:26.446897, 0] ../lib/util/pidfile.c:146(pidfile_unlink)
Failed to delete pidfile /var/run/samba/smbd.pid. Error was No such file or directory
[2018/01/22 21:57:26.981456, 0] ../source3/smbd/smb2_server.c:553(smbd_smb2_request_create)
Invalid SMB packet: first request: 0x0001
[2018/01/22 21:57:54.322461, 0] ../lib/util/pidfile.c:146(pidfile_unlink)
Failed to delete pidfile /var/run/samba/smbd.pid. Error was No such file or directory
[2018/01/22 21:58:28.634564, 0] ../lib/util/pidfile.c:146(pidfile_unlink)
Failed to delete pidfile /var/run/samba/smbd.pid. Error was No such file or directory
[2018/01/22 21:58:29.447338, 0] ../source3/smbd/smb2_server.c:553(smbd_smb2_request_create)
Invalid SMB packet: first request: 0x0001
[2018/01/22 21:59:25.385365, 0] ../lib/util/pidfile.c:146(pidfile_unlink)
Failed to delete pidfile /var/run/samba/smbd.pid. Error was No such file or directory
[2018/01/22 21:59:30.760347, 0] ../lib/util/pidfile.c:146(pidfile_unlink)
Failed to delete pidfile /var/run/samba/smbd.pid. Error was No such file or directory
[2018/01/22 21:59:31.386522, 0] ../source3/smbd/smb2_server.c:553(smbd_smb2_request_create)
Invalid SMB packet: first request: 0x0001


smb.conf:
Terminal
[global]
server string = PI2
guest ok = yes
security = user
socket options = TCP_NODELAY SO_RCVBUF=65535 SO_SNDBUF=65535
registry shares = yes
syslog = 0
map to guest = bad user
workgroup = DZB
bind interfaces only = No
encrypt passwords = true
log level = 0
# smb ports = 445
unix extensions = No
wide links = yes

include = /etc/samba/user.conf
include = /etc/samba/shares.conf

shares.conf:
Terminal
[data]
path = /data
guest ok = no
read only = no
valid users = xbian
browseable = yes
veto files = /._*/.DS_Store/
delete veto files = yes

[printers]
comment = Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = yes
read only = yes
create mask = 0700

[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = no
guest ok = no
After a short test (usually I do not use SAMBA on XBian), I can confirm this issue.

The reason is, smbd process is spawned by inetd process, and this seems not working correctly under Stretch.

For a quick fix, you can

1) disable smbd via inetd: comment out two lines in fild /etc/inetd.conf like this

Code:
###netbios-ssn stream tcp nowait root /usr/sbin/smbd smbd
###microsoft-ds stream tcp nowait root /usr/sbin/smbd smbd

2) comment out RUN_MODE line in file /etc/default/samba

Code:
#RUN_MODE="inetd"

3) make sure that /etc/init/smbd.conf looks like this:

Code:
description "SMB/CIFS File Server"
author      "Steve Langasek <steve.langasek@ubuntu.com>"

start on (local-filesystems and net-device-up)
stop on runlevel [!2345]

respawn

pre-start script
        [ -r /etc/default/samba ] && . /etc/default/samba

        install -o root -g root -m 755 -d /var/run/samba
end script

exec smbd -F

and is not empty

4) reboot
Thanks! Smile
That's awesome.
That is a problem I experienced but I rarely use another laptop for the samba shares so I usually just rebooted the pi.
Reference URL's