Every now and then my Samba share stops working.
$ smbclient -U sambauser '\\192.168.12.11\Apartment'
do_connect: Connection to 192.168.12.11 failed (Error NT_STATUS_CONNECTION_REFUSED)
This is incredibly annoying, since it happens somewhat frequently too. I restart the container, with no fix. It might be client-side, but I’m boggled by how that could even occur. There are no logs in systemd for smbd. The firewall is disabled.
/etc/samba/smb.conf: https://pastebin.com/HNgw8YcV
Make sure it’s not trying to use 1.0.
This is kind of embarrassing, but I had a bunch of samba issues that went away when I made a “touch heartbeat.txt” on the mount every three minutes in my crontab. It was timing out and not re-establishing the connection reliably, so screw it. Never stops sending a miniscule bit of data every few minutes. Solved. Been running that way for like five years!
I also “fixed” a slow memory leak on a process by restarting the process every night at 1am in my crontab too! I’m the worst kind of admin.
I think it has something to do with KDE not killing smbnotifier processes. If I kill the Samba daemon, I notice a ton of TCP traffic as the processes try to reset connections, then eventually terminating. If I then start the daemon again, those processes disappear and I can access the share through Dolphin.
I’m going to need a lot more to help you
What do the logs say? What version of Samba are you running? What is in between you and the file server?
Check the log file & see if there’s any additional information you can troubleshoot with. According to your .conf it’s in /var/log/samba/log.%m
And/or maybe increase the logging level and hopefully when the issue re-occurs you’ll have lots more log info to work with. (may have to be careful with the log file sizes though) Not sure if you need to enable client specific logging or maybe just working with the main smb.conf file is enough, see the wiki
https://wiki.samba.org/index.php/Client_specific_logging
EDIT: If you’re not already seeing any logs maybe you do need to try enabling client specific logging (?)
Connection refused is generally a network level issue meaning that a firewall is rejecting the tcp handshake, or more likely samba is not listening on that IP.
So you are attempting to connect to your samba server and the OS (not Samba) is saying there is no service running on that port so I am refusing your connection request.
So you have one of these problems
- Samba isn’t running in the first place
- Samba is crashing, systemd might be restarting it so if this problem is intermittent this is most likely
- you have firewall issues (you said firewall was off, but are they on the same subnet? Might be other firewalls in your network rejecting the connection?)
- Samba is listening on a different interface. I see you have lo/eth0 in your config most distros don’t use eth0 anymore are you sure that is correct?
Even if those interface names are correct sometimes network managers rename interfaces. So when Samba starts that might be the wrong interface name, but by the time you login it is correct. I would just remove that line and the bind interfaces only line as well unless you specifically need to bind to specific interfaces.
Try connecting to samba from the server itself on 127.0.0.1, which will probably work just fine because lo is probably a correct interface.
You can also look at what interfaces/IP samba is listening on by running one of these commands as root
ss -tlp | grep 445
netstat -nlp | grep 445