# SOME DESCRIPTIVE TITLE # Copyright (C) YEAR The FreeBSD Project # This file is distributed under the same license as the FreeBSD Documentation package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: FreeBSD Documentation VERSION\n" "POT-Creation-Date: 2026-02-22 15:58+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. type: YAML Front Matter: description #: documentation/content/en/books/handbook/config/_index.adoc:1 #, no-wrap msgid "This chapter explains much of the FreeBSD configuration files, how to enable or disable a service, how to configure the logging system and the power management area." msgstr "" #. type: YAML Front Matter: part #: documentation/content/en/books/handbook/config/_index.adoc:1 #, no-wrap msgid "Part III. System Administration" msgstr "" #. type: YAML Front Matter: title #: documentation/content/en/books/handbook/config/_index.adoc:1 #, no-wrap msgid "Chapter 14. Configuration, Services, Logging and Power Management" msgstr "" #. type: Title = #: documentation/content/en/books/handbook/config/_index.adoc:15 #, no-wrap msgid "Configuration, Services, Logging and Power Management" msgstr "" #. type: Title == #: documentation/content/en/books/handbook/config/_index.adoc:53 #, no-wrap msgid "Synopsis" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:57 msgid "" "One of the important aspects of FreeBSD is proper system configuration. " "This chapter explains much of the FreeBSD configuration process, including " "some of the parameters which can be set to tune a FreeBSD system." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:59 msgid "Before reading this chapter:" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:61 msgid "" "Understand UNIX(R) and FreeBSD basics (crossref:basics[basics,FreeBSD " "Basics])." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:63 msgid "Read this chapter to learn:" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:65 msgid "How to use the various configuration files in [.filename]#/etc#." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:66 msgid "" "The basics of [.filename]#rc.conf# configuration and [.filename]#/usr/local/" "etc/rc.d# startup scripts." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:67 msgid "How to tune FreeBSD using man:sysctl[8] variables." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:68 msgid "How to configure the power management in FreeBSD." msgstr "" #. type: Title == #: documentation/content/en/books/handbook/config/_index.adoc:70 #, no-wrap msgid "Configuration Files" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:73 msgid "" "FreeBSD maintains a clear separation between the base system and third party " "applications and therefore this affects where the configuration files of " "these applications are located." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:76 msgid "" "FreeBSD base system configuration is located at the [.filename]#/etc# " "directory, and the [.filename]#/usr/local/etc# directory contains all the " "configuration files of the applications installed on the system through the " "ports collection and packages." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:79 msgid "" "The kernel state configuration is located in [.filename]#/etc/sysctl.conf#. " "In the section crossref:config[configtuning-sysctl, The sysctl utility], the " "operation of man:sysctl[8] will be explained in more detail." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:81 msgid "" "For more information about the FreeBSD file system structure refer to " "man:hier[7]." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:84 msgid "" "As a general rule, configuration files do not use a standard on what syntax " "they must follow. Although it is true that the `#` character is normally " "used to comment a line and that each line has a configuration variable." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:88 msgid "" "Some applications like man:pkg[8] are starting to use the link:https://" "github.com/vstakhov/libucl[Universal Configuration Language (UCL)]." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:90 #, no-wrap msgid "The [.filename]#/etc# directory" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:93 msgid "" "The [.filename]#/etc# directory contains all of the FreeBSD base system " "configuration files that are responsible for configuring FreeBSD." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:97 #, no-wrap msgid "*Extreme* caution must be taken when modifying files in the [.filename]#/etc# directory; misconfiguration could make FreeBSD unbootable or malfunction.\n" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:104 #, no-wrap msgid "[.filename]#/etc#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:106 #, no-wrap msgid "System configuration files and scripts." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:107 #, no-wrap msgid "[.filename]#/etc/defaults#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:109 #, no-wrap msgid "Default system configuration files, see man:rc[8] for more information." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:110 #, no-wrap msgid "[.filename]#/etc/fstab#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:112 #, no-wrap msgid "man:fstab[5] contains descriptive information about the various file systems." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:113 #, no-wrap msgid "[.filename]#/etc/mail#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:115 #, no-wrap msgid "Extra man:sendmail[8] configuration and other MTA configuration files." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:116 #, no-wrap msgid "[.filename]#/etc/mtree#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:118 #, no-wrap msgid "mtree configuration files, see man:mtree[8] for more information." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:119 #, no-wrap msgid "[.filename]#/etc/pam.d#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:121 #, no-wrap msgid "Configuration files for the Pluggable Authentication Modules (PAM) library." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:122 #, no-wrap msgid "[.filename]#/etc/periodic#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:124 #, no-wrap msgid "Scripts that are run daily, weekly, and monthly, via man:cron[8], see man:periodic[8] for more information." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:125 #, no-wrap msgid "[.filename]#/etc/rc.d#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:127 #, no-wrap msgid "System and daemon startup/control scripts, see man:rc[8] for more information." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:128 #, no-wrap msgid "[.filename]#/etc/rc.conf#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:133 #, no-wrap msgid "" "Contains descriptive information about the local host name, configuration\n" "details for any potential network interfaces and which services should be\n" "started up at system initial boot time. More information in\n" "crossref:bsdinstall[configtuning-core-configuration, Managing System-Specific Configuration]" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:134 #, no-wrap msgid "[.filename]#/etc/security#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:136 #, no-wrap msgid "OpenBSM audit configuration files, see man:audit[8] for more information." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:137 #, no-wrap msgid "[.filename]#/etc/ppp#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:139 #, no-wrap msgid "ppp configuration files, see man:ppp[8] for more information." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:140 #, no-wrap msgid "[.filename]#/etc/ssh#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:142 #, no-wrap msgid "OpenSSH configuration files, see man:ssh[1] for more information." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:143 #, no-wrap msgid "[.filename]#/etc/ssl#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:145 #, no-wrap msgid "OpenSSL configuration files." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:146 #, no-wrap msgid "[.filename]#/etc/sysctl.conf#" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:149 #, no-wrap msgid "" "Contains settings for the kernel. More information in\n" "crossref:bsdinstall[configtuning-sysctl, The sysctl utility]" msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:152 #, no-wrap msgid "The sysctl utility" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:155 msgid "" "The man:sysctl[8] utility is used to make changes to a running FreeBSD " "system." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:158 msgid "" "The man:sysctl[8] utility retrieves kernel state and allows processes with " "appropriate privilege to set kernel state. The state to be retrieved or set " "is described using a \"Management Information Base\" (\"MIB\") style name, " "described as a dotted set of components." msgstr "" #. type: Block title #: documentation/content/en/books/handbook/config/_index.adoc:159 #, no-wrap msgid "Management Information Base" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:165 #, no-wrap msgid "sysctl" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:167 #, no-wrap msgid "\"Magic\" numbers" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:168 #: documentation/content/en/books/handbook/config/_index.adoc:803 #, no-wrap msgid "kern" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:170 #, no-wrap msgid "Kernel functions and features" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:171 #, no-wrap msgid "vm" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:173 #, no-wrap msgid "Virtual memory" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:174 #, no-wrap msgid "vfs" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:176 #, no-wrap msgid "Filesystem" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:177 #, no-wrap msgid "net" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:179 #, no-wrap msgid "Network" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:180 #: documentation/content/en/books/handbook/config/_index.adoc:869 #, no-wrap msgid "debug" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:182 #, no-wrap msgid "Debugging parameters" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:183 #, no-wrap msgid "hw" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:185 #, no-wrap msgid "Hardware" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:186 #, no-wrap msgid "machdep" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:188 #, no-wrap msgid "Machine dependent" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:189 #: documentation/content/en/books/handbook/config/_index.adoc:827 #, no-wrap msgid "user" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:191 #, no-wrap msgid "Userland" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:192 #, no-wrap msgid "p1003_1b" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:194 #, no-wrap msgid "POSIX 1003.1B" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:197 msgid "" "At its core, man:sysctl[8] serves two functions: to read and to modify " "system settings." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:199 msgid "To view all readable variables:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:203 #, no-wrap msgid "% sysctl -a\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:206 #: documentation/content/en/books/handbook/config/_index.adoc:230 #: documentation/content/en/books/handbook/config/_index.adoc:244 #: documentation/content/en/books/handbook/config/_index.adoc:271 #: documentation/content/en/books/handbook/config/_index.adoc:315 #: documentation/content/en/books/handbook/config/_index.adoc:457 #: documentation/content/en/books/handbook/config/_index.adoc:621 #: documentation/content/en/books/handbook/config/_index.adoc:635 #: documentation/content/en/books/handbook/config/_index.adoc:1146 #: documentation/content/en/books/handbook/config/_index.adoc:1209 #: documentation/content/en/books/handbook/config/_index.adoc:1271 #: documentation/content/en/books/handbook/config/_index.adoc:1356 #: documentation/content/en/books/handbook/config/_index.adoc:1382 #: documentation/content/en/books/handbook/config/_index.adoc:1399 #: documentation/content/en/books/handbook/config/_index.adoc:1479 msgid "The output should be similar to the following:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:220 #, no-wrap msgid "" "kern.ostype: FreeBSD\n" "...\n" "vm.swap_enabled: 1\n" "vm.overcommit: 0\n" "vm.domain.0.pidctrl.kdd: 8\n" "vm.domain.0.pidctrl.kid: 4\n" "vm.domain.0.pidctrl.kpd: 3\n" "...\n" "vfs.zfs.sync_pass_rewrite: 2\n" "vfs.zfs.sync_pass_dont_compress: 8\n" "vfs.zfs.sync_pass_deferred_free: 2\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:223 msgid "To read a particular variable, specify its name:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:227 #, no-wrap msgid "% sysctl kern.maxproc\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:234 #, no-wrap msgid "kern.maxproc: 1044\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:237 msgid "" "The Management Information Base (MIB) is hierarchical and hence, specifying " "a prefix prints all the nodes hanging from it:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:241 #, no-wrap msgid "% sysctl net\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:261 #, no-wrap msgid "" "net.local.stream.recvspace: 8192\n" "net.local.stream.sendspace: 8192\n" "net.local.dgram.recvspace: 16384\n" "net.local.dgram.maxdgram: 2048\n" "net.local.seqpacket.recvspace: 8192\n" "net.local.seqpacket.maxseqpacket: 8192\n" "net.local.sockcount: 60\n" "net.local.taskcount: 25\n" "net.local.recycled: 0\n" "net.local.deferred: 0\n" "net.local.inflight: 0\n" "net.inet.ip.portrange.randomtime: 1\n" "net.inet.ip.portrange.randomcps: 9999\n" "[...]\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:264 msgid "To set a particular variable, use the _variable_=_value_ syntax:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:268 #, no-wrap msgid "# sysctl kern.maxfiles=5000\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:275 #, no-wrap msgid "kern.maxfiles: 2088 -> 5000\n" msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:280 msgid "" "To keep the configuration after a reboot it is necessary to add these " "variables to the [.filename]#/etc/sysctl.conf# file as explained below." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:283 #, no-wrap msgid "The [.filename]#/etc/sysctl.conf# file" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:286 msgid "" "The configuration file for man:sysctl[8], [.filename]#/etc/sysctl.conf#, " "looks much like [.filename]#/etc/rc.conf#." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:288 msgid "Values are set using a `variable=value` syntax." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:293 msgid "" "The specified values are set after the system goes into multi-user mode. " "Not all variables are settable in this mode." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:296 msgid "" "For example, to turn off logging of fatal signal exits and prevent users " "from seeing processes started by other users, the following tunables can be " "set in [.filename]#/etc/sysctl.conf#:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:301 #, no-wrap msgid "" "# Do not log fatal signal exits (e.g., sig 11)\n" "kern.logsigexit=0\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:305 #, no-wrap msgid "" "# Prevent users from seeing information about processes that\n" "# are being run under another UID.\n" "security.bsd.see_other_uids=0\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:308 msgid "" "To obtain more information about what function a particular sysctl has, the " "following command can be executed:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:312 #, no-wrap msgid "% sysctl -d kern.dfldsiz\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:319 #, no-wrap msgid "kern.dfldsiz: Initial data size limit\n" msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:322 #, no-wrap msgid "Managing System-Specific Configuration" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:325 msgid "" "The principal location for system configuration information is [.filename]#/" "etc/rc.conf#." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:328 msgid "" "This file contains a wide range of configuration information and it is read " "at system startup to configure the system. It provides the configuration " "information for the [.filename]#rc*# files." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:330 msgid "" "The entries in [.filename]#/etc/rc.conf# override the default settings in " "[.filename]#/etc/defaults/rc.conf#." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:335 msgid "" "The file [.filename]#/etc/defaults/rc.conf# containing the default settings " "should not be edited. Instead, all system-specific changes should be made " "to [.filename]#/etc/rc.conf#." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:338 msgid "" "A number of strategies may be applied in clustered applications to separate " "site-wide configuration from system-specific configuration in order to " "reduce administration overhead." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:340 msgid "" "The recommended approach is to place system-specific configuration into " "[.filename]#/etc/rc.conf.local#." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:342 msgid "" "For example, these entries in [.filename]#/etc/rc.conf# apply to all systems:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:348 #, no-wrap msgid "" "sshd_enable=\"YES\"\n" "keyrate=\"fast\"\n" "defaultrouter=\"10.1.1.254\"\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:351 msgid "" "Whereas these entries in [.filename]#/etc/rc.conf.local# apply to this " "system only:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:356 #, no-wrap msgid "" "hostname=\"node1.example.org\"\n" "ifconfig_fxp0=\"inet 10.1.1.1/8\"\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:359 msgid "" "Distribute [.filename]#/etc/rc.conf# to every system using an application " "such as rsync or puppet, while [.filename]#/etc/rc.conf.local# remains " "unique." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:361 msgid "" "Upgrading the system will not overwrite [.filename]#/etc/rc.conf#, so system " "configuration information will not be lost." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:367 msgid "" "Both [.filename]#/etc/rc.conf# and [.filename]#/etc/rc.conf.local# are " "parsed by man:sh[1]. This allows system operators to create complex " "configuration scenarios. Refer to man:rc.conf[5] for further information on " "this topic." msgstr "" #. type: Title == #: documentation/content/en/books/handbook/config/_index.adoc:370 #, no-wrap msgid "Managing Services in FreeBSD" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:373 msgid "" "FreeBSD uses the man:rc[8] system of startup scripts during system " "initialization and for managing services." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:375 msgid "" "The scripts listed in [.filename]#/etc/rc.d# provide basic services which " "can be controlled with the `start`, `stop`, and `restart` options to " "man:service[8]." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:377 msgid "A basic script may look similar to the following:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:385 #, no-wrap msgid "" "#!/bin/sh\n" "#\n" "# PROVIDE: utility\n" "# REQUIRE: DAEMON\n" "# KEYWORD: shutdown\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:387 #, no-wrap msgid ". /etc/rc.subr\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:390 #, no-wrap msgid "" "name=utility\n" "rcvar=utility_enable\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:392 #, no-wrap msgid "command=\"/usr/local/sbin/utility\"\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:394 #, no-wrap msgid "load_rc_config $name\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:401 #, no-wrap msgid "" "#\n" "# DO NOT CHANGE THESE DEFAULT VALUES HERE\n" "# SET THEM IN THE /etc/rc.conf FILE\n" "#\n" "utility_enable=${utility_enable-\"NO\"}\n" "pidfile=${utility_pidfile-\"/var/run/utility.pid\"}\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:403 #, no-wrap msgid "run_rc_command \"$1\"\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:406 msgid "" "Refer to extref:{rc-scripting}[this article] for instructions on how to " "create custom man:rc[8] scripts." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:408 #, no-wrap msgid "Starting Services" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:411 msgid "" "Many users install third party software on FreeBSD from the Ports Collection " "and require the installed services to be started upon system initialization." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:414 msgid "" "Services, such as package:security/openssh-portable[] or package:www/nginx[] " "are just two of the many software packages which may be started during " "system initialization. This section explains the procedures available for " "starting services." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:416 msgid "" "Since the man:rc[8] system is primarily intended to start and stop services " "at system startup and shutdown time, the `start`, `stop` and `restart` " "options will only perform their action if the appropriate [.filename]#/etc/" "rc.conf# variable is set." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:418 msgid "" "So the first step to start a service, like for example package:www/nginx[] " "is to add it to [.filename]#/etc/rc.conf# by executing the following command:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:422 #, no-wrap msgid "# sysrc nginx_enable=\"YES\"\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:425 msgid "Then nginx can be started executing the following command:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:429 #, no-wrap msgid "# service nginx start\n" msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:435 msgid "" "To `start`, `stop` or `restart` a service regardless of the settings in " "[.filename]#/etc/rc.conf#, these commands should be prefixed with \"one\". " "For instance, to start package:www/nginx[] regardless of the current " "[.filename]#/etc/rc.conf# setting, execute the following command:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:439 #, no-wrap msgid "# service nginx onestart\n" msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:443 msgid "" "It is also possible to put a service automatically into a jail, see the " "corresponding crossref:jails[service-jails,Service Jails] explanation." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:445 #, no-wrap msgid "Status of a Service" msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:448 msgid "To determine if a service is running, use the `status` subcommand." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:450 msgid "For example, to verify that package:www/nginx[] is running:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:454 #, no-wrap msgid "# service nginx status\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:461 #, no-wrap msgid "nginx is running as pid 27871.\n" msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:464 #, no-wrap msgid "Reload a Service" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:468 msgid "" "In some cases, it is also possible to `reload` a service. This attempts to " "send a signal to an individual service, forcing the service to reload its " "configuration files." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:470 msgid "In most cases, this means sending the service a `SIGHUP` signal." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:472 #, no-wrap msgid "*Not all services support this feature.*\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:475 msgid "" "The man:rc[8] system is used for network services and it also contributes to " "most of the system initialization. For instance, when the [.filename]#/etc/" "rc.d/bgfsck# script is executed, it prints out the following message:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:479 #, no-wrap msgid "Starting background file system checks in 60 seconds.\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:482 msgid "" "This script is used for background file system checks, which occur only " "during system initialization." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:485 msgid "" "Many system services depend on other services to function properly. For " "example, man:yp[8] and other RPC-based services may fail to start until " "after the man:rpcbind[8] service has started." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:487 msgid "Additional information can be found in man:rc[8] and man:rc.subr[8]." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:488 #, no-wrap msgid "Using Services to Start Services" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:492 msgid "" "Other services can be started using man:inetd[8]. Working with man:inetd[8] " "and its configuration is described in depth in crossref:network-" "servers[network-inetd,“The inetd Super-Server”]." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:496 msgid "" "In some cases, it may make more sense to use man:cron[8] to start system " "services. This approach has a number of advantages as man:cron[8] runs " "these processes as the owner of the man:crontab[5]. This allows regular " "users to start and maintain their own applications." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:499 msgid "" "The `@reboot` feature of man:cron[8], may be used in place of the time " "specification. This causes the job to run when man:cron[8] is started, " "normally during system initialization." msgstr "" #. type: Title == #: documentation/content/en/books/handbook/config/_index.adoc:501 #, no-wrap msgid "Cron and Periodic" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:505 msgid "" "Scheduling tasks to run at a certain day or time is a very common task on " "FreeBSD. The tool in charge of performing this task is man:cron[8]." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:507 msgid "" "In addition to tasks that can be scheduled by the user via man:cron[8], " "FreeBSD performs routine background tasks managed by man:periodic[8]." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:509 #, no-wrap msgid "Cron" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:512 msgid "" "The man:cron[8] utility runs in the background and regularly checks " "[.filename]#/etc/crontab# for tasks to execute and searches [.filename]#/var/" "cron/tabs# for custom crontab files." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:514 msgid "" "These files are used to schedule tasks which cron runs at the specified " "times." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:516 msgid "" "Each entry in a crontab defines a task to run and is known as a _cron job_." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:522 msgid "" "Two different types of configuration files are used: the system crontab, " "which should not be modified, and user crontabs, which can be created and " "edited as needed. The format used by these files is documented in " "man:crontab[5]. The format of the system crontab, [.filename]#/etc/crontab# " "includes a `who` column which does not exist in user crontabs. In the " "system crontab, cron runs the command as the user specified in this column. " "In a user crontab, all commands run as the user who created the crontab." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:525 msgid "" "User crontabs allow individual users to schedule their own tasks. The " "`root` user can also have a user [.filename]#crontab# which can be used to " "schedule tasks that do not exist in the system [.filename]#crontab#." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:527 msgid "" "Here is a sample entry from the system crontab, [.filename]#/etc/crontab#:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:553 #, no-wrap msgid "" "# /etc/crontab - root's crontab for FreeBSD\n" "#\n" "# <.>\n" "#\n" "SHELL=/bin/sh\n" "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin <.>\n" "#\n" "#minute hour mday month wday who command <.>\n" "#\n" "# Save some entropy so that /dev/random can re-seed on boot.\n" "*/11 * * * * operator /usr/libexec/save-entropy <.>\n" "#\n" "# Rotate log files every hour, if necessary.\n" "0 * * * * root newsyslog\n" "#\n" "# Perform daily/weekly/monthly maintenance.\n" "1 3 * * * root periodic daily\n" "15 4 * * 6 root periodic weekly\n" "30 5 1 * * root periodic monthly\n" "#\n" "# Adjust the time zone if the CMOS clock keeps local time, as opposed to\n" "# UTC time. See adjkerntz(8) for details.\n" "1,31 0-5 * * * root adjkerntz -a\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:557 msgid "" "Lines that begin with the `+#+` character are comments. A comment can be " "placed in the file as a reminder of what and why a desired action is " "performed. Comments cannot be on the same line as a command or else they " "will be interpreted as part of the command; they must be on a new line. " "Blank lines are ignored." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:559 msgid "" "The equals (`=`) character is used to define any environment settings. In " "this example, it is used to define the `SHELL` and `PATH`. If the `SHELL` is " "omitted, cron will use the default Bourne shell. If the `PATH` is omitted, " "the full path must be given to the command or script to run." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:561 msgid "" "This line defines the seven fields used in a system crontab: `minute`, " "`hour`, `mday`, `month`, `wday`, `who`, and `command`. The `minute` field is " "the time in minutes when the specified command will be run, the `hour` is " "the hour when the specified command will be run, the `mday` is the day of " "the month, `month` is the month, and `wday` is the day of the week. These " "fields must be numeric values, representing the twenty-four hour clock, or a " "`*`, representing all values for that field. The `who` field only exists in " "the system crontab and specifies which user the command should be run as. " "The last field is the command to be executed." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:563 msgid "" "This entry defines the values for this cron job. The `\\*/11`, followed by " "several more `*` characters, specifies that `/usr/libexec/save-entropy` is " "invoked by `operator` every eleven minutes of every hour, of every day and " "day of the week, of every month. Commands can include any number of " "switches. However, commands which extend to multiple lines need to be broken " "with the backslash \"\\\" continuation character." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:565 #, no-wrap msgid "Creating a User Crontab" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:568 msgid "To create a user crontab, invoke `crontab` in editor mode:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:572 #, no-wrap msgid "% crontab -e\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:577 msgid "" "This will open the user's crontab using the default text editor. The first " "time a user runs this command, it will open an empty file. Once a user " "creates a crontab, this command will open that file for editing." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:579 msgid "" "It is useful to add these lines to the top of the crontab file in order to " "set the environment variables and to remember the meanings of the fields in " "the crontab:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:586 #, no-wrap msgid "" "SHELL=/bin/sh\n" "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin\n" "# Order of crontab fields\n" "# minute hour mday month wday command\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:591 msgid "" "Then add a line for each command or script to run, specifying the time to " "run the command. This example runs the specified custom Bourne shell script " "every day at two in the afternoon. Since the path to the script is not " "specified in `PATH`, the full path to the script is given:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:595 #: documentation/content/en/books/handbook/config/_index.adoc:625 #, no-wrap msgid "0 14 * * * /home/user/bin/mycustomscript.sh\n" msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:601 msgid "" "Before using a custom script, make sure it is executable and test it with " "the limited set of environment variables set by cron. To replicate the " "environment that would be used to run the above cron entry, use:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:605 #, no-wrap msgid "env -i SHELL=/bin/sh PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin HOME=/home/user LOGNAME=user /home/user/bin/mycustomscript.sh\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:609 msgid "" "The environment set by cron is discussed in man:crontab[5]. Checking that " "scripts operate correctly in a cron environment is especially important if " "they include any commands that delete files using wildcards." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:614 msgid "" "When finished editing the crontab, save the file. It will automatically be " "installed, and cron will read the crontab and run its cron jobs at their " "specified times. To list the cron jobs in a crontab, use this command:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:618 #, no-wrap msgid "% crontab -l\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:628 msgid "To remove all of the cron jobs in a user crontab:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:632 #, no-wrap msgid "% crontab -r\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:639 #, no-wrap msgid "remove crontab for user? y\n" msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:642 #, no-wrap msgid "Periodic" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:648 msgid "" "FreeBSD provides a set of system management scripts to check status of " "various subsystems, perform security-related checks, rotate log files, etc. " "These scripts are run on a periodic basis: daily. weekly, or monthly. The " "management of these tasks is performed by man:periodic[8] and its " "configuration resides in man:periodic.conf[5]. The periodic tasks are " "initiated by entries in the system crontab, shown above." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:650 msgid "" "Scripts executed by man:periodic[8] are located in [.filename]#/etc/periodic/" "# for base utilities and in [.filename]#/usr/local/etc/periodic/# for third-" "party software." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:652 msgid "" "They are organized in 4 subdirectories, daily, weekly, monthly and security." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:654 #, no-wrap msgid "Enable or Disable Periodic Tasks" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:657 msgid "FreeBSD has some scripts enabled by default to run periodically." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:659 msgid "" "To enable or disable a task, the first step is to edit [.filename]#/etc/" "periodic.conf# executing the following command:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:663 #, no-wrap msgid "# ee /etc/periodic.conf\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:666 msgid "" "And then to enable, for example, `daily_status_zfs_enable` put the following " "content in the file:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:670 #, no-wrap msgid "daily_status_zfs_enable=\"YES\"\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:673 msgid "" "To disable a task that is active by default, all that needs to be done is to " "change `YES` to `NO`." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:675 #, no-wrap msgid "Configuring the Output of Periodic Tasks" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:678 msgid "" "In [.filename]#/etc/periodic.conf# the variables `daily_output`, " "`weekly_output` and `monthly_output` specifies where to send the results of " "the script execution." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:680 msgid "" "By default the output of the periodic scripts are emailed to root, and " "therefore it is best to read root's mail or alias root to a mailbox that is " "monitored." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:682 msgid "" "To send the results to another email or to other emails, add the email " "addresses separated by spaces to [.filename]#/etc/periodic.conf#:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:688 #, no-wrap msgid "" "daily_output=\"email1@example.com email2@example.com\"\n" "weekly_output=\"email1@example.com email2@example.com\"\n" "monthly_output=\"email1@example.com email2@example.com\"\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:691 msgid "" "To log periodic output instead of receiving it as email, add the following " "lines to [.filename]#/etc/periodic.conf#. man:newsyslog[8] will rotate these " "files at the appropriate times:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:697 #, no-wrap msgid "" "daily_output=/var/log/daily.log\n" "weekly_output=/var/log/weekly.log\n" "monthly_output=/var/log/monthly.log\n" msgstr "" #. type: Title == #: documentation/content/en/books/handbook/config/_index.adoc:700 #, no-wrap msgid "Configuring System Logging" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:706 msgid "" "Generating and reading system logs is an important aspect of system " "administration. The information in system logs can be used to detect " "hardware and software issues as well as application and system configuration " "errors. This information also plays an important role in security auditing " "and incident response. Most system daemons and applications will generate " "log entries." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:709 msgid "" "FreeBSD provides a system logger, man:syslogd[8], to manage logging. By " "default, syslogd is enabled and started when the system boots." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:711 msgid "" "This section describes how to configure the FreeBSD system logger for both " "local and remote logging and how to perform log rotation and log management." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:712 #, no-wrap msgid "Configuring Local Logging" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:719 msgid "" "The configuration file, [.filename]#/etc/syslog.conf#, controls what syslogd " "does with log entries as they are received. There are several parameters to " "control the handling of incoming events. The _facility_ describes which " "subsystem generated the message, such as the kernel or a daemon, and the " "_level_ describes the severity of the event that occurred. This makes it " "possible to configure if and where a log message is logged, depending on the " "facility and level. It is also possible to take action depending on the " "application that sent the message, and in the case of remote logging, the " "hostname of the machine generating the logging event." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:726 msgid "" "This configuration file contains one line per action, where the syntax for " "each line is a selector field followed by an action field. The syntax of " "the selector field is _facility.level_ which will match log messages from " "_facility_ at level _level_ or higher. It is also possible to add an " "optional comparison flag before the level to specify more precisely what is " "logged. Multiple selector fields can be used for the same action, and are " "separated with a semicolon (`;`). Using `*` will match everything. The " "action field denotes where to send the log message, such as to a file or " "remote log host." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:728 msgid "" "As an example, here is the default [.filename]#/etc/syslog.conf# from " "FreeBSD:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:764 #, no-wrap msgid "" "# Spaces ARE valid field separators in this file. However,\n" "# other *nix-like systems still insist on using tabs as field\n" "# separators. If you are sharing this file between systems, you\n" "# may want to use only tabs as field separators here.\n" "# Consult the syslog.conf(5) manpage.\n" "*.err;kern.warning;auth.notice;mail.crit /dev/console <.>\n" "*.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err /var/log/messages\n" "security.* /var/log/security\n" "auth.info;authpriv.info /var/log/auth.log\n" "mail.info /var/log/maillog <.>\n" "cron.* /var/log/cron\n" "!-devd\n" "*.=debug /var/log/debug.log <.>\n" "*.emerg *\n" "daemon.info /var/log/daemon.log\n" "# uncomment this to log all writes to /dev/console to /var/log/console.log\n" "# touch /var/log/console.log and chmod it to mode 600 before it will work\n" "#console.info /var/log/console.log\n" "# uncomment this to enable logging of all log messages to /var/log/all.log\n" "# touch /var/log/all.log and chmod it to mode 600 before it will work\n" "#*.* /var/log/all.log\n" "# uncomment this to enable logging to a remote loghost named loghost\n" "#*.* @loghost\n" "# uncomment these if you're running inn\n" "# news.crit /var/log/news/news.crit\n" "# news.err /var/log/news/news.err\n" "# news.notice /var/log/news/news.notice\n" "# Uncomment this if you wish to see messages produced by devd\n" "# !devd\n" "# *.>=notice /var/log/devd.log <.>\n" "!*\n" "include /etc/syslog.d\n" "include /usr/local/etc/syslog.d\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:767 msgid "" "Matches all messages with a level of `err` or higher, as well as " "`kern.warning`, `auth.notice` and `mail.crit`, and sends these log messages " "to the console ([.filename]#/dev/console#)." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:768 msgid "" "Matches all messages from the `mail` facility at level `info` or above and " "logs the messages to [.filename]#/var/log/maillog#." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:769 msgid "" "Uses a comparison flag (`=`) to only match messages at level `debug` and " "logs them to [.filename]#/var/log/debug.log#." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:770 msgid "" "Is an example usage of a program specification. This makes the rules " "following it only valid for the specified program. In this case, only the " "messages generated by man:devd[8] are logged to [.filename]#/var/log/" "devd.log#." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:772 msgid "" "For more information about [.filename]#/etc/syslog.conf#, its syntax, and " "more advanced usage examples, see man:syslog.conf[5]." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:774 #, no-wrap msgid "Logging Facilities" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:778 msgid "" "A facility describes the part of the system generating the message. " "Facilities are a way of separating the different messages so that it is " "easier for the user to consult the logs." msgstr "" #. type: Block title #: documentation/content/en/books/handbook/config/_index.adoc:779 #, no-wrap msgid "syslog facilities" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:782 #: documentation/content/en/books/handbook/config/_index.adoc:845 #, no-wrap msgid "Name" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:784 #: documentation/content/en/books/handbook/config/_index.adoc:847 #, no-wrap msgid "Description" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:785 #, no-wrap msgid "auth" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:787 #, no-wrap msgid "The authorization system: man:login[1], man:su[1], man:getty[8], etc." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:788 #, no-wrap msgid "authpriv" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:790 #, no-wrap msgid "The same as auth, but logged to a file readable only by root." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:791 #, no-wrap msgid "console" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:793 #, no-wrap msgid "Messages written to [.filename]#/dev/console# by the kernel console output driver." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:794 #, no-wrap msgid "cron" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:796 #, no-wrap msgid "Messages written by the man:cron[8] daemon." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:797 #, no-wrap msgid "daemon" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:799 #, no-wrap msgid "System daemons, such as man:routed[8], that are not provided for explicitly by other facilities." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:800 #, no-wrap msgid "ftp" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:802 #, no-wrap msgid "The file transfer protocol daemons: man:ftpd[8], man:tftpd[8]." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:805 #, no-wrap msgid "Messages generated by the kernel. These cannot be generated by any user processes." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:806 #, no-wrap msgid "lpr" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:808 #, no-wrap msgid "The line printer spooling system: man:lpr[1], man:lpc[8], man:lpd[8], etc." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:809 #, no-wrap msgid "mail" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:811 #, no-wrap msgid "The mail system." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:812 #, no-wrap msgid "mark" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:814 #, no-wrap msgid "This facility adds a record every 20 minutes." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:815 #, no-wrap msgid "news" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:817 #, no-wrap msgid "The network news system." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:818 #, no-wrap msgid "ntp" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:820 #, no-wrap msgid "The network time protocol system." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:821 #, no-wrap msgid "security" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:823 #, no-wrap msgid "Security subsystems, such as man:ipfw[4]." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:824 #, no-wrap msgid "syslog" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:826 #, no-wrap msgid "Messages generated internally by syslogd(8)." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:829 #, no-wrap msgid "Messages generated by random user processes. *This is the default facility identifier if none is specified*." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:830 #, no-wrap msgid "uucp" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:832 #, no-wrap msgid "The Unix-to-Unix Copy system. An ancient protocol. Really weird to see messages from this facility." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:833 #, no-wrap msgid "local0 through local7" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:835 #, no-wrap msgid "Reserved for local use." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:838 #, no-wrap msgid "Logging Levels" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:841 msgid "" "The level describes the severity of the message, and is a keyword from the " "following ordered list (higher to lower):" msgstr "" #. type: Block title #: documentation/content/en/books/handbook/config/_index.adoc:842 #, no-wrap msgid "syslog levels" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:848 #, no-wrap msgid "emerg" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:850 #, no-wrap msgid "A panic condition. This is normally broadcast to all users." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:851 #, no-wrap msgid "alert" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:853 #, no-wrap msgid "A condition that should be corrected immediately, such as a corrupted system database." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:854 #, no-wrap msgid "crit" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:856 #, no-wrap msgid "Critical conditions, e.g., hard device errors." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:857 #, no-wrap msgid "err" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:859 #, no-wrap msgid "Errors." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:860 #, no-wrap msgid "warning" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:862 #, no-wrap msgid "Warning messages." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:863 #, no-wrap msgid "notice" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:865 #, no-wrap msgid "Conditions that are not error conditions, but should possibly be handled specially." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:866 #, no-wrap msgid "info" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:868 #, no-wrap msgid "Informational messages." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:871 #, no-wrap msgid "Messages that contain information normally of use only when debugging a program." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:872 #, no-wrap msgid "none" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:874 #, no-wrap msgid "This special level disables a particular facility." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:877 #, no-wrap msgid "Read Log Messages" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:881 msgid "" "By default FreeBSD log files use the format link:https://" "datatracker.ietf.org/doc/html/rfc3164[rfc3164], also known as The BSD syslog " "Protocol. Learn more about other formats and how to use them at " "man:syslog[8]." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:883 msgid "Typically the logs have the following syntax:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:887 #, no-wrap msgid "date time hostname program[pid]: the message\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:890 msgid "" "The output of the [.filename]#/var/log/cron# file will be used as an example:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:897 #, no-wrap msgid "" "[...]\n" "Jul 16 12:40:00 FreeBSD /usr/sbin/cron[81519]: (root) CMD (/usr/libexec/atrun)\n" "Jul 16 12:44:00 FreeBSD /usr/sbin/cron[83072]: (operator) CMD (/usr/libexec/save-entropy)\n" "[...]\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:900 msgid "" "Verbose logging, so the facility and the level on each message will be " "added, can be enabled in man:syslog[8] by running the following command:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:904 #, no-wrap msgid "# sysrc syslogd_flags=\"-vv\"\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:907 msgid "" "Once the function is activated, the facility and the level will be displayed " "in the log as shown in the following example:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:914 #, no-wrap msgid "" "[...]\n" "Jul 16 17:40:00 FreeBSD /usr/sbin/cron[1016]: (root) CMD (/usr/libexec/atrun)\n" "Jul 16 17:44:00 FreeBSD /usr/sbin/cron[1030]: (operator) CMD (/usr/libexec/save-entropy)\n" "[...]\n" msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:916 #, no-wrap msgid "Log Management and Rotation" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:919 msgid "" "Log files can grow quickly, taking up disk space and making it more " "difficult to locate useful information." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:921 msgid "" "In FreeBSD, man:newsyslog[8] is used to manage log files and attempt to " "mitigate this." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:923 msgid "" "This built-in program periodically rotates and compresses log files, and " "optionally creates missing log files and signals programs when log files are " "moved." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:928 msgid "" "Since newsyslog is run from man:cron[8], it cannot rotate files more often " "than it is scheduled to run from man:cron[8]. In the default configuration, " "it runs every hour." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:931 msgid "" "Here is the default configuration in FreeBSD, more information in " "man:newsyslog.conf[5]:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:966 #, no-wrap msgid "" "# configuration file for newsyslog\n" "#\n" "# Entries which do not specify the '/pid_file' field will cause the\n" "# syslogd process to be signalled when that log file is rotated. This\n" "# action is only appropriate for log files which are written to by the\n" "# syslogd process (ie, files listed in /etc/syslog.conf). If there\n" "# is no process which needs to be signalled when a given log file is\n" "# rotated, then the entry for that file should include the 'N' flag.\n" "#\n" "# Note: some sites will want to select more restrictive protections than the\n" "# defaults. In particular, it may be desirable to switch many of the 644\n" "# entries to 640 or 600. For example, some sites will consider the\n" "# contents of maillog, messages, and lpd-errs to be confidential. In the\n" "# future, these defaults may change to more conservative ones.\n" "#\n" "# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]\n" "/var/log/all.log 600 7 * @T00 J\n" "/var/log/auth.log 600 7 1000 @0101T JC\n" "/var/log/console.log 600 5 1000 * J\n" "/var/log/cron 600 3 1000 * JC\n" "/var/log/daily.log 640 7 * @T00 JN\n" "/var/log/debug.log 600 7 1000 * JC\n" "/var/log/init.log 644 3 1000 * J\n" "/var/log/kerberos.log 600 7 1000 * J\n" "/var/log/maillog 640 7 * @T00 JC\n" "/var/log/messages 644 5 1000 @0101T JC\n" "/var/log/monthly.log 640 12 * $M1D0 JN\n" "/var/log/devd.log 644 3 1000 * JC\n" "/var/log/security 600 10 1000 * JC\n" "/var/log/utx.log 644 3 * @01T05 B\n" "/var/log/weekly.log 640 5 * $W6D0 JN\n" "/var/log/daemon.log 644 5 1000 @0101T JC\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:969 #, no-wrap msgid "" " /etc/newsyslog.conf.d/[!.]*.conf\n" " /usr/local/etc/newsyslog.conf.d/[!.]*.conf\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:972 msgid "`logfilename` - Name of the system log file to be archived." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:973 msgid "" "`[owner:group]` - This optional field specifies the owner and group for the " "archive file." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:974 msgid "" "`mode` - Specify the file mode of the log file and archives. Valid mode bits " "are 0666. (That is, read and write permissions for the rotated log may be " "specified for the owner, group, and others.)" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:975 msgid "`count` - Specify the maximum number of archive files which may exist." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:976 msgid "" "`size` - When the size of the log file reaches size in kilobytes, the log " "file will be trimmed as described above. If this field contains an asterisk " "('*'), the log file will not be trimmed based on size." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:977 msgid "" "`when` - Consist of an interval, a specific time, or both. Supported options " "in man:newsyslog.conf[5]." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:978 msgid "" "`flags` - Indicates the flags that newsyslog accepts, supported options in " "man:newsyslog.conf[5]." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:979 msgid "" "`[/pid_file]` - This optional field specifies the file name containing a " "daemon's process ID or to find a group process ID." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:980 msgid "" "`[sig_num]` - This optional field specifies the signal that will be sent to " "the daemon process." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:984 msgid "" "The last two fields are optional and specify the name of the Process ID " "(PID) file of a process and a signal number to send to that process when the " "file is rotated." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:987 #, no-wrap msgid "Configuring Remote Logging" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:991 msgid "" "Monitoring the log files of multiple hosts can become unwieldy as the number " "of systems increases. Configuring centralized logging can reduce some of " "the administrative burden of log file administration." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:993 msgid "" "In FreeBSD, centralized log file aggregation, merging, and rotation can be " "configured using syslogd and newsyslog." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:995 msgid "" "This section demonstrates an example configuration, where host `A`, named " "`logserv.example.com`, will collect logging information for the local " "network." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:997 msgid "" "Host `B`, named `logclient.example.com`, will be configured to pass logging " "information to the logging server." msgstr "" #. type: Title ==== #: documentation/content/en/books/handbook/config/_index.adoc:998 #, no-wrap msgid "Log Server Configuration" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1001 msgid "" "A log server is a system that has been configured to accept logging " "information from other hosts." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1003 msgid "Before configuring a log server, check the following:" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1005 msgid "" "If there is a firewall between the logging server and any logging clients, " "ensure that the firewall ruleset allows UDP port 514 for both the clients " "and the server." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1006 msgid "" "The logging server and all client machines must have forward and reverse " "entries in the local DNS. If the network does not have a DNS server, create " "entries in each system's [.filename]#/etc/hosts#. Proper name resolution is " "required so that log entries are not rejected by the logging server." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1009 msgid "" "On the log server, edit [.filename]#/etc/syslog.conf# to specify the name of " "the client to receive log entries from, the logging facility to be used, and " "the name of the log to store the host's log entries. This example adds the " "hostname of `B`, logs all facilities, and stores the log entries in " "[.filename]#/var/log/logclient.log#." msgstr "" #. type: Block title #: documentation/content/en/books/handbook/config/_index.adoc:1010 #, no-wrap msgid "Sample Log Server Configuration" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1018 #, no-wrap msgid "" "+logclient.example.com\n" "*.* /var/log/logclient.log\n" msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:1024 msgid "" "When adding multiple log clients, add a similar two-line entry for each " "client. More information about the available facilities may be found in " "man:syslog.conf[5]." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:1026 msgid "Next, execute the following commands:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1031 #, no-wrap msgid "" "# sysrc syslogd_enable=\"YES\"\n" "# sysrc syslogd_flags=\"-a logclient.example.com -v -v\"\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1037 msgid "" "The first entry starts syslogd at system boot. The second entry allows log " "entries from the specified client. The `-v -v` increases the verbosity of " "logged messages. This is useful for tweaking facilities as administrators " "are able to see what type of messages are being logged under each facility." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1041 msgid "" "Multiple `-a` options may be specified to allow logging from multiple " "clients. IP addresses and whole netblocks may also be specified. Refer to " "man:syslogd[8] for a full list of possible options." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1043 msgid "Finally, create the log file:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1047 #, no-wrap msgid "# touch /var/log/logclient.log\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1050 msgid "At this point, syslogd should be restarted and verified:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1055 #, no-wrap msgid "" "# service syslogd restart\n" "# pgrep syslog\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1059 msgid "" "If a PID is returned, the server restarted successfully, and client " "configuration can begin. If the server did not restart, consult " "[.filename]#/var/log/messages# for the error." msgstr "" #. type: Title ==== #: documentation/content/en/books/handbook/config/_index.adoc:1060 #, no-wrap msgid "Log Client Configuration" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1064 msgid "" "A logging client sends log entries to a logging server on the network. The " "client also keeps a local copy of its own logs." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1066 msgid "" "Once a logging server has been configured, execute the following commands on " "the logging client:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1071 #, no-wrap msgid "" "# sysrc syslogd_enable=\"YES\"\n" "# sysrc syslogd_flags=\"-s -v -v\"\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1075 msgid "" "The first entry enables syslogd on boot up. The second entry prevents logs " "from being accepted by this client from other hosts (`-s`) and increases the " "verbosity of logged messages." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1078 msgid "" "Next, define the logging server in the client's [.filename]#/etc/" "syslog.conf#. In this example, all logged facilities are sent to a remote " "system, denoted by the `@` symbol, with the specified hostname:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1082 #, no-wrap msgid "*.* @logserv.example.com\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1085 msgid "After saving the edit, restart syslogd for the changes to take effect:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1089 #: documentation/content/en/books/handbook/config/_index.adoc:1120 #: documentation/content/en/books/handbook/config/_index.adoc:1143 #, no-wrap msgid "# service syslogd restart\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1092 msgid "" "To test that log messages are being sent across the network, use " "man:logger[1] on the client to send a message to syslogd:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1096 #, no-wrap msgid "# logger \"Test message from logclient\"\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1099 msgid "" "This message should now exist both in [.filename]#/var/log/messages# on the " "client and [.filename]#/var/log/logclient.log# on the log server." msgstr "" #. type: Title ==== #: documentation/content/en/books/handbook/config/_index.adoc:1100 #, no-wrap msgid "Debugging Log Servers" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1106 msgid "" "If no messages are being received on the log server, the cause is most " "likely a network connectivity issue, a hostname resolution issue, or a typo " "in a configuration file. To isolate the cause, ensure that both the logging " "server and the logging client are able to `ping` each other using the " "hostname specified in their [.filename]#/etc/rc.conf#. If this fails, check " "the network cabling, the firewall ruleset, and the hostname entries in the " "DNS server or [.filename]#/etc/hosts# on both the logging server and " "clients. Repeat until the `ping` is successful from both hosts." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1109 msgid "" "If the `ping` succeeds on both hosts but log messages are still not being " "received, temporarily increase logging verbosity to narrow down the " "configuration issue. In the following example, [.filename]#/var/log/" "logclient.log# on the logging server is empty and [.filename]#/var/log/" "messages# on the logging client does not indicate a reason for the failure." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1111 msgid "" "To increase debugging output, edit the `syslogd_flags` entry on the logging " "server and issue a restart:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1115 #, no-wrap msgid "sysrc syslogd_flags=\"-d -a logclient.example.com -v -v\"\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1123 msgid "" "Debugging data similar to the following will flash on the console " "immediately after the restart:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1134 #, no-wrap msgid "" "logmsg: pri 56, flags 4, from logserv.example.com, msg syslogd: restart\n" "syslogd: restarted\n" "logmsg: pri 6, flags 4, from logserv.example.com, msg syslogd: kernel boot file is /boot/kernel/kernel\n" "Logging to FILE /var/log/messages\n" "syslogd: kernel boot file is /boot/kernel/kernel\n" "cvthname(192.168.1.10)\n" "validate: dgram from IP 192.168.1.10, port 514, name logclient.example.com;\n" "rejected in rule 0 due to name mismatch.\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1139 msgid "" "In this example, the log messages are being rejected due to a typo which " "results in a hostname mismatch. The client's hostname should be " "`logclient`, not `logclien`. Fix the typo, issue a restart, and verify the " "results:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1161 #, no-wrap msgid "" "logmsg: pri 56, flags 4, from logserv.example.com, msg syslogd: restart\n" "syslogd: restarted\n" "logmsg: pri 6, flags 4, from logserv.example.com, msg syslogd: kernel boot file is /boot/kernel/kernel\n" "syslogd: kernel boot file is /boot/kernel/kernel\n" "logmsg: pri 166, flags 17, from logserv.example.com,\n" "msg Dec 10 20:55:02 logserv.example.com syslogd: exiting on signal 2\n" "cvthname(192.168.1.10)\n" "validate: dgram from IP 192.168.1.10, port 514, name logclient.example.com;\n" "accepted in rule 0.\n" "logmsg: pri 15, flags 0, from logclient.example.com, msg Dec 11 02:01:28 trhodes: Test message 2\n" "Logging to FILE /var/log/logclient.log\n" "Logging to FILE /var/log/messages\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1164 msgid "" "At this point, the messages are being properly received and placed in the " "correct file." msgstr "" #. type: Title ==== #: documentation/content/en/books/handbook/config/_index.adoc:1165 #, no-wrap msgid "Security Considerations" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1171 msgid "" "As with any network service, security requirements should be considered " "before implementing a logging server. Log files may contain sensitive data " "about services enabled on the local host, user accounts, and configuration " "data. Network data sent from the client to the server will not be encrypted " "or password protected. If a need for encryption exists, consider using " "package:security/stunnel[], which will transmit the logging data over an " "encrypted tunnel." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1179 msgid "" "Local security is also an issue. Log files are not encrypted during use or " "after log rotation. Local users may access log files to gain additional " "insight into system configuration. Setting proper permissions on log files " "is critical. The built-in log rotator, newsyslog, supports setting " "permissions on newly created and rotated log files. Setting log files to " "mode `600` should prevent unwanted access by local users. Refer to " "man:newsyslog.conf[5] for additional information." msgstr "" #. type: Title == #: documentation/content/en/books/handbook/config/_index.adoc:1181 #, no-wrap msgid "Power and Resource Management" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1185 msgid "" "It is important to utilize hardware resources in an efficient manner. Power " "and resource management allows the operating system to monitor system limits " "and to possibly run some actions triggered by events related to those limits." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:1187 #, no-wrap msgid "ACPI configuration" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1190 msgid "" "On FreeBSD the management of these resources is managed by the man:acpi[4] " "kernel device." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:1194 msgid "In FreeBSD the man:acpi[4] driver is loaded by default at system boot." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:1196 msgid "" "This driver *cannot be unloaded after boot* because the system bus uses it " "for various hardware interactions." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1200 msgid "" "In addition to man:acpi[4], FreeBSD has several dedicated kernel modules for " "various ACPI vendor subsystems. These modules will add some extra " "functionality like fan speed, keyboard backlit or screen brightness." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1202 msgid "The list can be obtained by running the following command:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1206 #, no-wrap msgid "% ls /boot/kernel | grep acpi\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1225 #, no-wrap msgid "" "acpi_asus.ko\n" "acpi_asus_wmi.ko\n" "acpi_dock.ko\n" "acpi_fujitsu.ko\n" "acpi_hp.ko\n" "acpi_ibm.ko\n" "acpi_panasonic.ko\n" "acpi_sony.ko\n" "acpi_toshiba.ko\n" "acpi_video.ko\n" "acpi_wmi.ko\n" "sdhci_acpi.ko\n" "uacpi.ko\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1228 msgid "" "In the event that, for example, an IBM/Lenovo laptop is used, it will be " "necessary to load the module man:acpi_ibm[4] by executing the following " "command:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1232 #, no-wrap msgid "# kldload acpi_ibm\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1235 msgid "And add this line to [.filename]#/boot/loader.conf# to load it at boot:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1239 #, no-wrap msgid "acpi_ibm_load=\"YES\"\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1247 msgid "" "An alternative to the man:acpi_video[4] module is the man:backlight[9] " "driver. It provides a generic way for handling a panel backlight. The " "default GENERIC kernel includes this driver. The man:backlight[8] utility " "can be used to query and adjust the brightness of the panel backlight. In " "this example the brightness is decreased by 10%:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1251 #, no-wrap msgid "% backlight decr 10\n" msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:1254 #, no-wrap msgid "CPU Power Management" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1258 msgid "" "CPU is the most consuming part of the system. Knowing how to improve CPU " "efficiency is a fundamental part of our system in order to save energy." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1260 msgid "" "In order to make proper use of the machine's resources in a correct way, " "FreeBSD supports technologies such as Intel Turbo Boost, AMD Turbo Core, " "Intel Speed Shift among others through the use of man:powerd[8] and " "man:cpufreq[4]." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1262 msgid "" "The first step will be to obtain the CPU information by executing the " "following command:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1266 #, no-wrap msgid "% sysctl dev.cpu.0 <.>\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1269 msgid "In this case the `0` digit represents the first core of the CPU." msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1291 #, no-wrap msgid "" "dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc/bma\n" "dev.cpu.0.cx_usage_counters: 3507294 0 0\n" "dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% last 3804us\n" "dev.cpu.0.cx_lowest: C3 <1>\n" "dev.cpu.0.cx_supported: C1/1/1 C2/2/1 C3/3/57 <2>\n" "dev.cpu.0.freq_levels: 2267/35000 2266/35000 1600/15000 800/12000 <3>\n" "dev.cpu.0.freq: 1600 <4>\n" "dev.cpu.0.temperature: 40.0C <5>\n" "dev.cpu.0.coretemp.throttle_log: 0\n" "dev.cpu.0.coretemp.tjmax: 105.0C\n" "dev.cpu.0.coretemp.resolution: 1\n" "dev.cpu.0.coretemp.delta: 65\n" "dev.cpu.0.%parent: acpi0\n" "dev.cpu.0.%pnpinfo: _HID=none _UID=0 _CID=none\n" "dev.cpu.0.%location: handle=\\_PR_.CPU0\n" "dev.cpu.0.%driver: cpu\n" "dev.cpu.0.%desc: ACPI CPU\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1294 msgid "Lowest Cx state to use for idling the CPU." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1295 msgid "CPU supported Cx states." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1296 msgid "Currently available levels for the CPU (frequency/power usage)." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1297 msgid "Current active CPU frequency in MHz." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1298 msgid "Current temperature of the CPU." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:1303 msgid "" "If the temperature information is not displayed, load the man:coretemp[4] " "module. In case of using an AMD CPU, load the man:amdtemp[4] module." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1306 msgid "" "Once the CPU information is available the easiest way to configure power " "saving is to let man:powerd[8] take over." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1308 msgid "" "Enable man:powerd[8] service in [.filename]#/etc/rc.conf# to start at system " "boot:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1312 #, no-wrap msgid "# sysrc powerd_enable=YES\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1315 msgid "" "It will also be necessary to indicate certain parameters to man:powerd[8] to " "tell it how to manage the state of the CPU executing the following command:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1319 #, no-wrap msgid "# sysrc powerd_flags=\"-a hiadaptive -i 25 -r 85 -N\"\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1322 msgid "`-a`: Selects the mode to use while on AC power." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1323 msgid "`hiadaptive`: Operation mode. More info at man:powerd[8]." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1324 msgid "" "`-i`: Specifies the CPU load percent level when adaptive mode should begin " "to degrade performance to save power." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1325 msgid "" "`-r`: Specifies the CPU load percent level where adaptive mode should " "consider the CPU running and increase performance." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1326 msgid "" "`-N`: Treat \"nice\" time as idle for the purpose of load calculation; i.e., " "do not increase the CPU frequency if the CPU is only busy with \"nice\" " "processes." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1328 msgid "And then enable the service executing the following command:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1332 #, no-wrap msgid "# service powerd start\n" msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:1335 #, no-wrap msgid "CPU Frequency Control" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1340 msgid "" "FreeBSD includes a generic man:cpufreq[4] driver to allow the administrator, " "or software such as man:powerd[8] and package:sysutils/powerdxx[], to manage " "the frequency of the CPU to achieve the desired balance between performance " "and economy. A lower setting will save power while reducing the heat " "generated by the CPU. A higher setting will increase performance at the " "cost of using additional power and generating more heat." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:1342 #, no-wrap msgid "Intel(R) Enhanced Speed Step(TM)" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1347 msgid "" "The Intel(R) Enhanced Speed Step(TM) driver, man:est[4], replaces the " "generic man:cpufreq[4] driver for CPUs that provide this feature. The CPU " "frequency can be statically adjusted using man:sysctl[8], or with the `/etc/" "rc.d/power_profile` startup script. Additional software, such as " "man:powerd[8] or package:sysutils/powerdxx[], can be used to automatically " "adjust the CPU frequency based on processor utilization." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1349 msgid "" "Each supported frequency, along with its expected power consumption, can be " "listed by examining the man:sysctl[3] tree:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1353 #, no-wrap msgid "# sysctl dev.cpufreq.0.freq_driver dev.cpu.0.freq_levels dev.cpu.0.freq\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1362 #, no-wrap msgid "" "dev.cpufreq.0.freq_driver: est0\n" "dev.cpu.0.freq_levels: 3001/53000 3000/53000 2900/50301 2700/46082 2600/43525 2400/39557 2300/37137 2100/33398 2000/31112 1800/27610 1700/25455 1500/22171 1400/20144 1200/17084 1100/15181 900/12329 800/10550\n" "dev.cpu.0.freq: 800\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1365 msgid "" "A frequency 1 MHz higher than the maximum frequency of the CPU indicates the " "Intel(R) Turbo Boost(TM) feature." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:1367 #, no-wrap msgid "Intel Speed Shift(TM)" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1373 msgid "" "Users running newer Intel(R) CPUs may find some differences in dynamic " "frequency control when upgrading to FreeBSD 13. A new driver for the " "Intel(R) Speed Shift(TM) feature set, available on certain SKUs, exposes the " "ability for the hardware to dynamically vary the core frequencies, including " "on a per core basis. FreeBSD 13 comes with the man:hwpstate_intel[4] driver " "to automatically enable Speed Shift(TM) control on equipped CPUs, replacing " "the older Enhanced Speed Step(TM) man:est[4] driver. The man:sysctl[8] " "`dev.cpufreq.%d.freq_driver` will indicate if the system is using Speed " "Shift." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1375 msgid "" "To determine which frequency control driver is being used, examining the " "`dev.cpufreq.0.freq_driver` oid." msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1379 #, no-wrap msgid "# sysctl dev.cpufreq.0.freq_driver\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1386 #, no-wrap msgid "dev.cpufreq.0.freq_driver: hwpstate_intel0\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1390 msgid "" "This indicates that the new man:hwpstate_intel[4] driver is in use. On such " "systems, the oid `dev.cpu.%d.freq_levels` will show only the maximum CPU " "frequency, and will indicate a power consumption level of `-1`." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1392 msgid "" "The current CPU frequency can be determined by examining the `dev.cpu." "%d.freq` oid." msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1396 #, no-wrap msgid "# sysctl dev.cpu.0.freq_levels dev.cpu.0.freq\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1404 #, no-wrap msgid "" "dev.cpu.0.freq_levels: 3696/-1\n" "dev.cpu.0.freq: 898\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1407 msgid "" "For more information, including on how to balance performance and energy " "use, and on how to disable this driver, refer to the man page " "man:hwpstate_intel[4]." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:1411 msgid "" "Users accustomed to using man:powerd[8] or package:sysutils/powerdxx[] will " "find these utilities have been superseded by the man:hwpstate_intel[4] " "driver and no longer work as expected." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:1414 #, no-wrap msgid "Graphics Card Power Management" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1419 msgid "" "Graphics cards have become a fundamental part of computing in recent years. " "Some graphics cards may have excessive power consumption. FreeBSD allows " "certain configurations to improve power consumption." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1421 msgid "" "In case of using a Intel(R) graphics card with the package:graphics/drm-" "kmod[] driver these options can be added to [.filename]#/boot/loader.conf#:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1427 #, no-wrap msgid "" "compat.linuxkpi.fastboot=1 <.>\n" "compat.linuxkpi.enable_dc=2 <.>\n" "compat.linuxkpi.enable_fbc=1 <.>\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1430 msgid "Try to skip unnecessary mode sets at boot time." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1431 msgid "Enable power-saving display C-states." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1432 msgid "Enable frame buffer compression for power savings" msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:1433 #, no-wrap msgid "Suspend/Resume" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1436 msgid "" "The suspend/resume function allows the machine to be kept in a state in " "which there is no a big energy consumption and allows the system to be " "resumed without having to lose the state of the running programs." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:1441 msgid "" "In order for the suspend/resume functionality to work correctly the graphics " "drivers must be loaded on the system. In non-KMS-supported graphics cards " "man:sc[4] must be used not to break the suspend/resume functionality." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:1443 msgid "" "More information about which driver to use and how to configure it can be " "found at the crossref:x11[x11, The X Window System chapter]." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1446 msgid "man:acpi[4] supports the next list of sleep states:" msgstr "" #. type: Block title #: documentation/content/en/books/handbook/config/_index.adoc:1447 #, no-wrap msgid "Supported Sleep States" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:1452 #, no-wrap msgid "S1" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:1454 #, no-wrap msgid "Quick suspend to RAM. The CPU enters a lower power state, but most peripherals are left running." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:1455 #, no-wrap msgid "S2" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:1457 #, no-wrap msgid "Lower power state than S1, but with the same basic characteristics. Not supported by many systems." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:1458 #, no-wrap msgid "S3 (Sleep mode)" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:1460 #, no-wrap msgid "Suspend to RAM. Most devices are powered off, and the system stops running except for memory refresh." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:1461 #, no-wrap msgid "S4 (Hibernation)" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:1463 #, no-wrap msgid "Suspend to disk. All devices are powered off, and the system stops running. When resuming, the system starts as if from a cold power on. *Not yet supported by FreeBSD*." msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:1464 #, no-wrap msgid "S5" msgstr "" #. type: Table #: documentation/content/en/books/handbook/config/_index.adoc:1466 #, no-wrap msgid "System shuts down cleanly and powers off." msgstr "" #. type: Title ==== #: documentation/content/en/books/handbook/config/_index.adoc:1469 #, no-wrap msgid "Configuring Suspend/Resume" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1472 msgid "" "The first step will be to know which type of sleep states supports the " "hardware we are using executing the following command:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1476 #, no-wrap msgid "% sysctl hw.acpi.supported_sleep_state\n" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1483 #, no-wrap msgid "hw.acpi.supported_sleep_state: S3 S4 S5\n" msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:1488 msgid "As stated above FreeBSD does *not* yet support the `S4` state." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1491 msgid "" "man:acpiconf[8] can be used to check if the `S3` state works correctly by " "running the following command, if it succeeds, the screen should go black " "and the machine will turn off:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1495 #, no-wrap msgid "# acpiconf -s 3\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1498 msgid "" "In the vast majority of cases the Suspend/Resume functionality wants to be " "used on a laptop." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1500 msgid "" "FreeBSD can be configured to enter the `S3` state when closing the lid by " "adding the following line to the [.filename]#/etc/sysctl.conf# file." msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1504 #, no-wrap msgid "hw.acpi.lid_switch_state=S3\n" msgstr "" #. type: Title ==== #: documentation/content/en/books/handbook/config/_index.adoc:1507 #, no-wrap msgid "Troubleshooting in Suspend/Resume" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1511 msgid "" "A lot of effort has been made to make the Suspend and Resume functions work " "properly and in the best way on FreeBSD. But currently the Suspend and " "Resume functions only work properly on some specific laptops." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1513 msgid "Some checks can be done in case it doesn't work properly." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1516 msgid "" "In some cases it is enough to turn off the bluetooth. In others it is " "enough loading the correct driver for the graphics card, etc." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1518 msgid "" "In case it doesn't work correctly, some tips can be found on the FreeBSD " "Wiki in the section link:https://wiki.freebsd.org/SuspendResume[Suspend/" "Resume]." msgstr "" #. type: Title == #: documentation/content/en/books/handbook/config/_index.adoc:1520 #, no-wrap msgid "Adding Swap Space" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1524 msgid "" "Sometimes a FreeBSD system requires more swap space. This section describes " "two methods to increase swap space: adding swap to an existing partition or " "new hard drive, and creating a swap file on an existing file system." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1526 msgid "" "For information on how to encrypt swap space, which options exist, and why " "it should be done, refer to crossref:disks[swap-encrypting,“Encrypting " "Swap”]." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:1528 #, no-wrap msgid "Swap on a New Hard Drive or Existing Partition" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1532 msgid "" "Adding a new drive for swap gives better performance than using a partition " "on an existing drive. Setting up partitions and drives is explained in " "crossref:disks[disks-adding,\"Adding Disks\"] while " "crossref:bsdinstall[configtuning-initial,\"Designing the Partition Layout\"] " "discusses partition layouts and swap partition size considerations." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:1538 msgid "" "It is possible to use any partition not currently mounted, even if it " "already contains data. Using `swapon` on a partition that contains data " "will overwrite and destroy that data. Make sure that the partition to be " "added as swap is really the intended partition before running `swapon`." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1541 msgid "" "man:swapon[8] can be used to add a swap partition to the system executing " "the following command:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1545 #, no-wrap msgid "# swapon /dev/ada1p2\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1548 msgid "" "To automatically add this swap partition on boot, add an entry to " "[.filename]#/etc/fstab#:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1552 #, no-wrap msgid "/dev/ada1p2 none swap sw 0 0\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1555 msgid "" "See man:fstab[5] for an explanation of the entries in [.filename]#/etc/" "fstab#." msgstr "" #. type: Title === #: documentation/content/en/books/handbook/config/_index.adoc:1557 #, no-wrap msgid "Creating a Swap File" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1561 msgid "These examples create a 512M swap file called [.filename]#/usr/swap0#." msgstr "" #. type: delimited block = 4 #: documentation/content/en/books/handbook/config/_index.adoc:1565 msgid "" "Swap files on ZFS file systems are strongly discouraged, as swapping can " "lead to system hangs." msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1568 msgid "The first step is to create the swap file:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1572 #, no-wrap msgid "# dd if=/dev/zero of=/usr/swap0 bs=1m count=512\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1575 msgid "The second step is to put the proper permissions on the new file:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1579 #, no-wrap msgid "# chmod 0600 /usr/swap0\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1582 msgid "" "The third step is to inform the system about the swap file by adding a line " "to [.filename]#/etc/fstab#:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1586 #, no-wrap msgid "md none swap sw,file=/usr/swap0,late 0 0\n" msgstr "" #. type: Plain text #: documentation/content/en/books/handbook/config/_index.adoc:1589 msgid "" "Swap space will be added on system startup. To add swap space immediately, " "use man:swapon[8]:" msgstr "" #. type: delimited block . 4 #: documentation/content/en/books/handbook/config/_index.adoc:1593 #, no-wrap msgid "# swapon -aL\n" msgstr ""