Problem with samba

Hello,

I installed the samba package and enabled the smb service to start on boot.

The problem I have is that smb fails to start automatically, but if I restart it it works.
I think the problem is similar to this (I also used nearly the same smb.conf file): Unable to connect to Samba share from virtual machine without restarting smb

The following is the output of systemctl status smb right after boot:

● smb.service - Samba SMB Daemon
Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled)
Active: failed (Result: core-dump) since Fri 2020-10-02 15:05:46 CEST; 19s ago
Docs: man:smbd(8)
man:samba(7)
man:smb.conf(5)
Process: 1373 ExecStart=/usr/sbin/smbd --foreground --no-process-group $SMBDOPTIONS (code=dumped, signal=ABRT)
Main PID: 1373 (code=dumped, signal=ABRT)
Status: “smbd: ready to serve connections…”
CPU: 126ms
ott 02 15:05:46 dhcppc8 smbd[1373]: #4 /usr/lib64/samba/libsmbd-base-samba4.so(+0x240a97) [0x7f651202aa97]
ott 02 15:05:46 dhcppc8 smbd[1373]: #5 /usr/lib64/samba/libsmbd-shim-samba4.so(exit_server+0x18) [0x7f651160d9d8]
ott 02 15:05:46 dhcppc8 smbd[1373]: #6 /usr/sbin/smbd(main+0x135f) [0x55c0bdf581ff]
ott 02 15:05:46 dhcppc8 smbd[1373]: #7 /lib64/libc.so.6(__libc_start_main+0xf2) [0x7f651129c042]
ott 02 15:05:46 dhcppc8 smbd[1373]: #8 /usr/sbin/smbd(_start+0x2e) [0x55c0bdf58d9e]
ott 02 15:05:46 dhcppc8 smbd[1373]: [2020/10/02 15:05:46.450897, 0] …/…/source3/lib/dumpcore.c:317(dump_core)
ott 02 15:05:46 dhcppc8 smbd[1373]: coredump is handled by helper binary specified at /proc/sys/kernel/core_pattern
ott 02 15:05:46 dhcppc8 smbd[1373]:
ott 02 15:05:46 dhcppc8 systemd[1]: smb.service: Main process exited, code=dumped, status=6/ABRT
ott 02 15:05:46 dhcppc8 systemd[1]: smb.service: Failed with result ‘core-dump’.

Then if I restart smb with sudo systemctl restart smb it works, and from the output of systemctl status smb I can see that it’s active.

Do anybody know why smb fails to start automatically and how to solve it? Thank you.

2 Likes

I cannot reproduce the issue with the default Samba service configuration.

This race condition is most likely related to your specific configuration:

sudo testparm -s

Thanks for your help, this is the output:

Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Server role: ROLE_STANDALONE
'# Global parameters
[global]
bind interfaces only = Yes
interfaces = virbr0
map to guest = Bad User
printcap name = cups
security = USER
workgroup = SAMBA
idmap config * : backend = tdb
[printers]
browseable = No
path = /var/spool/samba
printable = Yes
[LinuxHost]
comment = Host SAMBA Server for VM
create mask = 0777
directory mask = 0777
force group = nobody
force user = nobody
guest ok = Yes
path = /home/lorenzo/WindowsVM-Condivisi
read only = No

1 Like

Interface/socket binding is problematic due to race conditions.
The easiest way to resolve the issue is to avoid using interface/socket binding.
Instead, you can utilize firewall to manage network access permissions.

2 Likes

I confirm that removing the line bind interfaces only = Yes solved the issue.
Thank you @vgaetera!

3 Likes