Bug 288593 - sysutils/slurm-wlm 23.11.7 fails to start with slurmctld: error: Error binding slurm stream socket: Invalid argument
Summary: sysutils/slurm-wlm 23.11.7 fails to start with slurmctld: error: Error bindin...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Thierry Thomas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-08-01 16:22 UTC by Generic Rikka
Modified: 2025-09-25 16:14 UTC (History)
1 user (show)

See Also:


Attachments
patch to fix wrong socket_length (1.50 KB, text/plain)
2025-08-01 16:22 UTC, Generic Rikka
no flags Details
Patches Makefile and pkg-plist to create /var/spool/slurmctld at install time (1.21 KB, patch)
2025-08-02 18:42 UTC, Generic Rikka
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Generic Rikka 2025-08-01 16:22:17 UTC
Created attachment 262625 [details]
patch to fix wrong socket_length

I tried to install slurm-wlm 23.11.7 on FreeBSD-14.3-RELEASE-p1 but when trying to start slurmctld via "slurmctld -Dvvv -f [config-file]" i got the error:
slurmctld: debug:  slurmctld log levels: stderr=debug2 logfile=quiet syslog=quiet
slurmctld: debug:  Log file re-opened
slurmctld: pidfile not locked, assuming no running daemon
slurmctld: debug:  auth/munge: init: loaded
slurmctld: debug:  hash/k12: init: init: KangarooTwelve hash plugin loaded
slurmctld: error: Error binding slurm stream socket: Invalid argument
slurmctld: fatal: slurm_init_msg_engine_port: error Invalid argument

I identified the problem to be inside of the slurm_init_msg_engine() function inside of src/common/slurm_protocol_socket.c
It seemed like the function was trying to set an invalid socket_length when calling the bind() function. I came up with the patch i attached. Adding the patch to sysutils/slurm-wlm/files was able to fix the issue for me.
Comment 1 Generic Rikka 2025-08-01 16:38:39 UTC
I would also like to ask for adoption of this port, since i got the message that it does not currently have a maintainer and i am generally interested in having this software on FreeBSD.
So of you are happy with my patch and are still looking for a maintainer for this port, i would be happy to hear from you.
Comment 2 Thierry Thomas freebsd_committer freebsd_triage 2025-08-02 10:51:26 UTC
Not related to your patch, but I remember that previously I had to create manually the directory /var/spool/slurmctld .

Not sure about the exact permission, but something like
@dir(%%USERS%%,%%GROUPS%%,700) /var/spool/slurmctld
should be added to pkg-plist.

with
PLIST_SUB=	USERS=${USERS} GROUPS=${GROUPS}
to the Makefile.

