systemd-firstbootsystemdsystemd-firstboot1systemd-firstbootsystemd-firstboot.serviceInitialize basic system settings on or before the first boot-up of a systemsystemd-firstbootOPTIONSsystemd-firstboot.serviceDescriptionsystemd-firstboot initializes basic system settings interactively during the
first boot, or non-interactively on an offline system image. The service is started during boot if
ConditionFirstBoot=yes is met, which essentially means that /etc/
is unpopulated, see
systemd.unit5 for
details.The following settings may be configured:The machine ID of the systemThe system locale, more specifically the two
locale variables LANG= and
LC_MESSAGESThe system keyboard mapThe system time zoneThe system hostnameThe kernel command line used when installing kernel imagesThe root user's password and shellEach of the fields may either be queried interactively by
users, set non-interactively on the tool's command line, or be
copied from a host system that is used to set up the system
image.If a setting is already initialized, it will not be
overwritten and the user will not be prompted for the
setting.Note that this tool operates directly on the file system and
does not involve any running system services, unlike
localectl1,
timedatectl1
or
hostnamectl1.
This allows systemd-firstboot to operate on
mounted but not booted disk images and in early boot. It is not
recommended to use systemd-firstboot on the
running system after it has been set up.OptionsThe following options are understood:Takes a directory path as an argument. All
paths will be prefixed with the given alternate
root path, including config search
paths. This is useful to operate on a system image mounted to
the specified directory instead of the host system itself.
Takes a path to a disk image file or block device node. If specified all operations
are applied to file system in the indicated disk image. This is similar to
but operates on file systems stored in disk images or block devices. The disk image should either
contain just a file system or a set of file systems within a GPT partition table, following the
Discoverable Partitions
Specification. For further information on supported disk images, see
systemd-nspawn1's
switch of the same name.Sets the system locale, more specifically the
LANG= and LC_MESSAGES
settings. The argument should be a valid locale identifier,
such as de_DE.UTF-8. This controls the
locale.conf5
configuration file.Sets the system keyboard layout. The argument should be a valid keyboard map,
such as de-latin1. This controls the KEYMAP entry in the
vconsole.conf5
configuration file.Sets the system time zone. The argument should
be a valid time zone identifier, such as
Europe/Berlin. This controls the
localtime5
symlink.Sets the system hostname. The argument should
be a hostname, compatible with DNS. This controls the
hostname5
configuration file.Initialize the system's machine ID to a random ID. This controls the
machine-id5 file.
This option only works in combination with or
. On a running system, machine-id is written by the
manager with help from
systemd-machine-id-commit.service8.
Set the system's machine ID to the specified value. The same restrictions apply
as to .Sets the password of the system's root user. This creates/modifies the
passwd5 and
shadow5
files. This setting exists in three forms: accepts the password to
set directly on the command line, reads it from a file and
accepts an already hashed password on the command line. See
shadow5
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
ps1.
Sets the shell of the system's root user. This creates/modifies the
passwd5
file.Sets the system's kernel command line. This controls the
/etc/kernel/cmdline file which is used by
kernel-install8.
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.Query the user for locale, keymap, timezone, hostname,
root's password, and root's shell. This is equivalent to specifying
,
,
,
,
,
in combination.Copy a specific basic setting from the host.
This only works in combination with or .
Copy locale, keymap, time zone, root password and shell from the host. This is
equivalent to specifying
,
,
,
,
in combination.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.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.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.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.Credentialssystemd-firstboot supports the service credentials logic as implemented by
ImportCredential=/LoadCredential=/SetCredential=
(see systemd.exec1 for
details). The following credentials are used when passed in:passwd.hashed-password.rootpasswd.plaintext-password.rootA hashed or plaintext version of the root password to use, in place of prompting the
user. These credentials are equivalent to the same ones defined for the
systemd-sysusers.service8
service.passwd.shell.rootSpecifies the shell binary to use for the specified account.
Equivalent to the credential of the same name defined for the
systemd-sysusers.service8
service.firstboot.localefirstboot.locale-messagesThese credentials specify the locale settings to set during first boot, in place of
prompting the user.firstboot.keymapThis credential specifies the keyboard setting to set during first boot, in place of
prompting the user.Note the relationship to the vconsole.keymap credential understood by
systemd-vconsole-setup.service8:
both ultimately affect the same setting, but firstboot.keymap is written into
/etc/vconsole.conf on first boot (if not already configured), and then read from
there by systemd-vconsole-setup, while vconsole.keymap is read
on every boot, and is not persisted to disk (but any configuration in
vconsole.conf will take precedence if present).firstboot.timezoneThis credential specifies the system timezone setting to set during first boot, in
place of prompting the user.Note that by default the systemd-firstboot.service unit file is set up to
inherit the listed credentials
from the service manager. Thus, when invoking a container with an unpopulated /etc/
for the first time it is possible to configure the root user's password to be systemd
like this:# systemd-nspawn --image=… --set-credential=firstboot.locale:de_DE.UTF-8 …Note that these credentials are only read and applied during the first boot process. Once they are
applied they remain applied for subsequent boots, and the credentials are not considered anymore.Exit statusOn success, 0 is returned, a non-zero failure code
otherwise.Kernel Command Linesystemd.firstboot=Takes a boolean argument, defaults to on. If off, systemd-firstboot.service
won't interactively query the user for basic settings at first boot, even if those settings are not
initialized yet.See Alsosystemd1,
locale.conf5,
vconsole.conf5,
localtime5,
hostname5,
machine-id5,
shadow5,
systemd-machine-id-setup1,
localectl1,
timedatectl1,
hostnamectl1