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.
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.
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?
(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.
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.
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
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?
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
Committed, thanks! (Please do not forget to submit your fix to upstream: https://support.schedmd.com/ )
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(-)
Upstream submission opened at SchedMD: https://support.schedmd.com/show_bug.cgi?id=23388 Will update here once they respond.
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(-)
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.
(In reply to Generic Rikka from comment #12) Great! Very good news :-)
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.
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.