Bug 232397 - ctld does not depend on sysctl.conf being evaluated
Summary: ctld does not depend on sysctl.conf being evaluated
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 11.2-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: Edward Tomasz Napierala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-18 17:47 UTC by Mahmoud Al-Qudsi
Modified: 2021-04-05 15:43 UTC (History)
3 users (show)

See Also:


Attachments
Add dependancy on NETWORKING (316 bytes, patch)
2021-01-01 21:09 UTC, Jeremy Faulkner
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mahmoud Al-Qudsi 2018-10-18 17:47:55 UTC
The ctld service does not wait for sysctl.conf to be evaluated before running. 

Unfortunately, the drivers for some popular cards require sysctl configuration in sysctl.conf (not possible in loader.conf) to bring them up in the correct mode (e.g. mlx4/mlx4en to set the card in ip instead of ib mode), meaning that when ctld starts up, it fails immediately because it can't listen on the requested address.

I'm unsure how to modify /etc/rc.d/ctld to enact a dependency on sysctl.conf's evaluation; for my purposes I ended up hacking the ctld service itself to unconditionally execute the sysctls I need set prior to actually processing the service start command.
Comment 1 Jeremy Faulkner 2021-01-01 21:09:36 UTC
Created attachment 221173 [details]
Add dependancy on NETWORKING

If the ctl.conf specifies an IP address then ctld won't start. Adding a requirement on NETWORKING will solve my issue, and your example. What other sysctl's were you using?
Comment 2 Jeremy Faulkner 2021-01-13 01:20:55 UTC
NETWORKING requires netif which requires sysctl
Comment 3 Mahmoud Al-Qudsi 2021-01-13 05:28:23 UTC
Yup. This should do the trick.
Comment 4 Pete French 2021-03-17 14:12:23 UTC
I just hit this as well, not because of sysctl.conf, but because of specifying an IP address in ctld.conf. Can we get the dependency on NETWORKING include din time for 13 ?

Am guessing not, given the timing, but even just getting this fixed in current & stable would be nice...
Comment 5 Pete French 2021-03-17 14:14:09 UTC
BTW, having the bug as "affects only me" is a bit of a mischaracterisation, as this will affect anyone who only wants ctld to listen on a specific IP address wont it ?
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2021-03-17 15:12:51 UTC
(In reply to Pete French from comment #5)
[Speaking for myself here, not as bugmeister@]

I will repeat my usual claim that the "Affects" setting is ... ah ... merely decorative.

In an organization that has paid employees who can be told "prioritze PRs based on the following criteria", such things mean something.

But we aren't such an organization.  I have never heard of any bug triagers that use that field to look for PRs.

If I were some kind of ruthless dictator I'd just turn it off :-)
Comment 7 commit-hook freebsd_committer 2021-04-05 15:43:02 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=015351de04e3e621cff825cc1fdad5faf078c3ac

commit 015351de04e3e621cff825cc1fdad5faf078c3ac
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-04-05 15:40:49 +0000
Commit:     Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2021-04-05 15:40:54 +0000

    rc: make ctld depend on NETWORKING

    This fixes a problem where ctld(8) would refuse to start on boot
    with a specific IP address to listen on configured in ctl.conf(5).
    It also fixes a problem where ctld(8) would fail to start with
    some network interfaces which require a sysctl.conf(5) tweak
    to configure them, eg to switch them from InfiniBand to IP mode.

    PR:             232397
    Reported By:    Mahmoud Al-Qudsi <mqudsi at neosmart.net>
    Submitted By:   Jeremy Faulkner <gldisater at gmail.com>
    Reviewed By:    mav
    Differential Revision:  https://reviews.freebsd.org/D29578

 libexec/rc/rc.d/ctld | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)