{
    "content": [
        {
            "type": "text",
            "text": "# SYSTEMD.PRESET (info)\n\n## NAME\n\nsystemd.preset - Service enablement presets\n\n## SYNOPSIS\n\n/etc/systemd/system-preset/*.preset\n/run/systemd/system-preset/*.preset\n/lib/systemd/system-preset/*.preset\n/etc/systemd/user-preset/*.preset\n/run/systemd/user-preset/*.preset\n/usr/lib/systemd/user-preset/*.preset\n\n## DESCRIPTION\n\nPreset files may be used to encode policy which units shall be enabled\nby default and which ones shall be disabled. They are read by systemctl\npreset which uses this information to enable or disable a unit.\nDepending on that policy, systemctl preset is identical to systemctl\nenable or systemctl disable.  systemctl preset is used by the post\ninstall scriptlets of rpm packages (or other OS package formats), to\nenable/disable specific units by default on package installation,\nenforcing distribution, spin or administrator preset policy. This\nallows choosing a certain set of units to be enabled/disabled even\nbefore installing the actual package. For more information, see\nsystemctl(1).\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **PRESET FILE FORMAT**\n- **EXAMPLES**\n- **MOTIVATION FOR THE PRESET LOGIC**\n- **SEE ALSO**\n- **NOTES**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "SYSTEMD.PRESET",
        "section": "",
        "mode": "info",
        "summary": "systemd.preset - Service enablement presets",
        "synopsis": "/etc/systemd/system-preset/*.preset\n/run/systemd/system-preset/*.preset\n/lib/systemd/system-preset/*.preset\n/etc/systemd/user-preset/*.preset\n/run/systemd/user-preset/*.preset\n/usr/lib/systemd/user-preset/*.preset",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "Example 1. Default to off",
            "# /lib/systemd/system-preset/99-default.preset",
            "disable *",
            "This disables all units. Due to the filename prefix \"99-\", it will be",
            "read last and hence can easily be overridden by spin or administrator",
            "preset policy.",
            "Example 2. Enable multiple template instances",
            "# /lib/systemd/system-preset/80-dirsrv.preset",
            "enable dirsrv@.service foo bar baz",
            "This enables all three of dirsrv@foo.service, dirsrv@bar.service and",
            "dirsrv@baz.service.",
            "Example 3. A GNOME spin",
            "# /lib/systemd/system-preset/50-gnome.preset",
            "enable gdm.service",
            "enable colord.service",
            "enable accounts-daemon.service",
            "enable avahi-daemon.*",
            "This enables the three mentioned units, plus all avahi-daemon",
            "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.",
            "Example 4. Administrator policy",
            "# /etc/systemd/system-preset/00-lennart.preset",
            "enable httpd.service",
            "enable sshd.service",
            "enable postfix.service",
            "disable *",
            "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 \"00-\" it will be",
            "read early and override all other preset policy files."
        ],
        "see_also": [
            {
                "name": "systemd",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/systemd/1/json"
            },
            {
                "name": "systemctl",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/systemctl/1/json"
            },
            {
                "name": "systemd-delta",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/systemd-delta/1/json"
            },
            {
                "name": "daemon",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/daemon/7/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 22,
                "subsections": []
            },
            {
                "name": "PRESET FILE FORMAT",
                "lines": 34,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 49,
                "subsections": []
            },
            {
                "name": "MOTIVATION FOR THE PRESET LOGIC",
                "lines": 36,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 4,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "systemd.preset - Service enablement presets\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "/etc/systemd/system-preset/*.preset\n\n/run/systemd/system-preset/*.preset\n\n/lib/systemd/system-preset/*.preset\n\n/etc/systemd/user-preset/*.preset\n\n/run/systemd/user-preset/*.preset\n\n/usr/lib/systemd/user-preset/*.preset\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Preset files may be used to encode policy which units shall be enabled\nby default and which ones shall be disabled. They are read by systemctl\npreset which uses this information to enable or disable a unit.\nDepending on that policy, systemctl preset is identical to systemctl\nenable or systemctl disable.  systemctl preset is used by the post\ninstall scriptlets of rpm packages (or other OS package formats), to\nenable/disable specific units by default on package installation,\nenforcing distribution, spin or administrator preset policy. This\nallows choosing a certain set of units to be enabled/disabled even\nbefore installing the actual package. For more information, see\nsystemctl(1).\n\nIt is not recommended to ship preset files within the respective\nsoftware packages implementing the units, but rather centralize them in\na distribution or spin default policy, which can be amended by\nadministrator policy, see below.\n\nIf no preset files exist, systemctl preset will enable all units that\nare installed by default. If this is not desired and all units shall\nrather be disabled, it is necessary to ship a preset file with a\nsingle, catchall \"disable *\" line. (See example 1, below.)\n",
                "subsections": []
            },
            "PRESET FILE FORMAT": {
                "content": "The preset files contain a list of directives consisting of either the\nword \"enable\" or \"disable\" followed by a space and a unit name\n(possibly with shell style wildcards), separated by newlines. Empty\nlines and lines whose first non-whitespace character is \"#\" or \";\" are\nignored. Multiple instance names for unit templates may be specified as\na space separated list at the end of the line instead of the customary\nposition between \"@\" and the unit suffix.\n\nPresets must refer to the \"real\" unit file, and not to any aliases. See\nsystemd.unit(5) for a description of unit aliasing.\n\nTwo different directives are understood: \"enable\" may be used to enable\nunits by default, \"disable\" to disable units by default.\n\nIf multiple lines apply to a unit name, the first matching one takes\nprecedence over all others.\n\nEach preset file shall be named in the style of\n<priority>-<policy-name>.preset. Files in /etc/ override files with the\nsame name in /usr/lib/ and /run/. Files in /run/ override files with\nthe same name in /lib/. Packages should install their preset files in\n/lib/. Files in /etc/ are reserved for the local administrator, who may\nuse this logic to override the preset files installed by vendor\npackages. All preset files are sorted by their filename in\nlexicographic order, regardless of which of the directories they reside\nin. If multiple files specify the same unit name, the entry in the file\nwith the lexicographically earliest name will be applied. It is\nrecommended to prefix all filenames with a two-digit number and a dash,\nto simplify the ordering of the files.\n\nIf the administrator wants to disable a preset file supplied by the\nvendor, the recommended way is to place a symlink to /dev/null in\n/etc/systemd/system-preset/ bearing the same filename.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "Example 1. Default to off\n\n# /lib/systemd/system-preset/99-default.preset\n\ndisable *\n\nThis disables all units. Due to the filename prefix \"99-\", it will be\nread last and hence can easily be overridden by spin or administrator\npreset policy.\n\nExample 2. Enable multiple template instances\n\n# /lib/systemd/system-preset/80-dirsrv.preset\n\nenable dirsrv@.service foo bar baz\n\nThis enables all three of dirsrv@foo.service, dirsrv@bar.service and\ndirsrv@baz.service.\n\nExample 3. A GNOME spin\n\n# /lib/systemd/system-preset/50-gnome.preset\n\nenable gdm.service\nenable colord.service\nenable accounts-daemon.service\nenable avahi-daemon.*\n\nThis enables the three mentioned units, plus all avahi-daemon\nregardless of which unit type. A file like this could be useful for\ninclusion in a GNOME spin of a distribution. It will ensure that the\nunits necessary for GNOME are properly enabled as they are installed.\nIt leaves all other units untouched, and subject to other (later)\npreset files, for example like the one from the first example above.\n\nExample 4. Administrator policy\n\n# /etc/systemd/system-preset/00-lennart.preset\n\nenable httpd.service\nenable sshd.service\nenable postfix.service\ndisable *\n\nThis enables three specific services and disables all others. This is\nuseful for administrators to specifically select the units to enable,\nand disable all others. Due to the filename prefix \"00-\" it will be\nread early and override all other preset policy files.\n",
                "subsections": []
            },
            "MOTIVATION FOR THE PRESET LOGIC": {
                "content": "Different distributions have different policies on which services shall\nbe enabled by default when the package they are shipped in is\ninstalled. On Fedora all services stay off by default, so that\ninstalling a package will not cause a service to be enabled (with some\nexceptions). On Debian all services are immediately enabled by default,\nso that installing a package will cause its services to be enabled\nright-away.\n\nEven within a single distribution, different spins (flavours, remixes,\nwhatever you might want to call them) of a distribution also have\ndifferent policies on what services to enable, and what services to\nleave off. For example, Fedora Workstation will enable gdm as display\nmanager by default, while the Fedora KDE spin will enable sddm instead.\n\nDifferent sites might also have different policies what to turn on by\ndefault and what to turn off. For example, one administrator would\nprefer to enforce the policy of \"sshd should be always on, but\neverything else off\", while another one might say \"snmpd always on, and\nfor everything else use the distribution policy defaults\".\n\nTraditionally, policy about which services shall be enabled were\nimplemented in each package individually. This made it cumbersome to\nimplement different policies per spin or per site, or to create\nsoftware packages that do the right thing on more than one\ndistribution. The enablement mechanism was also encoding the enablement\npolicy.\n\nThe preset mechanism allows clean separation of the enablement\nmechanism (inside the package scriptlets, by invoking systemctl preset)\nand enablement policy (centralized in the preset files), and lifts the\nconfiguration out of individual packages. Preset files may be written\nfor specific distributions, for specific spins or for specific sites,\nin order to enforce different policies as needed. It is recommended to\napply the policy encoded in preset files in package installation\nscriptlets.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "systemd(1), systemctl(1), systemd-delta(1)\n\ndaemon(7) has a discussion of packaging scriptlets.\n\nFedora page introducing the use of presets: Features/PackagePresets[1].\n",
                "subsections": []
            },
            "NOTES": {
                "content": "1. Features/PackagePresets\nhttps://fedoraproject.org/wiki/Features/PackagePresets\n\nsystemd 249                                                  SYSTEMD.PRESET(5)",
                "subsections": []
            }
        }
    }
}