What do you think?
Comment 3 Generic Rikka 2025-08-02 17:20:46 UTC
(In reply to Thierry Thomas from comment #2)
You are right, i also had to create /var/spool/slurmctld and set correct permissions in order for slurmctld to start. Adding it to pkg-plist and makefile would make the port a lot more user friendly.
If you don't already have a patch, i could come up with one and test it on my FreeBSD instances.
After this, at least slurmctld should work fine, but slurmd seems to need some patching too, since it is trying to involve cgroups, which is not available on FreeBSD, but that is unrelated to this bug.
Comment 4 Thierry Thomas freebsd_committer freebsd_triage 2025-08-02 17:34:56 UTC
Yes, please, a patch would be nice: I don't have a patch myself because I don't know the minimal permissions for these directories. I just created them manually when I worked on this port some times ago.
Comment 5 Generic Rikka 2025-08-02 18:42:31 UTC
Created attachment 262641 [details]
Patches Makefile and pkg-plist to create /var/spool/slurmctld at install time

Also sets owner of the directory to slurm:slurm and sets permissions to 700
Comment 6 Generic Rikka 2025-08-02 18:49:38 UTC
I created a patch file, which adds "PLIST_SUB+= USERS=${USERS} GROUPS=${GROUPS}" and also "@${MKDIR} ${STAGEDIR}/var/spool/slurmctld @${CHOWN} ${USERS}:${GROUPS} ${STAGEDIR}/var/spool/slurmctld @${CHMOD} 700 ${STAGEDIR}/var/spool/slurmctld" to post-install: of Makefile (since Make complained about the directory not being present in the staging directory). The patch also adds "@dir(%%USERS%%,%%GROUPS%%,700) /var/spool/slurmctld" to pkg-plist. These changes seemed to be enough to create the directory at install time and set correct permissions.
I added the patch file to the attachments.
Should i create another issue about the directory not being created at install time and link it to this one?
Comment 7 Generic Rikka 2025-08-02 20:24:54 UTC
Created bug #288612 to satisfy 1 bug per report policy, this bug can be fixed by applying the Patch for Makefile and pkg-plist in attachments
Comment 8 Thierry Thomas freebsd_committer freebsd_triage 2025-08-03 14:03:39 UTC
Committed, thanks!

(Please do not forget to submit your fix to upstream:
https://support.schedmd.com/ )
Comment 9 commit-hook freebsd_committer freebsd_triage 2025-08-03 14:04:11 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=102f62ebb37a34b8963c0ebf89ccb5877da7f956

commit 102f62ebb37a34b8963c0ebf89ccb5877da7f956
Author:     Generic Rikka <rikka.goering@outlook.de>
AuthorDate: 2025-08-02 13:13:34 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2025-08-03 14:02:33 +0000

    sysutils/slurm-wlm: fix slurmctld

    PR:             288593

 sysutils/slurm-wlm/Makefile                        |  2 +-
 ...atch-src_common_slurm__protocol__socket.c (new) | 43 ++++++++++++++++++++++
 .../slurm-wlm/files/patch-src_interfaces_cgroup.c  |  6 +--
 3 files changed, 47 insertions(+), 4 deletions(-)
Comment 10 Generic Rikka 2025-08-04 20:07:16 UTC
Upstream submission opened at SchedMD:
https://support.schedmd.com/show_bug.cgi?id=23388

Will update here once they respond.
Comment 11 commit-hook freebsd_committer freebsd_triage 2025-09-01 14:43:22 UTC
A commit in branch 2025Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c7a17f74b19b62b66ea7499fe86b07b4ef9edc63

commit c7a17f74b19b62b66ea7499fe86b07b4ef9edc63
Author:     Generic Rikka <rikka.goering@outlook.de>
AuthorDate: 2025-08-02 13:13:34 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2025-09-01 14:42:25 +0000

    sysutils/slurm-wlm: fix slurmctld

    PR:             288593
    (cherry picked from commit 102f62ebb37a34b8963c0ebf89ccb5877da7f956)

 sysutils/slurm-wlm/Makefile                        |  2 +-
 ...atch-src_common_slurm__protocol__socket.c (new) | 43 ++++++++++++++++++++++
 .../slurm-wlm/files/patch-src_interfaces_cgroup.c  |  6 +--
 3 files changed, 47 insertions(+), 4 deletions(-)
Comment 12 Generic Rikka 2025-09-17 00:00:07 UTC
Just a short update: upstream has reviewed the patch and is looking into applying it, potentially across all BSD variants.  
So it looks likely this fix will not remain FreeBSD-local in the long term.  
I will update about further movement in the upstream PR.
Comment 13 Thierry Thomas freebsd_committer freebsd_triage 2025-09-17 07:06:13 UTC
(In reply to Generic Rikka from comment #12)
Great! Very good news :-)
Comment 14 Generic Rikka 2025-09-17 22:17:29 UTC
Upstream update:

The Slurm developers have reviewed the socket patch and reworked it into a
cleaner form that applies across FreeBSD, NetBSD, and OpenBSD. I will be
testing this new version on FreeBSD shortly, and they have asked for broader
BSD testing as well.

They also confirmed that replacing cgroups.c with stub functions on *BSD is
the approach they are interested in. This aligns with the direction they are
taking internally, so it looks like Slurm upstream is now beginning to actively
consider BSD portability beyond just one-off fixes.

This means our local patches are very likely to be reduced over time as these
changes make their way into mainline Slurm.
Comment 15 Generic Rikka 2025-09-25 16:14:45 UTC
Upstream has merged the fix for this issue in commit d9f8f18f03 (see https://github.com/SchedMD/slurm/commit/d9f8f18f03), which will be included in Slurm 25.11.0rc1 and later.

With this, the patch in our port can be retired once we update to that release.

Many thanks to the SchedMD team for the quick review and merge.