xref: /freebsd/usr.sbin/sysconf/sysconf.8 (revision c4fde87a3236b500246d4fce76dbca2a3d64f73a)
1.\" Copyright (c) 2013-2026 Devin Teske <dteske@FreeBSD.org>
2.\" Copyright (c) 2021-2026 Faraz Vahedi <kfv@FreeBSD.org>
3.\"
4.\" SPDX-License-Identifier: BSD-2-Clause
5.\"
6.Dd September 23, 2026
7.Dt SYSCONF 8
8.Os
9.Sh NAME
10.Nm sysconf
11.Nd read and modify system configuration files
12.Sh SYNOPSIS
13.Nm
14.Ar target
15.Op Fl AcDeFinNqsvVx
16.Op Fl j Ar jail | Fl R Ar dir
17.Op Fl f Ar file | Fl k Ar module
18.Ar name Ns Op Ns Oo +|- Oc Ns = Ns Ar value
19.Ar ...
20.Nm
21.Ar target
22.Op Fl ADeFnNqvV
23.Op Fl j Ar jail | Fl R Ar dir
24.Op Fl f Ar file | Fl k Ar module
25.Fl a
26.Nm
27.Ar target
28.Op Fl AaDinNq
29.Op Fl j Ar jail | Fl R Ar dir
30.Fl d
31.Op Ar name ...
32.Nm
33.Ar target
34.Op Fl E
35.Op Fl j Ar jail | Fl R Ar dir
36.Op Fl k Ar module
37.Fl l | L
38.Nm
39.Cm rc
40.Op Ar sysrc_argument ...
41.Nm
42.Cm poudriere
43.Op Fl Fl jail Ar name
44.Op Fl Fl ports Ar name
45.Op Fl Fl tree Ar name
46.Op Fl Fl set Ar name
47.Op Ar sysrc_argument ...
48.Nm
49.Cm poudriere
50.Bro Cm make Ns | Ns Cm src Ns | Ns Cm src-env Brc
51.Op Fl ceFinNqsvVx
52.Op Fl Fl jail Ar name
53.Op Fl Fl ports Ar name
54.Op Fl Fl tree Ar name
55.Op Fl Fl set Ar name
56.Op Fl j Ar jail | Fl R Ar dir
57.Op Fl f Ar file
58.Ar name Ns Op Ns Oo +|- Oc Ns = Ns Ar value
59.Ar ...
60.Nm
61.Cm poudriere
62.Bro Cm make Ns | Ns Cm src Ns | Ns Cm src-env Brc
63.Op Fl eFnNqvV
64.Op Fl Fl jail Ar name
65.Op Fl Fl ports Ar name
66.Op Fl Fl tree Ar name
67.Op Fl Fl set Ar name
68.Op Fl f Ar file
69.Fl a
70.Nm
71.Cm poudriere
72.Bro Cm make Ns | Ns Cm src Ns | Ns Cm src-env Brc
73.Op Fl E
74.Op Fl Fl jail Ar name
75.Op Fl Fl ports Ar name
76.Op Fl Fl tree Ar name
77.Op Fl Fl set Ar name
78.Op Fl f Ar file
79.Fl l | L
80.Sh DESCRIPTION
81The
82.Nm
83utility reads and modifies the system configuration files of the base
84system,
85completing the native configuration trinity alongside
86.Xr sysctl 8
87.Pq kernel state
88and
89.Xr sysrc 8
90.Pq Xr rc.conf 5 .
91The first positional argument selects a
92.Ar target
93keyword
94.Pq or a unique prefix of one; see Sx TARGETS ;
95options are equally accepted before it.
96Each target is documented on its own page
97.Pq see Sx TARGETS ;
98shared options and assignment syntax are documented here.
99.Ss Assignment syntax
100A
101.Ar name
102alone reads the current value of the directive,
103while
104.Ar name Ns = Ns Ar value
105atomically writes it.
106Writes echo
107.Ql name: old -> new
108when the stored value changes,
109or
110.Ql name: value (unchanged)
111when it is already set as requested
112.Pq the file is left untouched in that case .
113With
114.Fl e
115those echoes use
116.Ql name=...
117instead of
118.Ql name: ...
119.Pq matching read output .
120The echo is suppressed by
121.Fl q ;
122.Fl c
123writes nothing to stdout.
124A directive not previously set anywhere shows an empty old value.
125.Pp
126On the
127.Cm make
128and
129.Cm src
130targets, a
131.Ql WITH_*
132or
133.Ql WITHOUT_*
134build knob
135.Pq presence matters; Xr src.conf 5 ignores the value
136is shown as
137.Ql name (present)
138when defined
139.Po
140any value, including
141.Ql =
142or
143.Ql =t
144.Pc ,
145rather than printing the value after the colon;
146.Fl e
147prints the real assignment
148.Po
149e.g.
150.Ql name=
151or
152.Ql name=t
153.Pc ,
154and
155.Fl n
156prints that same value alone
157.Pq empty when the assignment is Ql name= .
158Setting such a knob with
159.Fl s
160echoes
161.Ql name: (not present) -> (present)
162.Po
163or
164.Ql (present) (unchanged)
165when it is already defined
166.Pc .
167An explicit
168.Ar name Ns =
169.Pq including empty
170always writes the requested value;
171a change of placeholder while the knob stays defined echoes
172.Ql name: old -> new
173like other assignments.
174A write of
175.Ql WITH_ Ns Ar foo Ns =no
176.Pq exact lowercase Ql no
177is still performed but warns to use
178.Ql WITHOUT_ Ns Ar foo Ns =1
179instead.
180That message matches
181.Pa share/mk/bsd.mkopt.mk
182and is emitted here as a precursor so a bad
183.Xr make.conf 5
184or
185.Xr src.conf 5
186assignment is caught at write time.
187The same advisory is printed on reads
188.Po
189named queries and
190.Fl a
191dump
192.Pc ,
193with
194.Ql file:line:
195when the authoritative statement is known, so an existing
196.Ql WITH_* Ns =no
197is not overlooked when presence display shows only
198.Ql (present) .
199.Fl q
200suppresses the read-time form.
201.Xr make 1
202itself typically warns later during a
203.Pa /usr/src
204build, when
205.Pa bsd.opts.mk
206.Pq or Pa src.opts.mk
207reloads
208.Pa bsd.mkopt.mk
209for recognized options such as
210.Va MANCOMPRESS .
211The same
212.Xr make.conf 5
213line stays silent for a bare
214.Xr make 1
215.Pq e.g. Fl C Pa /tmp
216or for ports, which do not run that option pass.
217.Ql WITHOUT_* Ns =no ,
218.Ql WITH_* Ns =NO ,
219and other values do not warn here or there.
220.Va WITHOUT_MODULES
221is not a presence knob
222.Pq its value is a module list
223and is excluded from
224.Fl s
225and presence display.
226.Pp
227For directives whose value is a space-separated list
228.Po
229.Va kld_list Ns -style ;
230see for example
231.Va kernels
232in
233.Xr loader.conf 5
234.Pc ,
235.Ar name Ns += Ns Ar word
236appends each given word not already present and
237.Ar name Ns -= Ns Ar word
238strikes each given word,
239after the fashion of
240.Xr sysrc 8 .
241Striking words from a directive set nowhere is reported like any other
242unknown directive.
243.Pp
244For
245.Xr make 1 Ns -syntax
246targets
247.Po
248.Cm make
249and
250.Cm src ;
251see
252.Xr sysconf-make 8
253and
254.Xr sysconf-src 8
255.Pc ,
256.Ql +=
257is instead the
258.Xr make 1
259append operator and
260.Ql -=
261strikes words from the last matching assignment fragment.
262.Pp
263Files are never modified in place:
264updates are streamed to a temporary file which is flushed to stable storage
265and atomically renamed over the target
266.Pq see Xr bsdconf_put 3 .
267How multi-file targets choose the file to read or rewrite is documented in
268.Xr sysconf-targets 8 .
269.Sh TARGETS
270The following target keywords are supported:
271.Bl -tag -width indent
272.It Cm loader
273Boot loader configuration
274.Pq Xr loader.conf 5 .
275See
276.Xr sysconf-loader 8 .
277.It Cm sysctl
278Kernel state set at boot
279.Pq Xr sysctl.conf 5 .
280See
281.Xr sysconf-sysctl 8 .
282.It Cm make
283System-wide
284.Xr make 1
285settings
286.Pq Pa /etc/make.conf .
287See
288.Xr sysconf-make 8 .
289.It Cm src
290The
291.Pa /usr/src
292build triad
293.Pq Pa src-env.conf , make.conf , src.conf .
294See
295.Xr sysconf-src 8 .
296.It Cm rc
297Pass-through to
298.Xr sysrc 8 .
299See
300.Xr sysconf-rc 8 .
301.It Cm poudriere
302.Pa poudriere.conf
303collection via
304.Xr sysrc 8 ;
305.Cm poudriere make ,
306.Cm poudriere src ,
307and
308.Cm poudriere src-env
309for the
310.Xr make 1
311overlays under
312.Pa poudriere.d .
313See
314.Xr sysconf-poudriere 8 .
315.It Cm generic
316Foreign or unknown format;
317requires
318.Fl f .
319See
320.Xr sysconf-generic 8 .
321.El
322.Pp
323A unique prefix of a target keyword is accepted:
324.Ql sy
325selects
326.Cm sysctl
327and
328.Ql sr
329selects
330.Cm src .
331.Ql s
332matches both and is rejected with a list of matches.
333An exact keyword always wins.
334Prefix matching is case-sensitive and applies to the start of the keyword
335only, so
336.Ql ctl
337does not select
338.Cm sysctl .
339.Pp
340Cross-cutting rules for multi-file sourcing,
341defaults,
342and where writes versus removals land are in
343.Xr sysconf-targets 8 .
344Built-in format descriptors and file-list discovery are in
345.Xr bsdconf_format 3 .
346.Sh OPTIONS
347The options are as follows:
348.Bl -tag -width indent
349.It Fl A
350Widen dump scope to include directives still at their system default
351.Po
352named reads always reflect the defaults;
353see
354.Xr sysconf-targets 8
355.Pc .
356With no
357.Ar name
358arguments,
359dumps everything
360.Po
361as
362.Fl a ,
363defaults included
364.Pc .
365.Pp
366Combined with
367.Fl D ,
368the scoping of
369.Fl D
370wins and
371.Fl A
372retains only its dump-implying role,
373so
374.Ql -ADd
375describes all defaults and only defaults,
376as in
377.Xr sysrc 8 .
378Only valid for targets with a defaults file
379.Pq see Xr sysconf-loader 8 .
380.It Fl a
381Dump all configured directives from the target:
382the union of the target's files,
383wherein directives in later files override earlier ones.
384Directives whose value still comes from the defaults file alone are out
385of scope
386.Pq widen with Fl A .
387.It Fl c
388Check mode.
389For each
390.Ar name Ns = Ns Ar value
391argument,
392compare the effective value against
393.Ar value
394without modifying any file
395.Po
396with
397.Fl x ,
398check that
399.Ar name
400is absent
401.Pc .
402Exit with success if no changes would be required,
403else error.
404.It Fl D
405Consult only the target's defaults file,
406reporting the system default value of each
407.Ar name
408.Po
409or, with
410.Fl a ,
411dumping every default
412.Pc .
413Defaults are read-only;
414combining
415.Fl D
416with an assignment is an error.
417Only valid for targets with a defaults file
418.Pq see Xr sysconf-loader 8 .
419.It Fl d
420Show the description of each
421.Ar name
422instead of its value.
423.Pp
424For targets with a defaults file,
425the description is the inline comment trailing the directive's default
426assignment,
427continued across subsequent lines of whitespace followed by a comment
428character.
429A commented-out default
430.Pq e.g., Ql #comconsole_speed=\(dq115200\(dq # Set the ...
431still yields its description.
432For the
433.Ql sysctl
434target,
435descriptions come from the running kernel
436.Po
437as with
438.Xr sysctl 8
439.Fl d ;
440see
441.Xr sysconf-sysctl 8
442.Pc .
443.Pp
444Combined with
445.Fl a ,
446.Fl A ,
447or
448.Fl D ,
449dumps the description of every directive in scope
450.Po
451of the configured directives,
452of everything defaults included,
453or of the defaults alone,
454respectively
455.Pc ,
456after the fashion of
457.Xr sysrc 8
458.Fl \&Ad .
459A directive the defaults never mention prints an empty description.
460.It Fl E
461With
462.Fl l
463or
464.Fl L ,
465list only files that exist on disk.
466.It Fl e
467Print values in
468.Ar name Ns = Ns Ar value
469format,
470suitable for feeding back into the configuration file.
471Applies to both reads and the informational echo from assignments
472.Po
473replacing the default
474.Ql name: value
475form;
476changed writes use
477.Ql name=old # -> new ,
478matching
479.Xr sysrc 8
480.Pc .
481For the
482.Ql loader
483target the value is quoted.
484.It Fl F
485Show the pathname of the file holding each directive's effective
486.Pq authoritative
487value instead of the value itself.
488For a directive still at its system default,
489this truthfully names the defaults file.
490.It Fl f Ar file
491Operate on
492.Ar file ,
493in the format of the
494.Ar target
495keyword,
496instead of the target's standard files;
497mutually exclusive with
498.Fl k .
499For read operations
500.Ar file
501may be a non-seekable stream
502.Po
503a fifo or
504.Pa /dev/stdin ,
505for example
506.Pc ;
507write operations require a regular file.
508A
509.Ar file
510of
511.Ql -
512means standard input
513.Pq a synonym for Pa /dev/stdin ,
514exempt from
515.Fl R .
516See
517.Xr sysconf-targets 8
518and
519.Xr sysconf-generic 8 .
520.It Fl h , Fl Fl help
521Print a short usage statement
522.Pq or, for the long form, the full option summary
523to stderr and exit.
524.It Fl Fl version
525Print
526.Nm
527and linked
528.Xr bsdconf 3
529versions and exit.
530.It Fl i
531Ignore unknown names
532.Pq and suppress the warning when writing an unknown sysctl OID .
533.It Fl j Ar jail
534Operate within the jail
535.Ar jail
536.Pq name or numeric id ;
537mutually exclusive with
538.Fl R .
539.It Fl k Ar module
540Include the kernel module drop-in file for
541.Ar module
542in the target's file list
543.Pq e.g., Pa /etc/sysctl.kld.d/ Ns Ar module Ns Pa .conf .
544Only valid for targets with a module drop-in directory
545.Pq see Xr sysconf-sysctl 8 .
546.It Fl l
547List the pathnames of the files backing the target,
548in sourcing order,
549and exit.
550The read-only defaults file is never listed
551.Po
552.Fl l
553enumerates only files
554.Nm sysconf
555may modify;
556see
557.Xr sysconf-targets 8
558.Pc .
559.It Fl L
560Like
561.Fl l ,
562but additionally list every drop-in candidate:
563for targets with a module drop-in directory,
564one candidate per loaded kernel module
565.Pq whether or not the file exists yet
566plus any drop-in already on disk.
567The read-only defaults file is likewise never listed.
568.It Fl n
569Show only directive values,
570not their names.
571.It Fl N
572Show only directive names,
573not their values.
574.It Fl q
575Quiet.
576Suppress warnings about unknown directives and the
577.Ql old -> new
578echo of write operations.
579.It Fl R Ar dir
580Operate within the root directory
581.Ar dir
582rather than
583.Pa / ;
584mutually exclusive with
585.Fl j .
586.It Fl s
587Set empty
588.Ql WITH_*
589and
590.Ql WITHOUT_*
591build knobs on the
592.Cm make
593and
594.Cm src
595targets
596.Po
597equivalent to
598.Ar name Ns =
599with no value;
600see
601.Xr sysconf-make 8
602and
603.Xr sysconf-src 8
604.Pc .
605Each bare
606.Ar name
607must begin with
608.Ql WITH_
609or
610.Ql WITHOUT_ .
611An already-present knob
612.Pq any value
613is left unchanged by
614.Fl s .
615An explicit
616.Ar name Ns =
617including empty always writes.
618Mutually exclusive with
619.Fl x .
620.It Fl v
621Verbose.
622Print the pathname of the configuration file holding the final effective
623value
624.Pq the last file in sourcing order that assigned the directive .
625.It Fl V
626Trail.
627For each named read
628.Pq and for Fl a ,
629print every assignment step that contributed to the effective value:
630.Ql file:line: nameopfragment ,
631and when the running effective value differs from the fragment,
632.Ql -> effective .
633.Pp
634For writes, print the same
635.Ql file:line:
636shape for the change:
637.Ql file:line: name=old -> name=new ,
638.Ql name=value (unchanged) ,
639.Ql name=value (added)
640when a new statement is created,
641or
642.Ql nameopfragment (removed)
643when a statement is deleted,
644using the statement operator
645.Ql = / += / ...
646as appropriate .
647.Pp
648Uses the same accumulation model as ordinary reads
649.Pq make(1) `+=' et al. ,
650so the last effective value matches
651.Fl v
652and,
653for linear conf files without
654.Ql .if ,
655.Nm make Fl V
656.Pq see Xr sysconf-make 8 and Xr sysconf-src 8 .
657.It Fl x
658Remove the named directive(s) from every file of the target listing them
659.Pq see Xr sysconf-targets 8 .
660With
661.Fl v
662or
663.Fl V ,
664a successful removal echoes
665.Ql name (removed)
666.Pq or a trail form with Fl V .
667.El
668.Sh ENVIRONMENT
669.Bl -tag -width "LOADER_DEFAULTS"
670.It Ev BSDCONF_MAX_BYTES
671Maximum bytes
672.Nm
673will read from a configuration file or stream;
674see
675.Xr bsdconf 3 .
676.It Ev LOADER_DEFAULTS
677Defaults file for the
678.Ql loader
679target;
680see
681.Xr sysconf-loader 8 .
682.It Ev SRC_ENV_CONF , Ev __MAKE_CONF , Ev SRCCONF
683Paths for the
684.Cm src
685triad;
686see
687.Xr sysconf-src 8 .
688.El
689.Sh FILES
690See the per-target manuals
691.Pq Xr sysconf-loader 8 , Xr sysconf-sysctl 8 , Xr sysconf-make 8 , Xr sysconf-src 8
692for the files each keyword consults.
693Common paths include
694.Pa /boot/loader.conf ,
695.Pa /etc/sysctl.conf ,
696.Pa /etc/make.conf ,
697and
698.Pa /etc/src.conf .
699.Sh EXIT STATUS
700.Ex -std
701In check mode
702.Pq Fl c ,
703an exit status of zero means no changes are required.
704.Sh EXAMPLES
705Read and set a boot loader directive:
706.Pp
707.Dl sysconf loader zfs_load
708.Dl sysconf loader zfs_load=\(dqYES\(dq
709.Pp
710Raise a sysctl applied at boot:
711.Pp
712.Dl sysconf sysctl kern.maxfiles=65536
713.Pp
714List files backing the loader target:
715.Pp
716.Dl sysconf loader -l
717.Pp
718Append to a space-separated list:
719.Pp
720.Dl sysconf loader kernels+=kernel_test
721.Pp
722Append a
723.Xr make 1
724flag and set a
725.Pa src.conf
726knob:
727.Pp
728.Dl sysconf make CFLAGS+=-DDEBUG
729.Dl sysconf src -s WITHOUT_LLDB
730.Dl sysconf src WITHOUT_LLDB=
731.Pp
732Further examples for each target appear in
733.Xr sysconf-loader 8 ,
734.Xr sysconf-sysctl 8 ,
735.Xr sysconf-make 8 ,
736.Xr sysconf-src 8 ,
737.Xr sysconf-rc 8 ,
738.Xr sysconf-poudriere 8 ,
739and
740.Xr sysconf-generic 8 .
741.Sh SEE ALSO
742.Xr bsdconf 3 ,
743.Xr bsdconf_format 3 ,
744.Xr bsdconf_put 3 ,
745.Xr loader.conf 5 ,
746.Xr src.conf 5 ,
747.Xr sysctl.conf 5 ,
748.Xr jail 8 ,
749.Xr sysconf-generic 8 ,
750.Xr sysconf-loader 8 ,
751.Xr sysconf-make 8 ,
752.Xr sysconf-poudriere 8 ,
753.Xr sysconf-rc 8 ,
754.Xr sysconf-src 8 ,
755.Xr sysconf-sysctl 8 ,
756.Xr sysconf-targets 8 ,
757.Xr sysctl 8 ,
758.Xr sysrc 8
759.Sh HISTORY
760The
761.Nm
762utility first appeared in
763.Fx 16.0 .
764.Sh AUTHORS
765.An Devin Teske Aq Mt dteske@FreeBSD.org
766.An Faraz Vahedi Aq Mt kfv@FreeBSD.org
767.Sh SECURITY CONSIDERATIONS
768Read-only invocations
769.Po
770including
771.Fl c
772checks, which never modify files
773.Pc
774run inside a
775.Xr capsicum 4
776sandbox:
777the backing files are opened first and the process then relinquishes all
778other capabilities before any file content is parsed.
779.Pp
780Write operations replace files atomically and never in place;
781see the
782.Sx SECURITY CONSIDERATIONS
783section of
784.Xr bsdconf_put 3
785for the properties of the write transaction.
786