{
    "mode": "man",
    "parameter": "systemd-firstboot.service",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/systemd-firstboot.service/1/json",
    "generated": "2026-10-06T05:04:26Z",
    "synopsis": "systemd-firstboot [OPTIONS...]\nsystemd-firstboot.service",
    "sections": {
        "NAME": {
            "content": "systemd-firstboot, systemd-firstboot.service - Initialize basic system settings on or before\nthe first boot-up of a system\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "systemd-firstboot [OPTIONS...]\n\nsystemd-firstboot.service\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "systemd-firstboot initializes basic system settings interactively during the first boot, or\nnon-interactively on an offline system image. The service is started during boot if\nConditionFirstBoot=yes is met, which essentially means that /etc/ is unpopulated, see\nsystemd.unit(5) for details.\n\nThe following settings may be configured:\n\n•   The machine ID of the system\n\n•   The system locale, more specifically the two locale variables LANG= and LCMESSAGES\n\n•   The system keyboard map\n\n•   The system time zone\n\n•   The system hostname\n\n•   The kernel command line used when installing kernel images\n\n•   The root user's password and shell\n\nEach of the fields may either be queried interactively by users, set non-interactively on the\ntool's command line, or be copied from a host system that is used to set up the system image.\n\nIf a setting is already initialized, it will not be overwritten and the user will not be\nprompted for the setting.\n\nNote that this tool operates directly on the file system and does not involve any running\nsystem services, unlike localectl(1), timedatectl(1) or hostnamectl(1). This allows\nsystemd-firstboot to operate on mounted but not booted disk images and in early boot. It is\nnot recommended to use systemd-firstboot on the running system after it has been set up.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The following options are understood:\n\n--root=root\nTakes a directory path as an argument. All paths will be prefixed with the given\nalternate root path, including config search paths. This is useful to operate on a system\nimage mounted to the specified directory instead of the host system itself.\n\nAdded in version 216.\n\n--image=path\nTakes a path to a disk image file or block device node. If specified all operations are\napplied to file system in the indicated disk image. This is similar to --root= but\noperates on file systems stored in disk images or block devices. The disk image should\neither contain just a file system or a set of file systems within a GPT partition table,\nfollowing the Discoverable Partitions Specification[1]. For further information on\nsupported disk images, see systemd-nspawn(1)'s switch of the same name.\n\nAdded in version 246.\n\n--locale=LOCALE, --locale-messages=LOCALE\nSets the system locale, more specifically the LANG= and LCMESSAGES settings. The\nargument should be a valid locale identifier, such as \"deDE.UTF-8\". This controls the\nlocale.conf(5) configuration file.\n\nAdded in version 216.\n\n--keymap=KEYMAP\nSets the system keyboard layout. The argument should be a valid keyboard map, such as\n\"de-latin1\". This controls the \"KEYMAP\" entry in the vconsole.conf(5) configuration file.\n\nAdded in version 236.\n\n--timezone=TIMEZONE\nSets the system time zone. The argument should be a valid time zone identifier, such as\n\"Europe/Berlin\". This controls the localtime(5) symlink.\n\nAdded in version 216.\n\n--hostname=HOSTNAME\nSets the system hostname. The argument should be a hostname, compatible with DNS. This\ncontrols the hostname(5) configuration file.\n\nAdded in version 216.\n",
            "subsections": [
                {
                    "name": "--setup-machine-id",
                    "content": "Initialize the system's machine ID to a random ID. This controls the machine-id(5) file.\n\nThis option only works in combination with --root= or --image=. On a running system,\nmachine-id is written by the manager with help from systemd-machine-id-commit.service(8).\n\nAdded in version 216.\n\n--machine-id=ID\nSet the system's machine ID to the specified value. The same restrictions apply as to\n--setup-machine-id.\n\nAdded in version 216.\n\n--root-password=PASSWORD, --root-password-file=PATH, --root-password-hashed=HASHEDPASSWORD\nSets the password of the system's root user. This creates/modifies the passwd(5) and\nshadow(5) files. This setting exists in three forms: --root-password= accepts the\npassword to set directly on the command line, --root-password-file= reads it from a file\nand --root-password-hashed= accepts an already hashed password on the command line. See\nshadow(5) for more information on the format of the hashed password. Note that it is not\nrecommended to specify plaintext passwords on the command line, as other users might be\nable to see them simply by invoking ps(1).\n\nAdded in version 216.\n\n--root-shell=SHELL\nSets the shell of the system's root user. This creates/modifies the passwd(5) file.\n\nAdded in version 246.\n\n--kernel-command-line=CMDLINE\nSets the system's kernel command line. This controls the /etc/kernel/cmdline file which\nis used by kernel-install(8).\n\nAdded in version 246.\n\n--prompt-locale, --prompt-keymap, --prompt-timezone, --prompt-hostname,\n--prompt-root-password, --prompt-root-shell\nPrompt the user interactively for a specific basic setting. Note that any explicit\nconfiguration settings specified on the command line take precedence, and the user is not\nprompted for it.\n\nAdded in version 216.\n",
                    "long": "--setup-machine-id"
                },
                {
                    "name": "--prompt",
                    "content": "Query the user for locale, keymap, timezone, hostname, root's password, and root's shell.\nThis is equivalent to specifying --prompt-locale, --prompt-keymap, --prompt-timezone,\n--prompt-hostname, --prompt-root-password, --prompt-root-shell in combination.\n\nAdded in version 216.\n\n--copy-locale, --copy-keymap, --copy-timezone, --copy-root-password, --copy-root-shell\nCopy a specific basic setting from the host. This only works in combination with --root=\nor --image=.\n\nAdded in version 216.\n",
                    "long": "--prompt"
                },
                {
                    "name": "--copy",
                    "content": "Copy locale, keymap, time zone, root password and shell from the host. This is equivalent\nto specifying --copy-locale, --copy-keymap, --copy-timezone, --copy-root-password,\n--copy-root-shell in combination.\n\nAdded in version 216.\n",
                    "long": "--copy"
                },
                {
                    "name": "--force",
                    "content": "Write configuration even if the relevant files already exist. Without this option,\nsystemd-firstboot doesn't modify or replace existing files. Note that when configuring\nthe root account, even with this option, systemd-firstboot only modifies the entry of the\n\"root\" user, leaving other entries in /etc/passwd and /etc/shadow intact.\n\nAdded in version 246.\n",
                    "long": "--force"
                },
                {
                    "name": "--reset",
                    "content": "If specified, all existing files that are configured by systemd-firstboot are removed.\nNote that the files are removed regardless of whether they'll be configured with a new\nvalue or not. This operation ensures that the next boot of the image will be considered a\nfirst boot, and systemd-firstboot will prompt again to configure each of the removed\nfiles.\n\nAdded in version 254.\n",
                    "long": "--reset"
                },
                {
                    "name": "--delete-root-password",
                    "content": "Removes the password of the system's root user, enabling login as root without a password\nunless the root account is locked. Note that this is extremely insecure and hence this\noption should not be used lightly.\n\nAdded in version 246.\n",
                    "long": "--delete-root-password"
                },
                {
                    "name": "--welcome=",
                    "content": "Takes a boolean argument. By default when prompting the user for configuration options a\nbrief welcome text is shown before the first question is asked. Pass false to this option\nto turn off the welcome text.\n\nAdded in version 246.\n"
                },
                {
                    "name": "-h --help",
                    "content": "Print a short help text and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "--version",
                    "content": "Print a short version string and exit.\n",
                    "long": "--version"
                }
            ]
        },
        "CREDENTIALS": {
            "content": "systemd-firstboot supports the service credentials logic as implemented by\nImportCredential=/LoadCredential=/SetCredential= (see systemd.exec(5) for details). The\nfollowing credentials are used when passed in:\n\npasswd.hashed-password.root, passwd.plaintext-password.root\nA hashed or plaintext version of the root password to use, in place of prompting the\nuser. These credentials are equivalent to the same ones defined for the systemd-\nsysusers.service(8) service.\n\nAdded in version 249.\n\npasswd.shell.root\nSpecifies the shell binary to use for the specified account. Equivalent to the credential\nof the same name defined for the systemd-sysusers.service(8) service.\n\nAdded in version 249.\n\nfirstboot.locale, firstboot.locale-messages\nThese credentials specify the locale settings to set during first boot, in place of\nprompting the user.\n\nAdded in version 249.\n\nfirstboot.keymap\nThis credential specifies the keyboard setting to set during first boot, in place of\nprompting the user.\n\nNote the relationship to the vconsole.keymap credential understood by systemd-vconsole-\nsetup.service(8): both ultimately affect the same setting, but firstboot.keymap is\nwritten into /etc/vconsole.conf on first boot (if not already configured), and then read\nfrom there by systemd-vconsole-setup, while vconsole.keymap is read on every boot, and is\nnot persisted to disk (but any configuration in vconsole.conf will take precedence if\npresent).\n\nAdded in version 249.\n\nfirstboot.timezone\nThis credential specifies the system timezone setting to set during first boot, in place\nof prompting the user.\n\nAdded in version 249.\n\nNote that by default the systemd-firstboot.service unit file is set up to inherit the listed\ncredentials from the service manager. Thus, when invoking a container with an unpopulated\n/etc/ for the first time it is possible to configure the root user's password to be \"systemd\"\nlike this:\n\n# systemd-nspawn --image=... --set-credential=firstboot.locale:deDE.UTF-8 ...\n\nNote that these credentials are only read and applied during the first boot process. Once\nthey are applied they remain applied for subsequent boots, and the credentials are not\nconsidered anymore.\n",
            "subsections": []
        },
        "EXIT STATUS": {
            "content": "On success, 0 is returned, a non-zero failure code otherwise.\n",
            "subsections": []
        },
        "KERNEL COMMAND LINE": {
            "content": "systemd.firstboot=\nTakes a boolean argument, defaults to on. If off, systemd-firstboot.service won't\ninteractively query the user for basic settings at first boot, even if those settings are\nnot initialized yet.\n\nAdded in version 233.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "systemd(1), locale.conf(5), vconsole.conf(5), localtime(5), hostname(5), machine-id(5),\nshadow(5), systemd-machine-id-setup(1), localectl(1), timedatectl(1), hostnamectl(1)\n",
            "subsections": []
        },
        "NOTES": {
            "content": "1. Discoverable Partitions Specification\nhttps://uapi-group.org/specifications/specs/discoverablepartitionsspecification\n\nsystemd 255                                                                     SYSTEMD-FIRSTBOOT(1)",
            "subsections": []
        }
    },
    "summary": "systemd-firstboot, systemd-firstboot.service - Initialize basic system settings on or before the first boot-up of a system",
    "flags": [
        {
            "flag": "",
            "long": "--setup-machine-id",
            "arg": null,
            "description": "Initialize the system's machine ID to a random ID. This controls the machine-id(5) file. This option only works in combination with --root= or --image=. On a running system, machine-id is written by the manager with help from systemd-machine-id-commit.service(8). Added in version 216. --machine-id=ID Set the system's machine ID to the specified value. The same restrictions apply as to --setup-machine-id. Added in version 216. --root-password=PASSWORD, --root-password-file=PATH, --root-password-hashed=HASHEDPASSWORD Sets the password of the system's root user. This creates/modifies the passwd(5) and shadow(5) files. This setting exists in three forms: --root-password= accepts the password to set directly on the command line, --root-password-file= reads it from a file and --root-password-hashed= accepts an already hashed password on the command line. See shadow(5) for more information on the format of the hashed password. Note that it is not recommended to specify plaintext passwords on the command line, as other users might be able to see them simply by invoking ps(1). Added in version 216. --root-shell=SHELL Sets the shell of the system's root user. This creates/modifies the passwd(5) file. Added in version 246. --kernel-command-line=CMDLINE Sets the system's kernel command line. This controls the /etc/kernel/cmdline file which is used by kernel-install(8). Added in version 246. --prompt-locale, --prompt-keymap, --prompt-timezone, --prompt-hostname, --prompt-root-password, --prompt-root-shell Prompt the user interactively for a specific basic setting. Note that any explicit configuration settings specified on the command line take precedence, and the user is not prompted for it. Added in version 216."
        },
        {
            "flag": "",
            "long": "--prompt",
            "arg": null,
            "description": "Query the user for locale, keymap, timezone, hostname, root's password, and root's shell. This is equivalent to specifying --prompt-locale, --prompt-keymap, --prompt-timezone, --prompt-hostname, --prompt-root-password, --prompt-root-shell in combination. Added in version 216. --copy-locale, --copy-keymap, --copy-timezone, --copy-root-password, --copy-root-shell Copy a specific basic setting from the host. This only works in combination with --root= or --image=. Added in version 216."
        },
        {
            "flag": "",
            "long": "--copy",
            "arg": null,
            "description": "Copy locale, keymap, time zone, root password and shell from the host. This is equivalent to specifying --copy-locale, --copy-keymap, --copy-timezone, --copy-root-password, --copy-root-shell in combination. Added in version 216."
        },
        {
            "flag": "",
            "long": "--force",
            "arg": null,
            "description": "Write configuration even if the relevant files already exist. Without this option, systemd-firstboot doesn't modify or replace existing files. Note that when configuring the root account, even with this option, systemd-firstboot only modifies the entry of the \"root\" user, leaving other entries in /etc/passwd and /etc/shadow intact. Added in version 246."
        },
        {
            "flag": "",
            "long": "--reset",
            "arg": null,
            "description": "If specified, all existing files that are configured by systemd-firstboot are removed. Note that the files are removed regardless of whether they'll be configured with a new value or not. This operation ensures that the next boot of the image will be considered a first boot, and systemd-firstboot will prompt again to configure each of the removed files. Added in version 254."
        },
        {
            "flag": "",
            "long": "--delete-root-password",
            "arg": null,
            "description": "Removes the password of the system's root user, enabling login as root without a password unless the root account is locked. Note that this is extremely insecure and hence this option should not be used lightly. Added in version 246."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Takes a boolean argument. By default when prompting the user for configuration options a brief welcome text is shown before the first question is asked. Pass false to this option to turn off the welcome text. Added in version 246."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Print a short help text and exit."
        },
        {
            "flag": "",
            "long": "--version",
            "arg": null,
            "description": "Print a short version string and exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "systemd",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/systemd/1/json"
        },
        {
            "name": "locale.conf",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/locale.conf/5/json"
        },
        {
            "name": "vconsole.conf",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/vconsole.conf/5/json"
        },
        {
            "name": "localtime",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/localtime/5/json"
        },
        {
            "name": "hostname",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/hostname/5/json"
        },
        {
            "name": "machine-id",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/machine-id/5/json"
        },
        {
            "name": "shadow",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/shadow/5/json"
        },
        {
            "name": "systemd-machine-id-setup",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/systemd-machine-id-setup/1/json"
        },
        {
            "name": "localectl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/localectl/1/json"
        },
        {
            "name": "timedatectl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/timedatectl/1/json"
        },
        {
            "name": "hostnamectl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/hostnamectl/1/json"
        }
    ],
    "tldr": {
        "source": "not_found",
        "examples": []
    }
}