Samba nmbd Error ERRNO=No buffer space available on FreeBSD – Cause and Fix
While setting up a Samba file server on FreeBSD, I noticed an annoying quirk: shared folders worked fine, yet dmesg -a and the system logs kept filling up with UDP packet errors from nmbd.
In short: neither the network card nor the firewall was broken – the culprit was an old router IP address left behind in /etc/hosts.
What Errors Appeared in the nmbd Logs
Every few minutes, nmbd complained that it could not send NetBIOS broadcast packets over UDP ports 137 and 138:
Apr 12 17:02:29 router nmbd[9616]: Packet send failed to 192.168.5.255(137) ERRNO=No buffer space available Apr 12 17:02:29 router nmbd[9616]: [2009/04/12 17:02:29, 0] nmbd/nmbd_packets.c:send_netbios_packet(163) Apr 12 17:02:29 router nmbd[9616]: send_netbios_packet: send_packet() to IP 192.168.5.255 port 137 failed Apr 12 17:02:29 router nmbd[9616]: [2009/04/12 17:02:29, 0] nmbd/nmbd_namequery.c:query_name(245) Apr 12 17:02:29 router nmbd[9616]: query_name: Failed to send packet trying to query name ROUTER Apr 12 17:03:29 router nmbd[9616]: [2009/04/12 17:03:29, 0] libsmb/nmblib.c:send_udp(793) Apr 12 17:03:29 router nmbd[9616]: Packet send failed to 192.168.5.255(138) ERRNO=No buffer space available
Since the server wasn’t in production yet, I took time to dig in. My first suspect was the firewall – yet even with every firewall rule wide open, the nmbd errors kept scrolling. Online threads blamed faulty NIC drivers, mbuf exhaustion, Samba bugs, or blocked ports, until a post on an English forum suggested checking DNS and /etc/hosts resolution for the NetBIOS hostname configured in smb.conf (in my case, ROUTER).
Why ping ROUTER Returned No buffer space available
Running ping ROUTER gave a surprising clue: FreeBSD immediately printed No buffer space available, and after a reboot reported 100% packet loss with zero replies. On FreeBSD, ENOBUFS commonly triggers when the stack tries to transmit packets to a local-subnet IP whose MAC address never resolves via ARP, filling the ARP hold queue.
One look inside /etc/hosts revealed everything. Earlier I had changed the router’s IP from 192.168.5.2 to 192.168.5.1, and late at night I copied an adjacent line in hosts without noticing the stale address:
192.168.5.2 ROUTER
Because of that single typo, the server kept trying to reach ROUTER at the retired 192.168.5.2 address, stalled on unresolved ARP, and flooded the console with No buffer space available.
How It Was Fixed
Updating the entry in /etc/hosts to the current IP:
192.168.5.1 ROUTER
cleared the problem right away – the nmbd warnings vanished from dmesg completely. Whenever ERRNO=No buffer space available shows up alongside NetBIOS errors on FreeBSD, spending a minute checking /etc/hosts and running ping against the server’s own hostname saves hours of unnecessary firewall and driver debugging.
