{"id":4688,"date":"2022-12-20T18:36:46","date_gmt":"2022-12-20T21:36:46","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/systemd-preset-man5\/"},"modified":"2022-12-20T18:36:46","modified_gmt":"2022-12-20T21:36:46","slug":"systemd-preset-man5","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/systemd-preset-man5\/","title":{"rendered":"SYSTEMD.PRESET (man5)"},"content":{"rendered":"<h1 align=\"center\">SYSTEMD.PRESET<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#PRESET FILE FORMAT\">PRESET FILE FORMAT<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">systemd.preset \u2212 Service enablement presets<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">\/etc\/systemd\/system\u2212preset\/*.preset<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/run\/systemd\/system\u2212preset\/*.preset<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/usr\/lib\/systemd\/system\u2212preset\/*.preset<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/etc\/systemd\/user\u2212preset\/*.preset<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/run\/systemd\/user\u2212preset\/*.preset<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/usr\/lib\/systemd\/user\u2212preset\/*.preset<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Preset files may be used to encode policy which units shall be enabled by default and which ones shall be disabled. They are read by <b>systemctl preset<\/b> (for more information see <b>systemctl<\/b>(1)) which uses this information to enable or disable a unit according to preset policy. <b>systemctl preset<\/b> is used by the post install scriptlets of RPM packages (or other OS package formats), to enable\/disable specific units by default on package installation, enforcing distribution, spin or administrator preset policy. This allows choosing a certain set of units to be enabled\/disabled even before installing the actual package.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">For more information on the preset logic please have a look at the <b><font color=\"#0000FF\">Presets<\/font><\/b> <small><font color=\"#000000\">[1]<\/font><\/small> <font color=\"#000000\">document.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">It is not recommended to ship preset files within the respective software packages implementing the units, but rather centralize them in a distribution or spin default policy, which can be amended by administrator policy.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">If no preset files exist, <b>systemctl preset<\/b> will enable all units that are installed by default. If this is not desired and all units shall rather be disabled, it is necessary to ship a preset file with a single, catchall &#8220;disable *&#8221; line. (See example 1, below.)<\/font><\/p>\n<h2>PRESET FILE FORMAT <a name=\"PRESET FILE FORMAT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">The preset files contain a list of directives consisting of either the word &#8220;enable&#8221; or &#8220;disable&#8221; followed by a space and a unit name (possibly with shell style wildcards), separated by newlines. Empty lines and lines whose first non\u2212whitespace character is &#8220;#&#8221; or &#8220;;&#8221; are ignored. Multiple instance names for unit templates may be specified as a space separated list at the end of the line instead of the customary position between &#8220;@&#8221; and the unit suffix.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">Presets must refer to the &#8220;real&#8221; unit file, and not to any aliases. See <b>systemd.unit<\/b>(5) for a description of unit aliasing.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">Two different directives are understood: &#8220;enable&#8221; may be used to enable units by default, &#8220;disable&#8221; to disable units by default.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">If multiple lines apply to a unit name, the first matching one takes precedence over all others.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">Each preset file shall be named in the style of <priority>\u2212<policy\u2212name>.preset. Files in \/etc\/ override files with the same name in \/usr\/lib\/ and \/run\/. Files in \/run\/ override files with the same name in \/usr\/lib\/. Packages should install their preset files in \/usr\/lib\/. Files in \/etc\/ are reserved for the local administrator, who may use this logic to override the preset files installed by vendor packages. All preset files are sorted by their filename in lexicographic order, regardless of which of the directories they reside in. If multiple files specify the same unit name, the entry in the file with the lexicographically earliest name will be applied. It is recommended to prefix all filenames with a two\u2212digit number and a dash, to simplify the ordering of the files.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">If the administrator wants to disable a preset file supplied by the vendor, the recommended way is to place a symlink to \/dev\/null in \/etc\/systemd\/system\u2212preset\/ bearing the same filename.<\/font><\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><b>Example\u00a01.\u00a0Default to off<\/b><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"># \/usr\/lib\/systemd\/system\u2212preset\/99\u2212default.preset<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">disable *<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">This disables all units. Due to the filename prefix &#8220;99\u2212&#8221;, it will be read last and hence can easily be overridden by spin or administrator preset policy.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><b>Example\u00a02.\u00a0Enable multiple template instances<\/b><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"># \/usr\/lib\/systemd\/system\u2212preset\/80\u2212dirsrv.preset<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">enable dirsrv@.service foo bar baz<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">This enables all three of dirsrv@foo.service, dirsrv@bar.service and dirsrv@baz.service.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><b>Example\u00a03.\u00a0A GNOME spin<\/b><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"># \/usr\/lib\/systemd\/system\u2212preset\/50\u2212gnome.preset<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">enable gdm.service <br \/> enable colord.service <br \/> enable accounts\u2212daemon.service <br \/> enable avahi\u2212daemon.*<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">This enables the three mentioned units, plus all avahi\u2212daemon regardless of which unit type. A file like this could be useful for inclusion in a GNOME spin of a distribution. It will ensure that the units necessary for GNOME are properly enabled as they are installed. It leaves all other units untouched, and subject to other (later) preset files, for example like the one from the first example above.<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><b>Example\u00a04.\u00a0Administrator policy<\/b><\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\"># \/etc\/systemd\/system\u2212preset\/00\u2212lennart.preset<\/font><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><font color=\"#000000\">enable httpd.service <br \/> enable sshd.service <br \/> enable postfix.service <br \/> disable *<\/font><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\">This enables three specific services and disables all others. This is useful for administrators to specifically select the units to enable, and disable all others. Due to the filename prefix &#8220;00\u2212&#8221; it will be read early and override all other preset policy files.<\/font><\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><font color=\"#000000\"><b>systemd<\/b>(1), <b>systemctl<\/b>(1), <b>systemd-delta<\/b>(1)<\/font><\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\">1.<\/font><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"11%\">\n<p style=\"margin-top: 1em\"><font color=\"#000000\">Presets<\/font><\/p>\n<\/td>\n<td width=\"72%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><font color=\"#000000\">https:\/\/www.freedesktop.org\/wiki\/Software\/systemd\/Preset<\/font><\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  systemd.preset \u2212 Service enablement presets <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[959],"tags":[961,1291,978],"class_list":["post-4688","post","type-post","status-publish","format-standard","hentry","category-5-formatos-de-ficheros","tag-961","tag-man5","tag-systemd"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=4688"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4688\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=4688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=4688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=4688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}