Created attachment 270130 [details] symbolic link mitigation for connection refused on rpc calls The samba-dcerpcd creating the socket on the /var/run/samba4/ncalrpc/np/epmapper location, but the smbd is looking for it on the /var/run/samba4/ncalrpc/EPMAPPER location, which causing "Connection refused" problem in rpc calls. This behavior is observed when rpc_server:epmapper = external is present in the smb4.conf file. If the mitigation of the problem (creating symbolic links) is not handled correctly, the connection will fail. [2026/04/25 00:50:39.989266, 1] ../../source3/rpc_client/cli_pipe.c:3016(rpc_pipe_open_ncalrpc) rpc_pipe_open_ncalrpc: connect(/var/run/samba4/ncalrpc/EPMAPPER) failed: Connection refused [2026/04/25 00:50:41.690407, 1] ../../source3/rpc_server/rpc_host.c:1763(rpc_worker_exited) rpc_worker_exited: No worker with PID 53974 [2026/04/25 00:50:41.706210, 1] ../../source3/rpc_server/rpc_host.c:1763(rpc_worker_exited) rpc_worker_exited: No worker with PID 53973 For fast mitigation see the rc.local file enclosed.
Does this happen with a newer version of Samba? 4.19 at least?
(In reply to Michael Osipov from comment #1) Did not try 4.19. Always using default package from pkg which is 416 for FreeBSD 14.4. So I did not check the source if there is any change regarding the socket path from 416 -> 419.
(In reply to Vadler Gábor from comment #2) If you can have a try with samba 4.23 as well :)
(In reply to Xavier Beaudouin from comment #3) Test results for Samba 4.19.9_12 on FreeBSD 14.4: I have upgraded to net/samba419 as requested. The issue persists exactly as in 4.16. Steps taken: Upgraded to samba419-4.19.9_12. Removed my manual symlink workaround. Restarted samba_server. Observations: ls -l /var/run/samba4/ncalrpc/ only shows the np directory. smbd still expects the EPMAPPER socket at /var/run/samba4/ncalrpc/EPMAPPER. ls -l /var/run/samba4/ncalrpc/ file -L /var/run/samba4/ncalrpc/EPMAPPER total 1 drwx------ 2 root wheel 2 ápr. 27 17:40 np /var/run/samba4/ncalrpc/EPMAPPER: cannot open `/var/run/samba4/ncalrpc/EPMAPPER' (No such file or directory) Conclusion: Upgrading to 4.19 (after that I've tried also 4.23.6_1, so as the port logic remains the same) does not resolve the path mismatch between samba-dcerpcd and smbd on FreeBSD. The manual symlink workaround is still required for functional RPC services in standalone mode with rpc_server:epmapper = external.
Is there any chance for a fix for this external epmapper bug?
Apologies, it took too long to respond. I am currently looking into it. Though, I am not yet done I have the feeling that this needs to be reported upstream....
I've done further investigation together with Claude (AI assistant), tracing Samba's source (identical across 4.19.0–4.24.0) and reproducing directly on my box. Important clarification on my setup: this is a domain-joined member server (security = ADS), not a standalone server and not an AD DC. My problem, stated plainly: I cannot find any Samba configuration that causes it to bind an NCALRPC listener at EPMAPPER. smbd's own RPC client code (source3/rpc_client/cli_pipe.c, rpc_pipe_get_ncalrpc_name()) hardcodes an expectation that a flat Unix socket exists at <ncalrpc dir>/EPMAPPER, and epmapper's IDL (librpc/idl/epmapper.idl) declares it should listen on ncalrpc:[EPMAPPER] among other transports. Despite that, I cannot get any running configuration to actually create this socket. Verified with sockstat (kernel-level socket table, not just a directory listing) against samba-dcerpcd with rpc_server:epmapper = external set and the daemon confirmed alive: # sockstat -46ul | grep samba-dcer root samba-dcer 66750 5 dgram /var/db/samba4/private/msg.sock/66750 root samba-dcer 66750 12 udp4 *:946 *:* root samba-dcer 66750 20 stream /var/run/samba4/ncalrpc/np/srvsvc root samba-dcer 66750 22 stream /var/run/samba4/ncalrpc/np/epmapper root samba-dcer 66750 23 stream /var/run/samba4/ncalrpc/np/fssagentrpc ... (all other interfaces, all under np/, none flat) No flat EPMAPPER socket is present anywhere in the daemon's open socket table. This is consistent regardless of: - rpc_server:epmapper unset (default/embedded) - rpc_server:epmapper = external, with samba-dcerpcd confirmed running via procstat (ruling out a stale pidfile) - Removing and re-adding the setting and restarting samba_server fresh each time I also reproduced the client-side symptom directly with truss: socket(PF_LOCAL,SOCK_STREAM,0) = 6 (0x6) connect(6,{ AF_UNIX "/var/run/samba4/ncalrpc/EPMAPPER" },106) ERR#2 'No such file or directory' via rpcclient -c 'epmmap' ncalrpc:, which is the exact code path producing the "Connection refused"/"No such file" errors in the original report. Likely mechanism: source3/rpc_server/rpc_host.c's rpc_host_serve_endpoint() contains this comment: /* * In member mode, we only serve named pipes. Indicated by NCACN_NP * passed in via "only_transport". */ This appears to describe exactly my situation — a domain member server. If samba-dcerpcd is invoked in this "member mode" (only_transport = NCACN_NP) whenever the server role is domain member rather than standalone/AD DC, that would explain why the NCALRPC binding for epmapper (and presumably any other interface) never gets a socket created, regardless of the rpc_server:epmapper setting — the transport is filtered out before socket creation is even attempted. If that's correct, this may be working as intended for member servers from Samba's perspective (i.e., member servers aren't expected to expose NCALRPC sockets at all) — in which case the actual bug might be elsewhere (e.g., rpc_pipe_open_ncalrpc() incorrectly assuming an NCALRPC socket should exist even on a member server, when it structurally never will). I don't have enough visibility into the intended design to say which side is "wrong," but the two pieces of code clearly disagree with each other in my configuration. Notes: - Not FreeBSD-specific as far as I can tell — none of the relevant code (rpc_sock_helper.c, rpc_host.c, cli_pipe.c) has platform-conditional branches. - rpc_server:epmapper and its accepted values are undocumented in smb.conf.5, so there's no specification to verify "correct" behavior against. Given the symlink workaround already posted here works, and the mechanism appears to be generic (non-FreeBSD-specific) Samba behavior tied to server role, this may need to go to bugzilla.samba.org for someone with deeper knowledge of the samba-dcerpcd/RPC-host code to confirm whether member-mode NCALRPC suppression is intentional — happy to file it there and cross-reference if useful. Can you provide exact config how to reproduce?
One more piece of evidence worth adding: I checked whether rpcclient's ncalrpc: handling (source3/rpc_client/cli_pipe.c, rpc_pipe_open_ncalrpc()/rpc_pipe_get_ncalrpc_name()) has any awareness of server role at all, since my earlier comment suggested samba-dcerpcd's member-mode NCACN_NP-only filtering might explain the missing socket. It doesn't. rpc_pipe_open_ncalrpc()'s signature is: NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const struct ndr_interface_table *table, struct rpc_pipe_client **presult) No role/mode parameter, and neither this function nor rpcclient.c's calling code (rpccli_ncalrpc_connect()) reference lp_server_role() or any ROLE_* check anywhere. It's an unconditional connect attempt to <ncalrpc dir>/EPMAPPER, regardless of what kind of server this is. So this isn't two role-aware pieces of code disagreeing on the details — it's an asymmetric situation: the server side (rpc_host.c's rpc_host_serve_endpoint()) explicitly knows about and acts on server role/mode ("in member mode, we only serve named pipes"), while the client side has no concept of server mode whatsoever and just assumes the NCALRPC socket should be there. That makes me lean towards this being a real gap on the client side, rather than working-as-intended: either rpc_pipe_open_ncalrpc()/its callers should check the server role before assuming an NCALRPC socket exists, or should fall back to NCACN_NP when it doesn't, rather than failing outright with ECONNREFUSED/ENOENT.
(In reply to Michael Osipov from comment #7) My config is rather simple. Have a FreeBSD Standalone Samba Master server with user security auth with tdbsam passdb backend. I have mostly Windows and Android cients. I would be happy if You would have the time to make a report at bugzilla.samba.org